diff --git a/Makefile.lib b/Makefile.lib index cde5a597..f0219e10 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -181,10 +181,12 @@ TESTDEPS += $(TESTDEPS-yes) TEST_LIB=$(top_srcdir)/test/libtest.sh export TEST_LIB -define test_prog -$(1): $(1).o $(TESTDEPS) - $$(call cmd,link) -endef +# This does the work for the next rule. It is a very general rule +# but as long as we don't put test programs in src/ it should work. +%: %.o $(TESTDEPS) + $(call cmd,link) + +$(TEST_PROGS): $(addsuffix .o,$(TEST_PROGS)) $(TESTDEPS) TESTS = $(wildcard $(srcdir)test-*) @@ -201,8 +203,6 @@ CLEAN += $(TEST_PROGS) $(addsuffix .o,$(TEST_PROGS)) clean-default: clean-test endif -$(foreach prog,$(TEST_PROGS),$(eval $(call test_prog,$(prog)))) - .PHONY: $(TESTS) .NOPARALLEL: