aboutsummaryrefslogtreecommitdiffstats
path: root/core/erlc.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-01-10 18:25:22 +0100
committerLoïc Hoguin <[email protected]>2015-01-10 18:41:44 +0100
commit7ee4e7958acf0f0956bd64023ecb1731b2824b5e (patch)
treebdeee9ec023b237d02cff28d9a33e6589877cb4f /core/erlc.mk
parent098aa65854199fe1f58e4bd870f948bdd597741a (diff)
downloaderlang.mk-7ee4e7958acf0f0956bd64023ecb1731b2824b5e.tar.gz
erlang.mk-7ee4e7958acf0f0956bd64023ecb1731b2824b5e.tar.bz2
erlang.mk-7ee4e7958acf0f0956bd64023ecb1731b2824b5e.zip
Introduce test builds and unify testing tools interface
The general idea is that erlang.mk now keeps track of what kind of build it generated. A test build is valid for all subsequent test target invocations. A normal build is only valid for itself and releases. This rework adds the ability to specify deps to eunit. The EUNIT_DIR variable is gone in favor of a more global TEST_DIR. The tests-ct target got renamed to ct and documented. Many more minor changes were done during the course of testing these changes.
Diffstat (limited to 'core/erlc.mk')
-rw-r--r--core/erlc.mk22
1 files changed, 13 insertions, 9 deletions
diff --git a/core/erlc.mk b/core/erlc.mk
index 8d720aa..e391da8 100644
--- a/core/erlc.mk
+++ b/core/erlc.mk
@@ -31,9 +31,15 @@ xyrl_verbose = $(xyrl_verbose_$(V))
mib_verbose_0 = @echo " MIB " $(filter %.bin %.mib,$(?F));
mib_verbose = $(mib_verbose_$(V))
-# Core targets.
+# Targets.
-app:: erlc-include ebin/$(PROJECT).app
+ifeq ($(wildcard ebin/test),)
+app:: app-build
+else
+app:: clean app-build
+endif
+
+app-build: erlc-include ebin/$(PROJECT).app
$(eval MODULES := $(shell find ebin -type f -name \*.beam \
| sed "s/ebin\//'/;s/\.beam/',/" | sed '$$s/.$$//'))
@if [ -z "$$(grep -E '^[^%]*{modules,' src/$(PROJECT).app.src)" ]; then \
@@ -46,6 +52,11 @@ app:: erlc-include ebin/$(PROJECT).app
| sed "s/{id,[[:space:]]*\"git\"}/{id, \"$(GITDESCRIBE)\"}/" \
> ebin/$(PROJECT).app
+erlc-include:
+ -@if [ -d ebin/ ]; then \
+ find include/ src/ -type f -name \*.hrl -newer ebin -exec touch $(shell find src/ -type f -name "*.erl") \; 2>/dev/null || printf ''; \
+ fi
+
define compile_erl
$(erlc_verbose) erlc -v $(ERLC_OPTS) -o ebin/ \
-pa ebin/ -I include/ $(filter-out $(ERLC_EXCLUDE_PATHS),\
@@ -85,13 +96,6 @@ endif
clean:: clean-app
-# Extra targets.
-
-erlc-include:
- -@if [ -d ebin/ ]; then \
- find include/ src/ -type f -name \*.hrl -newer ebin -exec touch $(shell find src/ -type f -name "*.erl") \; 2>/dev/null || printf ''; \
- fi
-
clean-app:
$(gen_verbose) rm -rf ebin/ priv/mibs/ \
$(addprefix include/,$(addsuffix .hrl,$(notdir $(basename $(wildcard mibs/*.mib)))))