Skip to content

Commit 24b4172

Browse files
committed
Add check_rebar target to the Makefile to fetch rebar3 if it doesn't exist.
1 parent b5cde63 commit 24b4172

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

Makefile

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REBAR = $(shell which rebar3 || echo ./rebar3)
1+
REBAR = $(shell which rebar3)
22

33
## Common variables
44
CONFIG ?= test/test.config
@@ -11,25 +11,36 @@ CT_BUILD_PATH = $(CT_PATH)/lib/*/ebin
1111
CT_SUITES = task_SUITE local_SUITE dist_SUITE
1212
CT_OPTS = -cover test/cover.spec -erl_args -config ${CONFIG}
1313

14-
.PHONY: all compile clean distclean dialyze tests shell doc
14+
.PHONY: all check_rebar compile clean distclean dialyze tests shell doc
1515

16-
all: compile
16+
all: check_rebar compile
1717

18-
compile:
18+
check_rebar:
19+
ifeq ($(REBAR),)
20+
ifeq ($(wildcard rebar3),)
21+
curl -O https://s3.amazonaws.com/rebar3/rebar3
22+
chmod a+x rebar3
23+
$(eval REBAR=./rebar3)
24+
else
25+
$(eval REBAR=./rebar3)
26+
endif
27+
endif
28+
29+
compile: check_rebar
1930
$(REBAR) compile
2031

21-
clean:
32+
clean: check_rebar
2233
rm -rf ebin/* test/*.beam logs log
2334
$(REBAR) clean
2435

2536
distclean: clean
2637
$(REBAR) clean --all
2738
rm -rf _build logs log edoc *.dump c_src/*.o priv/*.so
2839

29-
dialyze:
40+
dialyze: check_rebar
3041
$(REBAR) dialyzer
3142

32-
tests:
43+
tests: check_rebar
3344
$(REBAR) as test compile
3445
mkdir -p $(CT_PATH)/logs
3546
ct_run -dir test -suite $(CT_SUITES) -pa $(CT_BUILD_PATH) -logdir $(CT_PATH)/logs $(CT_OPTS)

rebar3

-714 KB
Binary file not shown.

0 commit comments

Comments
 (0)