mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Move the 'make test' handling to Makefile.lib
The test rule is defined when TEST_PROGS is defined. Users should also set TESTDEPS to get the correct object files linked in.
This commit is contained in:
parent
b52baed88f
commit
9debe3b3ae
36
Makefile.lib
36
Makefile.lib
@ -130,7 +130,7 @@ init-default:
|
|||||||
$(MKINSTALLDIRS) $(subdir) >/dev/null; \
|
$(MKINSTALLDIRS) $(subdir) >/dev/null; \
|
||||||
echo 'include $(SRC)/$(RELPATH)/$(subdir)/Makefile' > $(subdir)/Makefile;)
|
echo 'include $(SRC)/$(RELPATH)/$(subdir)/Makefile' > $(subdir)/Makefile;)
|
||||||
|
|
||||||
clean-default:
|
clean-default: clean-test
|
||||||
@-test -z "$(CLEAN)" || $(RM) $(CLEAN)
|
@-test -z "$(CLEAN)" || $(RM) $(CLEAN)
|
||||||
|
|
||||||
cleanall-default: clean-default
|
cleanall-default: clean-default
|
||||||
@ -141,6 +141,33 @@ ifneq ($(SPARSE),)
|
|||||||
$(call ncmd,sparse,$(file));)
|
$(call ncmd,sparse,$(file));)
|
||||||
endif
|
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
|
# sparse is architecture-neutral, which means that we need to tell it
|
||||||
# explicitly what architecture to check for. Fix this up for yours..
|
# explicitly what architecture to check for. Fix this up for yours..
|
||||||
SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
|
SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
|
||||||
@ -188,4 +215,11 @@ check-local:
|
|||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
.NOEXPORT:
|
.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
|
# vim:syntax=make
|
||||||
|
@ -15,29 +15,4 @@ TESTDEPS = \
|
|||||||
$(top_builddir)/src/util/string.o \
|
$(top_builddir)/src/util/string.o \
|
||||||
$(top_builddir)/src/util/memory.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
|
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))'
|
|
||||||
|
Loading…
Reference in New Issue
Block a user