Skip to content

Commit

Permalink
Merge pull request #507 from basho/feature/tools.mk
Browse files Browse the repository at this point in the history
Use tools.mk Makefile
  • Loading branch information
Vagabond committed Jan 17, 2014
2 parents 3cf31cf + 1bc0458 commit 5015076
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ include/*_pb.hrl
doc/*
/.eqc-info
/current_counterexample.eqc
.local_dialyzer_plt
28 changes: 3 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
45 changes: 45 additions & 0 deletions tools.mk
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 5015076

Please sign in to comment.