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 xref check #2

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.PHONY: all compile deps clean distclean test check_plt build_plt dialyzer \
cleanplt

all: deps compile

compile: deps
./rebar compile

deps:
test -d deps || ./rebar get-deps

clean:
./rebar clean

distclean: clean
./rebar delete-deps

DIALYZER_APPS = kernel stdlib erts sasl eunit

include tools.mk
3 changes: 3 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{xref_checks, []}.
{xref_queries, [{"(XC - UC) || (XU - X - B - riak_core : Mod)", []}]}.

{deps, [
{canola, ".*", {git, "git://github.com/basho/canola.git", {branch, "develop"}}}
]}.
48 changes: 48 additions & 0 deletions tools.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
test: compile
./rebar eunit skip_deps=true

docs:
./rebar doc skip_deps=true

xref: compile
./rebar xref 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)