Files
pcas/configure/RULES_EXPAND
T
2015-10-10 18:55:17 +02:00

54 lines
1.3 KiB
Plaintext

# <top>/configure/RULES_EXPAND
vpath %@ $(USR_VPATH) $(ALL_SRC_DIRS)
#---------------------------------------------------------------
# Variable expansion
# Default settings
EXPAND_TOOL ?= $(PERL) $(TOOLS)/expandVars.pl
EXPANDFLAGS += -t $(INSTALL_LOCATION) -a $(T_A)
EXPANDFLAGS += $(addprefix -D ,$(EXPAND_VARS))
# The names of files to be expanded must end with '@'
EXPANDED = $(EXPAND:%@=%)
buildInstall: $(EXPANDED)
$(EXPANDED): %: %@
$(ECHO) "Expanding $< to $@"
@$(RM) $@
@$(EXPAND_TOOL) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@
clean: expand_clean
expand_clean:
@$(RM) $(EXPANDED)
.PHONY : expand_clean
#---------------------------------------------------------------
# Assemblies (files assembled from snippets)
ASSEMBLE_TOOL ?= $(PERL) $(TOOLS)/assembleSnippets.pl
define COMMON_ASSEMBLY_template
$(COMMON_DIR)/$1: $($1_SNIPPETS)
@echo "Assembling file $$@ from snippets"
@$(RM) $1
$(ASSEMBLE_TOOL) -o $1 $($1_SNIPPETS)
@$(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"
@$(RM) $$@
$(ASSEMBLE_TOOL) -o $$@ $($1_SNIPPETS)
endef
$(foreach asy, $(ASSEMBLIES), \
$(eval $(call ASSEMBLY_template,$(strip $(asy)))))