summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-07-10 14:34:12 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-07-10 14:34:12 +0000
commit4a4ce3ccc686d4f389fbe9c87c53326aaf3d4c7e (patch)
tree35a7545cd8a1d5b150a0186a7e63571d30fcc81e /test
parentab35ba70b41a06cfd3d2bb92da0c34ccf9420fc1 (diff)
downloadlibhubbub-4a4ce3ccc686d4f389fbe9c87c53326aaf3d4c7e.tar.gz
libhubbub-4a4ce3ccc686d4f389fbe9c87c53326aaf3d4c7e.tar.bz2
Improved dependency tracking.
There's currently an issue that means that testcases don't get rebuilt when the debug library changes -- the workaround is to make clean. I've currently no idea how to fix this -- see the FIXME in test/Makefile for details. svn path=/trunk/hubbub/; revision=4571
Diffstat (limited to 'test')
-rw-r--r--test/Makefile28
1 files changed, 25 insertions, 3 deletions
diff --git a/test/Makefile b/test/Makefile
index 97648e4..b2061c8 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -49,7 +49,8 @@ TESTS_$(d) := $(TESTS_$(d)) regression/cscodec-segv regression/filter-segv \
ITEMS_CLEAN := $(ITEMS_CLEAN) \
$(addprefix $(d), $(addsuffix $(EXEEXT), $(TESTS_$(d)))) \
$(addprefix $(d), $(addsuffix .gcda, $(TESTS_$(d)))) \
- $(addprefix $(d), $(addsuffix .gcno, $(TESTS_$(d))))
+ $(addprefix $(d), $(addsuffix .gcno, $(TESTS_$(d)))) \
+ $(addprefix $(d), $(addsuffix .d, $(TESTS_$(d))))
ITEMS_DISTCLEAN := $(ITEMS_DISTCLEAN) $(d)log
# Targets for top-level makefile to run
@@ -64,9 +65,23 @@ TARGET_TESTS := $(TARGET_TESTS) test_$(d)
test_$(d): $(d) $(addprefix $(d), $(TESTS_$(d)))
@$(PERL) $(TOP)/$<testrunner.pl $(TOP)/$< $(EXEEXT)
+DEP_$(d) :=
+
+define dep_test
+DEP_$(d) += $(2)
+$(2): $(1)
+ @$$(RM) $$(RMFLAGS) $(2)
+ @$$(CC) $$(DEBUGCFLAGS) -MM -MT '$(2) $(3)' -MF $(2) $(1)
+
+endef
+
# Build rules for each test binary -- they all depend on the debug library
+# FIXME - these need to depend on the debug library, so they're rebuilt when
+# it changes. Simply adding it to the prerequisites list causes all test
+# drivers to be rebuilt every time, regardless of if there have been any
+# changes.
define compile_test
-$(2): $$(TOP)/$$(COMPONENT)-debug.a $(1)
+$(2): $(3)
@$$(ECHO) $$(ECHOFLAGS) "==> $(1)"
@$$(CC) -c -g $$(DEBUGCFLAGS) -o $$@.o $(1)
@$$(LD) -g -o $$@ $$@.o $$(LDFLAGS) -lhubbub-debug -lgcov
@@ -75,7 +90,14 @@ $(2): $$(TOP)/$$(COMPONENT)-debug.a $(1)
endef
$(eval $(foreach TEST,$(addprefix $(d), $(TESTS_$(d))), \
- $(call compile_test,$(addsuffix .c, $(TEST)),$(TEST))))
+ $(call dep_test,$(addsuffix .c, $(TEST)),$(addsuffix .d, $(TEST)),$(TEST))))
+
+ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
+-include $(sort $(DEP_$(d)))
+endif
+
+$(eval $(foreach TEST,$(addprefix $(d), $(TESTS_$(d))), \
+ $(call compile_test,$(addsuffix .c, $(TEST)),$(TEST),$(addsuffix .d, $(TEST)))))
# Now include any children we may have
MAKE_INCLUDES := $(wildcard $(d)*/Makefile)