1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-15 23:35:34 +00:00

Fix test program dependency on it's own .o by using a template

This commit is contained in:
Jonas Fonseca 2006-01-17 16:53:15 +01:00 committed by Jonas Fonseca
parent ed73a5c9b3
commit 9e3ba8736f

View File

@ -48,7 +48,7 @@ quiet_cmd_ld_objs = " [$(LD_COLOR)LD$(END_COLOR)] $(RELPATH)$@"
`test -e $(subdir)/$(LIB_O_NAME) && echo $(subdir)/$(LIB_O_NAME)`)
quiet_cmd_link = ' [$(LINK_COLOR)LINK$(END_COLOR)] $(RELPATH)$@'
cmd_link = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(2) $(LIBS)
cmd_link = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
quiet_cmd_sparse = ' [SPARSE] $(RELPATH)$(2)'
cmd_sparse = $(SPARSE) $(DEFS) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) $(SPARSE_FLAGS) $(2)
@ -178,14 +178,14 @@ ifdef TEST_PROGS
TESTDEPS-$(CONFIG_DEBUG) += $(top_builddir)/src/util/memdebug.o
TESTDEPS += $(TESTDEPS-yes)
define test_prog
$(1): $(1).o $(TESTDEPS)
$$(call cmd,link)
endef
TESTS = $(wildcard $(srcdir)test-*)
$(TEST_PROGS): $(TESTDEPS)
$(call cmd,link,$@.o)
# We cannot use $$@.o in the rule above so ensure that all test programs are
# built before linking.
$(TESTS): $(addsuffix .o,$(TEST_PROGS)) $(TEST_PROGS)
$(TESTS): $(TEST_PROGS)
@echo "*** $(notdir $@) ***"; \
$(call shellquote,$(SHELL)) $@ $(TEST_OPTS)
@ -198,6 +198,8 @@ CLEAN += $(TEST_PROGS) $(addsuffix .o,$(TEST_PROGS))
clean-default: clean-test
endif
$(foreach prog,$(TEST_PROGS),$(eval $(call test_prog,$(prog))))
.PHONY: $(TESTS)
.NOPARALLEL: