60 # single file. 61 # SOURCE_BASE_DIR a common root to all SOURCE_DIRS. 62 # If specified, files will keep the path relative to the base in the 63 # OUTPUT_DIR. Otherwise, the hierarchy will be flattened into the OUTPUT_DIR. 64 # INCLUDE_FILES only include files matching these patterns (used only with 65 # SOURCE_DIRS) 66 # EXCLUDE_FILES exclude files matching these patterns (used only with 67 # SOURCE_DIRS) 68 # INCLUDES replace the occurances of a pattern with the contents of a file; 69 # one or more such include pattern, using the syntax: 70 # PLACEHOLDER => FILE_TO_INCLUDE ; ... 71 # Each PLACEHOLDER must be on a single, otherwise empty line (whitespace 72 # padding is allowed). 73 # REPLACEMENTS one or more text replacement patterns, using the syntax: 74 # PATTERN => REPLACEMENT_TEXT ; ... 75 # 76 # If both INCLUDES or REPLACEMENTS are present, then the includes will be 77 # processed first, and replacements will be done on the included fragments as well. 78 # If neither is present, the files will just be copied without modifications. 79 # 80 define SetupTextFileProcessing 81 $(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk)) 82 $(call EvalDebugWrapper,$(strip $1),$(call SetupTextFileProcessingInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) 83 endef 84 85 define SetupTextFileProcessingInner 86 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE)) 87 $(call LogSetupMacroEntry,SetupTextFileProcessing($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) 88 $(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk)) 89 90 ifneq ($$($1_SOURCE_FILES),) 91 ifneq ($$($1_SOURCE_DIRS),) 92 $$(error Cannot use both SOURCE_FILES and SOURCE_DIRS (in $1)) 93 endif 94 ifneq ($$($1_SOURCE_BASE_DIR),) 95 $$(error Cannot use SOURCE_BASE_DIR without SOURCE_DIRS (in $1)) 96 endif 97 ifneq ($$($1_EXCLUDE_FILES)$$($1_INCLUDE_FILES),) 98 $$(error Cannot INCLUDE/EXCLUDE_FILES with SOURCE_FILES (in $1)) 99 endif 100 else 101 ifeq ($$($1_SOURCE_DIRS),) 102 $$(error Must specify either SOURCE_FILES or SOURCE_DIRS (in $1)) 103 endif 104 # Find all files in the source trees. Sort to remove duplicates. 105 $$(foreach src, $$($1_SOURCE_DIRS), $$(if $$(wildcard $$(src)), , \ 106 $$(error SOURCE_DIRS contains missing directory $$(src) (in $1)))) 107 ifneq ($$($1_SOURCE_BASE_DIR),) 108 $$(foreach src, $$($1_SOURCE_DIRS), \ | 60 # single file. 61 # SOURCE_BASE_DIR a common root to all SOURCE_DIRS. 62 # If specified, files will keep the path relative to the base in the 63 # OUTPUT_DIR. Otherwise, the hierarchy will be flattened into the OUTPUT_DIR. 64 # INCLUDE_FILES only include files matching these patterns (used only with 65 # SOURCE_DIRS) 66 # EXCLUDE_FILES exclude files matching these patterns (used only with 67 # SOURCE_DIRS) 68 # INCLUDES replace the occurances of a pattern with the contents of a file; 69 # one or more such include pattern, using the syntax: 70 # PLACEHOLDER => FILE_TO_INCLUDE ; ... 71 # Each PLACEHOLDER must be on a single, otherwise empty line (whitespace 72 # padding is allowed). 73 # REPLACEMENTS one or more text replacement patterns, using the syntax: 74 # PATTERN => REPLACEMENT_TEXT ; ... 75 # 76 # If both INCLUDES or REPLACEMENTS are present, then the includes will be 77 # processed first, and replacements will be done on the included fragments as well. 78 # If neither is present, the files will just be copied without modifications. 79 # 80 SetupTextFileProcessing = $(NamedParamsMacroTemplate) 81 define SetupTextFileProcessingBody 82 83 ifneq ($$($1_SOURCE_FILES),) 84 ifneq ($$($1_SOURCE_DIRS),) 85 $$(error Cannot use both SOURCE_FILES and SOURCE_DIRS (in $1)) 86 endif 87 ifneq ($$($1_SOURCE_BASE_DIR),) 88 $$(error Cannot use SOURCE_BASE_DIR without SOURCE_DIRS (in $1)) 89 endif 90 ifneq ($$($1_EXCLUDE_FILES)$$($1_INCLUDE_FILES),) 91 $$(error Cannot INCLUDE/EXCLUDE_FILES with SOURCE_FILES (in $1)) 92 endif 93 else 94 ifeq ($$($1_SOURCE_DIRS),) 95 $$(error Must specify either SOURCE_FILES or SOURCE_DIRS (in $1)) 96 endif 97 # Find all files in the source trees. Sort to remove duplicates. 98 $$(foreach src, $$($1_SOURCE_DIRS), $$(if $$(wildcard $$(src)), , \ 99 $$(error SOURCE_DIRS contains missing directory $$(src) (in $1)))) 100 ifneq ($$($1_SOURCE_BASE_DIR),) 101 $$(foreach src, $$($1_SOURCE_DIRS), \ |