1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

do not consider deps for EXESs when making goal "test"

In the normal case, one does, e.g.,
    make TEST="cat" test

This means that the value of EXES in the Makefile contains all
possible targets, which means many prerequisites that aren't
required get built.

With this change, when the `test` target is in effect (and,
in particular, *only* the test target), then the value of
EXES is ignored when calculating dependencies. Otherwise,
the values of EXES and TESTS are both considered.
This commit is contained in:
kwantam 2015-04-26 03:42:55 -04:00
parent 4727cc59d9
commit d54ee9689d

View file

@ -183,7 +183,13 @@ endef
DEPLIBS := libc
DEPPLUGS :=
# now, add in deps in src/utilname/deps.mk
$(foreach build,$(sort $(EXES) $(TESTS)),$(eval $(call DEP_INCLUDE,$(build))))
# if we're testing, only consider the TESTS variable,
# otherwise consider the EXES variable
ifeq ($(MAKECMDGOALS),test)
$(foreach build,$(TESTS),$(eval $(call DEP_INCLUDE,$(build))))
else
$(foreach build,$(sort $(TESTS) $(EXES)),$(eval $(call DEP_INCLUDE,$(build))))
endif
# uniqify deps
DEPLIBS := $(sort $(DEPLIBS))
DEPPLUGS := $(sort $(DEPPLUGS))
@ -248,8 +254,8 @@ endef
# Test exe built rules
define TEST_BUILD
test_$(1): $(TEMPDIR)/$(1)/$(1)_test $(BUILDDIR)/$(1)
$(call command,cp $(BUILDDIR)/$(1) $(TEMPDIR)/$(1) && cd $(TEMPDIR)/$(1) && $$<)
test_$(1): $(BUILDDIR)/$(1) $(TEMPDIR)/$(1)/$(1)_test
$(call command,cp $(BUILDDIR)/$(1) $(TEMPDIR)/$(1) && cd $(TEMPDIR)/$(1) && $(TEMPDIR)/$(1)/$(1)_test)
$(TEMPDIR)/$(1)/$(1)_test: $(TESTDIR)/$(1).rs | $(TEMPDIR)/$(1)
$(call command,$(RUSTC) $(RUSTCTESTFLAGS) $(DEP_EXTERN) --test -o $$@ $$<)