Skip to content

Commit 58bf043

Browse files
committed
Refactor into tools.mk
1 parent 56a217c commit 58bf043

File tree

3 files changed

+42
-41
lines changed

3 files changed

+42
-41
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ erl_crash.dump
77
.project
88
log
99
deps
10-
.lager_combo_dialyzer_plt
10+
.local_dialyzer_plt

Makefile

+2-40
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,6 @@ clean:
1515
distclean: clean
1616
./rebar delete-deps
1717

18-
test:
19-
./rebar compile eunit
20-
21-
##
22-
## Doc targets
23-
##
24-
docs:
25-
./rebar doc
26-
27-
APPS = kernel stdlib erts sasl eunit syntax_tools compiler crypto
28-
PLT ?= $(HOME)/.riak_combo_dialyzer_plt
29-
LOCAL_PLT = .lager_combo_dialyzer_plt
30-
31-
${PLT}: compile
32-
ifneq (,$(wildcard $(PLT)))
33-
dialyzer --check_plt --plt $(PLT) --apps $(APPS) && \
34-
dialyzer --add_to_plt --plt $(PLT) --output_plt $(PLT) --apps $(APPS) ; test $$? -ne 1
35-
else
36-
dialyzer --build_plt --output_plt $(PLT) --apps $(APPS); test $$? -ne 1
37-
endif
38-
39-
${LOCAL_PLT}: compile
40-
ifneq (,$(wildcard $(LOCAL_PLT)))
41-
dialyzer --check_plt --plt $(LOCAL_PLT) deps/*/ebin && \
42-
dialyzer --add_to_plt --plt $(LOCAL_PLT) --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1
43-
else
44-
dialyzer --build_plt --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1
45-
endif
46-
47-
dialyzer: ${PLT} ${LOCAL_PLT}
48-
dialyzer -Wunmatched_returns --plts $(PLT) $(LOCAL_PLT) -c ebin
49-
50-
cleanplt:
51-
@echo
52-
@echo "Are you sure? It takes several minutes to re-build."
53-
@echo Deleting $(PLT) and $(LOCAL_PLT) in 5 seconds.
54-
@echo
55-
sleep 5
56-
rm $(PLT)
57-
rm $(LOCAL_PLT)
18+
DIALYZER_APPS = kernel stdlib erts sasl eunit syntax_tools compiler crypto
5819

20+
include tools.mk

tools.mk

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
test: compile
2+
./rebar eunit skip_deps=true
3+
4+
docs:
5+
./rebar doc skip_deps=true
6+
7+
PLT ?= $(HOME)/.riak_combo_dialyzer_plt
8+
LOCAL_PLT = .local_dialyzer_plt
9+
DIALYZER_FLAGS ?= -Wunmatched_returns
10+
11+
${PLT}: compile
12+
ifneq (,$(wildcard $(PLT)))
13+
dialyzer --check_plt --plt $(PLT) --apps $(DIALYZER_APPS) && \
14+
dialyzer --add_to_plt --plt $(PLT) --output_plt $(PLT) --apps $(DIALYZER_APPS) ; test $$? -ne 1
15+
else
16+
dialyzer --build_plt --output_plt $(PLT) --apps $(DIALYZER_APPS); test $$? -ne 1
17+
endif
18+
19+
${LOCAL_PLT}: compile
20+
ifneq (,$(wildcard $(LOCAL_PLT)))
21+
dialyzer --check_plt --plt $(LOCAL_PLT) deps/*/ebin && \
22+
dialyzer --add_to_plt --plt $(LOCAL_PLT) --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1
23+
else
24+
dialyzer --build_plt --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1
25+
endif
26+
27+
dialyzer: ${PLT} ${LOCAL_PLT}
28+
@echo "==> $(shell basename $(shell pwd)) (dialyzer)"
29+
dialyzer $(DIALYZER_FLAGS) --plts $(PLT) $(LOCAL_PLT) -c ebin
30+
31+
cleanplt:
32+
@echo
33+
@echo "Are you sure? It takes several minutes to re-build."
34+
@echo Deleting $(PLT) and $(LOCAL_PLT) in 5 seconds.
35+
@echo
36+
sleep 5
37+
rm $(PLT)
38+
rm $(LOCAL_PLT)
39+

0 commit comments

Comments
 (0)