Make copy-many-files take an optional destination directory

Test: m checkbuild
Change-Id: I777952d27bd1a0cf2608e080a0f46e39268784ce
This commit is contained in:
Colin Cross 2019-02-11 14:24:38 -08:00
parent cd75414f1e
commit dc53f450af
1 changed files with 3 additions and 0 deletions

View File

@ -2480,12 +2480,15 @@ endef
# Copies many files. # Copies many files.
# $(1): The files to copy. Each entry is a ':' separated src:dst pair # $(1): The files to copy. Each entry is a ':' separated src:dst pair
# $(2): An optional directory to prepend to the destination
# Evaluates to the list of the dst files (ie suitable for a dependency list) # Evaluates to the list of the dst files (ie suitable for a dependency list)
define copy-many-files define copy-many-files
$(foreach f, $(1), $(strip \ $(foreach f, $(1), $(strip \
$(eval _cmf_tuple := $(subst :, ,$(f))) \ $(eval _cmf_tuple := $(subst :, ,$(f))) \
$(eval _cmf_src := $(word 1,$(_cmf_tuple))) \ $(eval _cmf_src := $(word 1,$(_cmf_tuple))) \
$(eval _cmf_dest := $(word 2,$(_cmf_tuple))) \ $(eval _cmf_dest := $(word 2,$(_cmf_tuple))) \
$(if $(strip $(2)), \
$(eval _cmf_dest := $(patsubst %/,%,$(strip $(2)))/$(patsubst /%,%,$(_cmf_dest)))) \
$(if $(filter-out $(_cmf_src), $(_cmf_dest)), \ $(if $(filter-out $(_cmf_src), $(_cmf_dest)), \
$(eval $(call copy-one-file,$(_cmf_src),$(_cmf_dest)))) \ $(eval $(call copy-one-file,$(_cmf_src),$(_cmf_dest)))) \
$(_cmf_dest))) $(_cmf_dest)))