< prev index next >
make/common/MakeBase.gmk
Print this page
*** 510,543 ****
# Helper macro for SetupCopyFiles
# 1 : Source file
# 2 : Dest file
# 3 : Variable to add targets to
# 4 : Macro to call for copy operation
-
$2: $1
$(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
$$($$(strip $4))
$3 += $2
endef
define SetupCopyFiles
# param 1 is for example COPY_MYFILES
# param 2,3,4,5 are named args.
! # SRC : Source root dir
# DEST : Dest root dir
! # FILES : List of files to copy with absolute paths, or path relative to SRC. Must be in SRC.
# FLATTEN : Set to flatten the directory structure in the DEST dir.
! # MACRO : Optionally override the default macro used for making the copy. Default is 'install-file'
$(foreach i,2 3 4 5 6, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupCopyFiles($1),$2,$3,$4,$5,$6)
$(if $(7),$(error Internal makefile error: Too many arguments to SetupCopyFiles))
ifeq ($$($1_MACRO), )
$1_MACRO := install-file
endif
$$(foreach f, $$(patsubst $$($1_SRC)/%,%,$$($1_FILES)), \
$$(eval $$(call AddFileToCopy, $$($1_SRC)/$$f, \
$$($1_DEST)/$$(if $$($1_FLATTEN),$$(notdir $$f),$$f), $1, $$($1_MACRO))))
endef
--- 510,552 ----
# Helper macro for SetupCopyFiles
# 1 : Source file
# 2 : Dest file
# 3 : Variable to add targets to
# 4 : Macro to call for copy operation
$2: $1
$(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
$$($$(strip $4))
$3 += $2
endef
define SetupCopyFiles
# param 1 is for example COPY_MYFILES
# param 2,3,4,5 are named args.
! # SRC : Source root dir (defaults to dir of first file)
# DEST : Dest root dir
! # FILES : List of files to copy with absolute paths, or path relative to SRC.
! # Must be in SRC.
# FLATTEN : Set to flatten the directory structure in the DEST dir.
! # MACRO : Optionally override the default macro used for making the copy.
! # Default is 'install-file'
$(foreach i,2 3 4 5 6, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupCopyFiles($1),$2,$3,$4,$5,$6)
$(if $(7),$(error Internal makefile error: Too many arguments to SetupCopyFiles))
ifeq ($$($1_MACRO), )
$1_MACRO := install-file
endif
+ # Default SRC to the dir of the first file.
+ ifeq ($$($1_SRC), )
+ $1_SRC := $$(dir $$(firstword $$($1_FILES)))
+ endif
+
+ # Remove any trailing slash from SRC
+ $1_SRC := $$(patsubst %/,%,$$($1_SRC))
+
$$(foreach f, $$(patsubst $$($1_SRC)/%,%,$$($1_FILES)), \
$$(eval $$(call AddFileToCopy, $$($1_SRC)/$$f, \
$$($1_DEST)/$$(if $$($1_FLATTEN),$$(notdir $$f),$$f), $1, $$($1_MACRO))))
endef
< prev index next >