Skip to content

Commit

Permalink
Add Makefile
Browse files Browse the repository at this point in the history
Uses tools.mk
  • Loading branch information
reiddraper committed Jan 16, 2014
1 parent 19c532a commit 363b428
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Makefile
@@ -1,6 +1,9 @@
include tools.mk

all:
./rebar compile eunit
all: compile test

compile:
@./rebar compile

clean:
./rebar clean
./rebar clean
45 changes: 45 additions & 0 deletions 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)"
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)

0 comments on commit 363b428

Please sign in to comment.