make/copy/CopyCommon.gmk
changeset 49540 9704789737c1
parent 49537 149dc554808c
child 52804 28094715ae71
--- a/make/copy/CopyCommon.gmk	Thu Apr 05 17:11:25 2018 -0700
+++ b/make/copy/CopyCommon.gmk	Fri Apr 06 02:52:24 2018 +0200
@@ -73,11 +73,12 @@
 #   EXCLUDES : List of filenames to exclude from copy
 SetupCopyLegalFiles = $(NamedParamsMacroTemplate)
 define SetupCopyLegalFilesBody
-  $$(eval $$(call SetupCopyFiles, $1, \
-      SRC := $$(CUSTOM_ROOT), \
-      DEST := $$(LEGAL_DST_DIR), \
-      FILES := $$(filter-out $$(addprefix %/, $$($1_EXCLUDES)), \
-          $$(wildcard $$(addsuffix /*, $$(call FindModuleLegalSrcDirs, $$(MODULE))))), \
-      FLATTEN := true, \
-  ))
+  $$(foreach f, $$(filter-out $$(addprefix %/, $$($1_EXCLUDES)), \
+      $$(wildcard $$(addsuffix /*, $$(call FindModuleLegalSrcDirs, $$(MODULE))))), \
+    $$(eval $$(call SetupCopyFiles, $1_$$(notdir $$f), \
+        DEST := $$(LEGAL_DST_DIR), \
+        FILES := $$f, \
+    )) \
+    $$(eval $1 += $$($1_$$(notdir $$f))) \
+  )
 endef