diff options
-rw-r--r-- | erlang.mk | 34 |
1 files changed, 23 insertions, 11 deletions
@@ -58,7 +58,7 @@ ifneq ($(wildcard $(RELX_CONFIG)),) RELX ?= $(CURDIR)/relx export RELX -RELX_URL ?= https://github.com/erlware/relx/releases/download/v0.5.2/relx +RELX_URL ?= https://github.com/erlware/relx/releases/download/v0.6.0/relx RELX_OPTS ?= define get_relx @@ -90,7 +90,13 @@ ALL_TEST_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(TEST_DEPS)) # Application. -ERL_LIBS ?= $(DEPS_DIR) +ifeq ($(filter $(DEPS_DIR),$(subst :, ,$(ERL_LIBS))),) +ifeq ($(ERL_LIBS),) + ERL_LIBS = $(DEPS_DIR) +else + ERL_LIBS := $(ERL_LIBS):$(DEPS_DIR) +endif +endif export ERL_LIBS ERLC_OPTS ?= -Werror +debug_info +warn_export_all +warn_export_vars \ @@ -126,7 +132,7 @@ define compile_dtl Compile = fun(F) -> \ Module = list_to_atom( \ string:to_lower(filename:basename(F, ".dtl")) ++ "_dtl"), \ - erlydtl_compiler:compile(F, Module, [{out_dir, "ebin/"}]) \ + erlydtl:compile(F, Module, [{out_dir, "ebin/"}]) \ end, \ _ = [Compile(F) || F <- string:tokens("$(1)", " ")], \ init:stop()' @@ -203,25 +209,29 @@ clean-docs: $(foreach dep,$(TEST_DEPS),$(eval $(call dep_target,$(dep)))) +TEST_ERLC_OPTS ?= +debug_info +warn_export_vars +warn_shadow_vars +warn_obsolete_guard +TEST_ERLC_OPTS += -DTEST=1 -DEXTRA=1 +'{parse_transform, eunit_autoexport}' + build-test-deps: $(ALL_TEST_DEPS_DIRS) @for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done build-tests: build-test-deps - $(gen_verbose) erlc -v $(ERLC_OPTS) -o test/ \ + $(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -o test/ \ $(wildcard test/*.erl test/*/*.erl) -pa ebin/ +CT_OPTS ?= CT_RUN = ct_run \ -no_auto_compile \ -noshell \ -pa $(realpath ebin) $(DEPS_DIR)/*/ebin \ -dir test \ - -logdir logs -# -cover test/cover.spec + -logdir logs \ + $(CT_OPTS) CT_SUITES ?= define test_target -test_$(1): ERLC_OPTS += -DTEST=1 +'{parse_transform, eunit_autoexport}' +test_$(1): ERLC_OPTS = $(TEST_ERLC_OPTS) test_$(1): clean deps app build-tests @if [ -d "test" ] ; \ then \ @@ -233,7 +243,7 @@ endef $(foreach test,$(CT_SUITES),$(eval $(call test_target,$(test)))) -tests: ERLC_OPTS += -DTEST=1 +'{parse_transform, eunit_autoexport}' +tests: ERLC_OPTS = $(TEST_ERLC_OPTS) tests: clean deps app build-tests @if [ -d "test" ] ; \ then \ @@ -244,16 +254,18 @@ tests: clean deps app build-tests # Dialyzer. +DIALYZER_PLT ?= $(CURDIR)/.$(PROJECT).plt +export DIALYZER_PLT + PLT_APPS ?= DIALYZER_OPTS ?= -Werror_handling -Wrace_conditions \ -Wunmatched_returns # -Wunderspecs build-plt: deps app - @dialyzer --build_plt --output_plt .$(PROJECT).plt \ - --apps erts kernel stdlib $(PLT_APPS) $(ALL_DEPS_DIRS) + @dialyzer --build_plt --apps erts kernel stdlib $(PLT_APPS) $(ALL_DEPS_DIRS) dialyze: - @dialyzer --src src --plt .$(PROJECT).plt --no_native $(DIALYZER_OPTS) + @dialyzer --src src --no_native $(DIALYZER_OPTS) # Packages. |