aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/dialyzer.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-12-04 20:42:59 +0100
committerLoïc Hoguin <[email protected]>2018-12-04 20:42:59 +0100
commit57afa89365907d64cc30379ffb525dfcd664f75e (patch)
tree8befcf485eb59e9fcc05fe8467f8067ba417c7a6 /plugins/dialyzer.mk
parent3acdef8ed9063b07c777970b264cef67592f90ee (diff)
downloaderlang.mk-57afa89365907d64cc30379ffb525dfcd664f75e.tar.gz
erlang.mk-57afa89365907d64cc30379ffb525dfcd664f75e.tar.bz2
erlang.mk-57afa89365907d64cc30379ffb525dfcd664f75e.zip
Rebuild the PLT file when the Erlang/OTP version has changed
Diffstat (limited to 'plugins/dialyzer.mk')
-rw-r--r--plugins/dialyzer.mk11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/dialyzer.mk b/plugins/dialyzer.mk
index 41e5871..0ac2ef0 100644
--- a/plugins/dialyzer.mk
+++ b/plugins/dialyzer.mk
@@ -42,11 +42,17 @@ define filter_opts.erl
halt().
endef
+# DIALYZER_PLT is a variable understood directly by Dialyzer.
+#
+# We append the path to erts at the end of the PLT. This works
+# because the PLT file is in the external term format and the
+# function binary_to_term/1 ignores any trailing data.
$(DIALYZER_PLT): deps app
$(eval DEPS_LOG := $(shell test -f $(ERLANG_MK_TMP)/deps.log && \
while read p; do test -d $$p/ebin && echo $$p/ebin; done <$(ERLANG_MK_TMP)/deps.log))
$(verbose) dialyzer --build_plt $(DIALYZER_PLT_OPTS) --apps \
erts kernel stdlib $(PLT_APPS) $(OTP_DEPS) $(LOCAL_DEPS) $(DEPS_LOG) || test $$? -eq 2
+ $(verbose) $(ERL) -eval 'io:format("~n~s~n", [code:lib_dir(erts)]), halt().' >> $@
plt: $(DIALYZER_PLT)
@@ -55,6 +61,11 @@ distclean-plt:
ifneq ($(wildcard $(DIALYZER_PLT)),)
dialyze: $(if $(filter --src,$(DIALYZER_DIRS)),,deps app)
+ $(verbose) if ! tail -n1 $(DIALYZER_PLT) | \
+ grep -q "^`$(ERL) -eval 'io:format("~s", [code:lib_dir(erts)]), halt().'`$$"; then \
+ rm $(DIALYZER_PLT); \
+ $(MAKE) plt; \
+ fi
else
dialyze: $(DIALYZER_PLT)
endif