diff --git a/configure/RULES_EXPAND b/configure/RULES_EXPAND index 69636db19..0f43db347 100644 --- a/configure/RULES_EXPAND +++ b/configure/RULES_EXPAND @@ -34,20 +34,32 @@ expand_clean: ASSEMBLE_TOOL ?= $(PERL) $(TOOLS)/assembleSnippets.pl define COMMON_ASSEMBLY_template -$(COMMON_DIR)/$1: $($1_SNIPPETS) - @echo "Assembling file $$@ from snippets" +$1_SNIPPETS += $$(foreach dir, .. $$(SRC_DIRS), \ + $$(wildcard $$(dir)/$$($1_PATTERN))) +$(COMMON_DIR)/$1: $$($1_SNIPPETS) + $(ECHO) "Assembling common file $$@ from snippets" @$(RM) $1 - $(ASSEMBLE_TOOL) -o $1 $($1_SNIPPETS) + $(ASSEMBLE_TOOL) -o $1 $$^ @$(MV) $1 $$@ endef $(foreach asy, $(COMMON_ASSEMBLIES), \ $(eval $(call COMMON_ASSEMBLY_template,$(strip $(asy))))) define ASSEMBLY_template -$1: $($1_SNIPPETS) - @echo "Assembling file $$@ from snippets" +$1_SNIPPETS += $$(foreach dir, .. $$(SRC_DIRS), \ + $$(wildcard $$(dir)/$$($1_PATTERN))) +$1: $$($1_SNIPPETS) + $(ECHO) "Assembling file $$@ from snippets" @$(RM) $$@ - $(ASSEMBLE_TOOL) -o $$@ $($1_SNIPPETS) + $(ASSEMBLE_TOOL) -o $$@ $$^ endef $(foreach asy, $(ASSEMBLIES), \ $(eval $(call ASSEMBLY_template,$(strip $(asy))))) + +define ASSEMBLY_DEP_template +$1$(DEP): + @echo $1: > $$@ +endef +$(foreach asy, $(sort $(COMMON_ASSEMBLIES) $(ASSEMBLIES)), \ + $(eval $(call ASSEMBLY_DEP_template,$(strip $(asy))))) +