summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2010-11-02 21:31:47 -0700
committerYing Wang <wangying@google.com>2011-03-04 15:10:15 -0800
commit9238d44c92b355bac6b7a13b23f298336338bf3d (patch)
tree2c85c1a5b84bca741683b4ff80e592f1864ca616
parenta73b6561cee39ad416f4af327dbe72ec565d2423 (diff)
downloadbuild-9238d44c92b355bac6b7a13b23f298336338bf3d.zip
build-9238d44c92b355bac6b7a13b23f298336338bf3d.tar.gz
build-9238d44c92b355bac6b7a13b23f298336338bf3d.tar.bz2
Only copy once even if the first matched src:dest pair appears more than once.
Change-Id: I476923007dac1174371d6e6526d72182eb6c7243
-rw-r--r--core/Makefile19
1 files changed, 11 insertions, 8 deletions
diff --git a/core/Makefile b/core/Makefile
index 1a5d294..a0961a8 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -15,15 +15,18 @@ endif
# <dest file> is relative to $(PRODUCT_OUT), so it should look like,
# e.g., "system/etc/file.xml".
# The filter part means "only eval the copy-one-file rule if this
-# src:dest pair is the first one to match %:dest"
+# src:dest pair is the first one to match the same dest"
+unique_product_copy_files_destinations := $(sort \
+ $(foreach cf,$(PRODUCT_COPY_FILES), $(call word-colon,2,$(cf))))
$(foreach cf,$(PRODUCT_COPY_FILES), \
- $(eval _src := $(call word-colon,1,$(cf))) \
- $(eval _dest := $(call word-colon,2,$(cf))) \
- $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
- $(if $(filter $(_src):$(_dest),$(firstword $(filter %:$(_dest),$(PRODUCT_COPY_FILES)))), \
- $(eval $(call copy-one-file,$(_src),$(_fulldest))),) \
- $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
- )
+ $(eval _src := $(call word-colon,1,$(cf))) \
+ $(eval _dest := $(call word-colon,2,$(cf))) \
+ $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
+ $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
+ $(eval $(call copy-one-file,$(_src),$(_fulldest))) \
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
+ $(eval unique_product_copy_files_destinations := $(filter-out $(_dest), \
+ $(unique_product_copy_files_destinations)))))
# -----------------------------------------------------------------
# docs/index.html