Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use tools.mk Makefile

  • Loading branch information...
commit 1bc04582dbaa3b65416d9211b9cf25e34650e34e 1 parent 73aff56
@reiddraper reiddraper authored
Showing with 49 additions and 25 deletions.
  1. +1 −0  .gitignore
  2. +3 −25 Makefile
  3. +45 −0 tools.mk
View
1  .gitignore
@@ -8,3 +8,4 @@ include/*_pb.hrl
doc/*
/.eqc-info
/current_counterexample.eqc
+.local_dialyzer_plt
View
28 Makefile
@@ -1,13 +1,12 @@
-APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
+DIALYZER_APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
public_key mnesia syntax_tools compiler
-PLT ?= $(HOME)/.riak_core_combo_dialyzer_plt
PULSE_TESTS = worker_pool_pulse
.PHONY: deps test
all: deps compile
-compile:
+compile: deps
./rebar compile
deps:
@@ -19,31 +18,10 @@ clean:
distclean: clean
./rebar delete-deps
-test: all
- ./rebar skip_deps=true eunit
-
# You should 'clean' before your first run of this target
# so that deps get built with PULSE where needed.
pulse:
./rebar compile -D PULSE
./rebar eunit -D PULSE skip_deps=true suite=$(PULSE_TESTS)
-docs: deps
- ./rebar skip_deps=true doc
-
-build_plt: compile
- dialyzer --build_plt --output_plt $(PLT) --apps $(APPS) \
- deps/*/ebin
-
-check_plt: compile
- dialyzer --check_plt --plt $(PLT) --apps $(APPS) \
- deps/*/ebin
-
-dialyzer: compile
- @echo
- @echo Use "'make check_plt'" to check PLT prior to using this target.
- @echo Use "'make build_plt'" to build PLT prior to using this target.
- @echo
- dialyzer --plt $(PLT) ebin
-
-
+include tools.mk
View
45 tools.mk
@@ -0,0 +1,45 @@
+test: compile
+ ./rebar eunit skip_deps=true
+
+docs:
+ ./rebar doc skip_deps=true
+
+PLT ?= $(HOME)/.riak_combo_dialyzer_plt
+LOCAL_PLT = .local_dialyzer_plt
+DIALYZER_FLAGS ?= -Wunmatched_returns
+
+${PLT}: compile
+ifneq (,$(wildcard $(PLT)))
+ dialyzer --check_plt --plt $(PLT) --apps $(DIALYZER_APPS) && \
+ dialyzer --add_to_plt --plt $(PLT) --output_plt $(PLT) --apps $(DIALYZER_APPS) ; test $$? -ne 1
+else
+ dialyzer --build_plt --output_plt $(PLT) --apps $(DIALYZER_APPS); test $$? -ne 1
+endif
+
+${LOCAL_PLT}: compile
+ifneq (,$(wildcard deps/*))
+ifneq (,$(wildcard $(LOCAL_PLT)))
+ dialyzer --check_plt --plt $(LOCAL_PLT) deps/*/ebin && \
+ dialyzer --add_to_plt --plt $(LOCAL_PLT) --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1
+else
+ dialyzer --build_plt --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1
+endif
+endif
+
+dialyzer: ${PLT} ${LOCAL_PLT}
+ @echo "==> $(shell basename $(shell pwd)) (dialyzer)"
+ @if [ -f $(LOCAL_PLT) ]; then \
+ dialyzer $(DIALYZER_FLAGS) --plts $(PLT) $(LOCAL_PLT) -c ebin; \
+ else \
+ dialyzer $(DIALYZER_FLAGS) --plts $(PLT) -c ebin; \
+ fi
+
+cleanplt:
+ @echo
+ @echo "Are you sure? It takes several minutes to re-build."
+ @echo Deleting $(PLT) and $(LOCAL_PLT) in 5 seconds.
+ @echo
+ sleep 5
+ rm $(PLT)
+ rm $(LOCAL_PLT)
+
Please sign in to comment.
Something went wrong with that request. Please try again.