diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-03-25 15:39:03 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-03-25 15:39:03 +0000 |
commit | 9cb20e9fac583dc396c0f0c6a774b53ffe9f2bca (patch) | |
tree | c5d2efc97711768cee6cb96a91a1e1711c675135 /makefiles/Makefile.subdir | |
parent | 7b0f8f77593b0c270896c1cef77ea1d52eafcc64 (diff) | |
download | buildsystem-9cb20e9fac583dc396c0f0c6a774b53ffe9f2bca.tar.gz buildsystem-9cb20e9fac583dc396c0f0c6a774b53ffe9f2bca.tar.bz2 |
Rather less broken reconstruction of test/install items
svn path=/trunk/tools/buildsystem/; revision=6874
Diffstat (limited to 'makefiles/Makefile.subdir')
-rw-r--r-- | makefiles/Makefile.subdir | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/makefiles/Makefile.subdir b/makefiles/Makefile.subdir index f81b2cc..4f0c149 100644 --- a/makefiles/Makefile.subdir +++ b/makefiles/Makefile.subdir @@ -40,8 +40,8 @@ d := $(DIR) # Sources SRCS_$(d) := $(DIR_SOURCES) -TEST_ITEMS_$(d) := -INSTALL_ITEMS_$(d) := $(DIR_INSTALL_ITEMS) +TEST_ITEMS_$(d) := +INSTALL_ITEMS_$(d) := # Append to sources for component SOURCES := $(SOURCES) $(addprefix $(d), $(SRCS_$(d))) @@ -54,9 +54,24 @@ ifeq ($(MAKECMDGOALS),test) # Extract the list of sources from the ITEM sources = $(subst ;, ,$(lastword $(subst :, ,$(ITEM)))) + # We can't simply use the output of foreach here, + # as it space separates its output, which kinda defeats the point. + define append_test_src + TEST_ITEMS_$(d) := $$(TEST_ITEMS_$(d))$1; + + endef + + define append_test + TEST_ITEMS_$(d) := $$(TEST_ITEMS_$(d)) $1: + + $$(eval $$(foreach TSRC,$2, \ + $$(call append_test_src,$$(addprefix $$(d),$$(TSRC))))) + + endef + # Append test items, prepending $(d) to each source file - TEST_ITEMS_$(d) := $(TEST_ITEMS_$(d)) $(foreach ITEM,$(DIR_TEST_ITEMS), \ - $(binary):$(foreach TSRC,$(sources),$(addprefix $(d),$(TSRC));)) + $(eval $(foreach ITEM,$(DIR_TEST_ITEMS), \ + $(call append_test,$(binary),$(sources)))) TEST_ITEMS := $(TEST_ITEMS) $(TEST_ITEMS_$(d)) @@ -79,10 +94,25 @@ ifneq ($(DIR_INSTALL_ITEMS),) # Extract the list of files to install files = $(subst ;, ,$(lastword $(subst :, ,$(ITEM)))) + define append_install_file + INSTALL_ITEMS_$(d) := $$(INSTALL_ITEMS_$(d))$1; + + endef + + define append_install_item + INSTALL_ITEMS_$(d) := $$(INSTALL_ITEMS_$(d)) $1: + + $$(eval $$(foreach FILE,$2, \ + $$(call append_install_file,$$(addprefix $$(d),$$(FILE))))) + + endef + # Append items to install (along with install location), prepending $(d) # to each item in the file list - INSTALL_ITEMS := $(INSTALL_ITEMS) $(foreach ITEM,$(INSTALL_ITEMS_$(d)), \ - $(dest_dir):$(foreach FILE,$(files),$(addprefix $(d),$(FILE));)) + $(eval $(foreach ITEM,$(DIR_INSTALL_ITEMS), \ + $(call append_install_item,$(dest_dir),$(files)))) + + INSTALL_ITEMS := $(INSTALL_ITEMS) $(INSTALL_ITEMS_$(d)) endif # Reset the inputs |