-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrebar3.mk
58 lines (44 loc) · 1.24 KB
/
rebar3.mk
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.PHONY: clean compile distclean dialyzer rel run test rebar3_upgrade
REBAR3_URL := https://s3.amazonaws.com/rebar3/rebar3
# If there is a rebar in the current directory, use it
ifeq ($(wildcard rebar3),rebar3)
REBAR3 := $(CURDIR)/rebar3
endif
# Fallback to rebar on PATH
REBAR3 ?= $(shell which rebar3 2>/dev/null || echo "$(CURDIR)/rebar3")
# And finally, prep to download rebar if all else fails
ifeq ($(REBAR3),)
REBAR3 := $(CURDIR)/rebar3
endif
clean: rebar3
@$(REBAR3) clean
compile: rebar3
@$(REBAR3) compile
distclean: rebar3
@$(REBAR3) clean
@rm -rf $(CURDIR)/_build $(CURDIR)/rebar.lock
dialyzer: compile
@$(REBAR3) dialyzer
rebar3_upgrade: rebar3
@$(REBAR3) local upgrade
rel: rebar3
@$(REBAR3) release
run: rebar3
@$(REBAR3) shell
test: compile
@$(REBAR3) eunit
@$(REBAR3) ct
rebar3: $(REBAR3)
$(REBAR3):
@echo "Retrieving $(REBAR3) from $(REBAR3_URL)"
@curl -sLo $(REBAR3) $(REBAR3_URL) || wget $(REBAR3_URL)
@chmod a+x $(REBAR3)
@echo
@echo '************************************************************************'
@echo 'NOTE - please follow these instructions:'
@echo
$(CURDIR)/rebar3 local install
@echo
@echo '************************************************************************'
@echo
@rm -f $(CURDIR)/rebar3