mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
Fix test program dependency on it's own .o by using a template
This commit is contained in:
parent
ed73a5c9b3
commit
9e3ba8736f
16
Makefile.lib
16
Makefile.lib
@ -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)`)
|
`test -e $(subdir)/$(LIB_O_NAME) && echo $(subdir)/$(LIB_O_NAME)`)
|
||||||
|
|
||||||
quiet_cmd_link = ' [$(LINK_COLOR)LINK$(END_COLOR)] $(RELPATH)$@'
|
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)'
|
quiet_cmd_sparse = ' [SPARSE] $(RELPATH)$(2)'
|
||||||
cmd_sparse = $(SPARSE) $(DEFS) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) $(SPARSE_FLAGS) $(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-$(CONFIG_DEBUG) += $(top_builddir)/src/util/memdebug.o
|
||||||
TESTDEPS += $(TESTDEPS-yes)
|
TESTDEPS += $(TESTDEPS-yes)
|
||||||
|
|
||||||
|
define test_prog
|
||||||
|
$(1): $(1).o $(TESTDEPS)
|
||||||
|
$$(call cmd,link)
|
||||||
|
endef
|
||||||
|
|
||||||
TESTS = $(wildcard $(srcdir)test-*)
|
TESTS = $(wildcard $(srcdir)test-*)
|
||||||
|
|
||||||
$(TEST_PROGS): $(TESTDEPS)
|
$(TESTS): $(TEST_PROGS)
|
||||||
$(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)
|
|
||||||
@echo "*** $(notdir $@) ***"; \
|
@echo "*** $(notdir $@) ***"; \
|
||||||
$(call shellquote,$(SHELL)) $@ $(TEST_OPTS)
|
$(call shellquote,$(SHELL)) $@ $(TEST_OPTS)
|
||||||
|
|
||||||
@ -198,6 +198,8 @@ CLEAN += $(TEST_PROGS) $(addsuffix .o,$(TEST_PROGS))
|
|||||||
clean-default: clean-test
|
clean-default: clean-test
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(foreach prog,$(TEST_PROGS),$(eval $(call test_prog,$(prog))))
|
||||||
|
|
||||||
.PHONY: $(TESTS)
|
.PHONY: $(TESTS)
|
||||||
.NOPARALLEL:
|
.NOPARALLEL:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user