Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use tools.mk for dialyzer support #132

Merged
merged 1 commit into from

2 participants

@reiddraper

No description provided.

@Vagabond

+1, worksforme.

@reiddraper reiddraper merged commit 9fe14de into develop
@reiddraper reiddraper deleted the feature/tools.mk branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 16, 2014
  1. @reiddraper
This page is out of date. Refresh to see the latest.
Showing with 50 additions and 12 deletions.
  1. +1 −1  .gitignore
  2. +4 −11 Makefile
  3. +45 −0 tools.mk
View
2  .gitignore
@@ -5,4 +5,4 @@ priv/*.so
*.o
*.beam
*~
-#*#
+.local_dialyzer_plt
View
15 Makefile
@@ -86,15 +86,8 @@ pkgclean:
export BITCASK_TAG PKG_VERSION REPO REVISION
-APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
- xmerl webtool snmp public_key mnesia eunit syntax_tools compiler
-PLT = $(HOME)/.bitcask_dialyzer_plt
+DIALYZER_APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools \
+ crypto inets xmerl webtool snmp public_key mnesia eunit \
+ syntax_tools compiler
-build_plt: deps compile
- dialyzer --build_plt --output_plt $(PLT) --apps $(APPS) deps/*/ebin
-
-dialyzer: deps compile
- dialyzer -Wno_return --plt $(PLT) ebin
-
-clean_plt:
- rm $(PLT)
+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)"
+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)
+
Something went wrong with that request. Please try again.