aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-05-01 17:03:18 +0200
committerLoïc Hoguin <[email protected]>2013-05-01 17:03:18 +0200
commit747cba4d71643cd86894afa60836fddff83fd389 (patch)
tree4c813eaa04271c2b8cbb3a3eb7e2f69b321926cb
parent8e770f9672d8a40c11496d3f5561f11a7fa0c4f1 (diff)
downloaderlang.mk-747cba4d71643cd86894afa60836fddff83fd389.tar.gz
erlang.mk-747cba4d71643cd86894afa60836fddff83fd389.tar.bz2
erlang.mk-747cba4d71643cd86894afa60836fddff83fd389.zip
Add test-only dependencies
-rw-r--r--README.md12
-rw-r--r--erlang.mk8
2 files changed, 19 insertions, 1 deletions
diff --git a/README.md b/README.md
index 263c78d..e5596e9 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,18 @@ dep_bullet = https://github.com/extend/bullet.git 0.4.1
They will always be compiled using the command `make`.
+You can also specify test-only dependencies. These dependencies will only
+be downloaded when running `make tests`. The format is the same as above,
+except the variable `TEST_DEPS` holds the list of test-only dependencies.
+
+``` erlang
+TEST_DEPS = ct_helper
+dep_ct_helper = https://github.com/extend/ct_helper.git master
+```
+
+Please note that the test dependencies will only be compiled once
+when they are fetched, unlike the normal dependencies.
+
Commands
--------
diff --git a/erlang.mk b/erlang.mk
index 0ac0f3f..9e4c698 100644
--- a/erlang.mk
+++ b/erlang.mk
@@ -34,6 +34,7 @@ DEPS_DIR ?= $(CURDIR)/deps
export DEPS_DIR
ALL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(DEPS))
+ALL_TEST_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(TEST_DEPS))
# Application.
@@ -94,7 +95,12 @@ clean-docs:
# Tests.
-build-tests:
+$(foreach dep,$(TEST_DEPS),$(eval $(call dep_target,$(dep))))
+
+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/ \
$(wildcard test/*.erl test/*/*.erl) -pa ebin/