-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
43 lines (33 loc) · 785 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#
# Default target.
#
default: vendor
#
# Functions.
#
define vendored
VENDORED += $(1)
.SILENT: $(1)
$(1):
echo "fetching $(1)..." && \
mkdir -p "$(dir $(1))" && \
curl -s -L -o "$(1)" "$(2)" && \
([[ "$(1)" == "bin/"* ]] && chmod +x "$(1)") || exit 0
.PHONY: remove_$(1)
.SILENT: remove_$(1)
remove_$(1):
(test -f "$(1)" && rm "$(1)" && echo "removed $(1)") || exit 0
.PHONY: update_$(1)
.SILENT: update_$(1)
update_$(1): remove_$(1) $(1)
endef
#
# Defined vendored dependencies.
#
$(eval $(call vendored,bin/rubocop-daemon-wrapper,https://github.com/fohte/rubocop-daemon/raw/master/bin/rubocop-daemon-wrapper))
#
# Main targets.
#
vendor: $(VENDORED)
update_vendor: $(foreach file,$(VENDORED),update_$(file))
remove_vendor: $(foreach file,$(VENDORED),remove_$(file))