aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-05-14 16:56:40 +0300
committerLoïc Hoguin <[email protected]>2015-05-14 16:56:40 +0300
commita34d21e62d3b53c149882e1307f3f77def89c918 (patch)
tree7ec7b3ab3e16dee1959fb1c9b521566ebb66b708
parentfb9768544c2a17ba8e858fe2ba50669b054a9945 (diff)
downloaderlang.mk-a34d21e62d3b53c149882e1307f3f77def89c918.tar.gz
erlang.mk-a34d21e62d3b53c149882e1307f3f77def89c918.tar.bz2
erlang.mk-a34d21e62d3b53c149882e1307f3f77def89c918.zip
Make sure auto patched dependencies recompile fine
-rw-r--r--core/deps.mk8
-rw-r--r--plugins/c_src.mk3
-rw-r--r--test/Makefile2
3 files changed, 13 insertions, 0 deletions
diff --git a/core/deps.mk b/core/deps.mk
index 24eea71..103426d 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -148,6 +148,14 @@ define dep_autopatch_rebar.erl
_ -> ok
end
end(),
+ fun() ->
+ case filelib:is_dir("$(DEPS_DIR)/$(1)/c_src") of
+ false -> ok;
+ true ->
+ Sources = [[" ./c_src/", S] || S <- filelib:wildcard("*.{c,C,cc,cpp}", "$(DEPS_DIR)/$(1)/c_src")],
+ Write(io_lib:format("SOURCES := ~s\n", [Sources]))
+ end
+ end(),
Write("\n\nrebar_dep: pre-deps deps pre-app app\n"),
Write("\npre-deps::\n"),
Write("\npre-app::\n"),
diff --git a/plugins/c_src.mk b/plugins/c_src.mk
index 5616923..2a0d006 100644
--- a/plugins/c_src.mk
+++ b/plugins/c_src.mk
@@ -59,7 +59,10 @@ clean::
$(MAKE) -C $(C_SRC_DIR) clean
else
+
+ifeq ($(SOURCES),)
SOURCES := $(shell find $(C_SRC_DIR) -type f \( -name "*.c" -o -name "*.C" -o -name "*.cc" -o -name "*.cpp" \))
+endif
OBJECTS = $(addsuffix .o, $(basename $(SOURCES)))
COMPILE_C = $(c_verbose) $(CC) $(CFLAGS) $(CPPFLAGS) -c
diff --git a/test/Makefile b/test/Makefile
index 9b7d4a1..bed5b4b 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -217,6 +217,7 @@ pkg-$(1)-clean:
pkg-$(1)-app1:
$(call app1_setup)
+# Running 'make' twice to make sure it recompiles fine.
pkg-$(1): pkg-$(1)-clean pkg-$(1)-app1
$i
$i " pkgs: Checking that '$(1)' builds correctly"
@@ -228,6 +229,7 @@ pkg-$(1): pkg-$(1)-clean pkg-$(1)-app1
> app1/Makefile
cp ../packages.v2.tsv app1/.erlang.mk.packages.v2
$t make -C app1
+ $t make -C app1
endef
$(foreach pkg,$(shell awk '{print $$1}' ../packages.v2.tsv),$(eval $(call pkg_test_target,$(pkg))))