diff --git a/Makefile.lib b/Makefile.lib index a131be75..2d2bfab8 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -130,7 +130,7 @@ init-default: $(MKINSTALLDIRS) $(subdir) >/dev/null; \ echo 'include $(SRC)/$(RELPATH)/$(subdir)/Makefile' > $(subdir)/Makefile;) -clean-default: +clean-default: clean-test @-test -z "$(CLEAN)" || $(RM) $(CLEAN) cleanall-default: clean-default @@ -141,6 +141,33 @@ ifneq ($(SPARSE),) $(call ncmd,sparse,$(file));) endif +############################################################################## +# +# Auto-testing infrastructure +# + +clean-test: + +ifdef TEST_PROGS +$(TEST_PROGS): $(TESTDEPS) $$@.o + $(call cmd,link) + +TESTS = $(wildcard test-*) + +$(TESTS): $(TEST_PROGS) + @echo "*** $@ ***"; $(call shellquote,$(SHELL)) $@ $(TEST_OPTS) + +test: $(TESTS) + +clean-test: + @rm -fr trash + +CLEAN += $(TEST_PROGS) $(patsubst %,%.o,$(TEST_PROGS)) +endif + +.PHONY: $(TESTS) +.NOPARALLEL: + # sparse is architecture-neutral, which means that we need to tell it # explicitly what architecture to check for. Fix this up for yours.. SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ @@ -188,4 +215,11 @@ check-local: # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: +# Shell quote; +# Result of this needs to be placed inside '' +# XXX: Placed here because Vim cannot highlight things right afterwards +shq = $(subst ','\'',$(1)) +# This has surrounding '' +shellquote = '$(call shq,$(1))' + # vim:syntax=make diff --git a/src/dom/test/Makefile b/src/dom/test/Makefile index 7fec267f..890e896d 100644 --- a/src/dom/test/Makefile +++ b/src/dom/test/Makefile @@ -15,29 +15,4 @@ TESTDEPS = \ $(top_builddir)/src/util/string.o \ $(top_builddir)/src/util/memory.o -$(TEST_PROGS): $(TESTDEPS) $$@.o - $(call cmd,link) - -TESTS = $(wildcard test-*) - -$(TESTS): $(TEST_PROGS) - @echo "*** $@ ***"; $(call shellquote,$(SHELL)) $@ $(TEST_OPTS) - -test: $(TESTS) - -clean-local: - @rm -fr trash - -CLEAN += $(TEST_PROGS) $(patsubst %,%.o,$(TEST_PROGS)) - -.PHONY: $(TESTS) -.NOPARALLEL: - include $(top_srcdir)/Makefile.lib - -# Shell quote; -# Result of this needs to be placed inside '' -# XXX: Placed here because Vim cannot highlight things right afterwards -shq = $(subst ','\'',$(1)) -# This has surrounding '' -shellquote = '$(call shq,$(1))'