Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tools.mk and a Makefile that uses it #5

Merged
merged 1 commit into from
Jan 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.PHONY: rel deps test

all: deps compile

compile: deps
@./rebar compile

app:
@./rebar compile skip_deps=true

deps:
@./rebar get-deps

clean:
@./rebar clean

distclean: clean
@./rebar delete-deps

DIALYZER_APPS = kernel stdlib sasl erts compiler syntax_tools

include tools.mk

typer:
typer --annotate -I ../ --plt $(PLT) -r src
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)"
ifeq (,$(wildcard $(LOCAL_PLT)))
dialyzer $(DIALYZER_FLAGS) --plts $(PLT) -c ebin
else
dialyzer $(DIALYZER_FLAGS) --plts $(PLT) $(LOCAL_PLT) -c ebin
endif

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)