-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
52 lines (35 loc) · 972 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
44
45
46
47
48
49
50
51
.PHONY: compile ct dialyzer docclean distclean docs xref clean
REBAR_PROFILE ?= default
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
$(info $(THIS_MAKEFILE) is using REBAR_PROFILE=$(REBAR_PROFILE))
REBAR3_URL = https://s3.amazonaws.com/rebar3/rebar3
# If there is a rebar in the current directory, use it
ifeq ($(wildcard rebar3),rebar3)
REBAR = $(CURDIR)/rebar3
endif
# Fallback to rebar on PATH
REBAR ?= $(shell which rebar3)
# And finally, prep to download rebar if all else fails
ifeq ($(REBAR),)
REBAR = $(CURDIR)/rebar3
endif
all: compile
compile: $(REBAR)
$(REBAR) do clean, compile
clean: docclean
$(REBAR) clean
ct: $(REBAR)
$(REBAR) do clean, ct
dialyzer: $(REBAR)
$(REBAR) dialyzer
docclean:
@rm -f doc/*.html doc/*.md doc/erlang.png doc/edoc-info
distclean: clean
@rm -rf _build logs .test
docs: $(REBAR)
$(REBAR) edoc
xref: $(REBAR)
$(REBAR) xref
$(REBAR):
curl -s -Lo rebar3 $(REBAR3_URL) || wget $(REBAR3_URL)
chmod a+x $(REBAR)