changeset 55009:9c44ab24b4a4

8219129: Allow overriding of license files in legal dir Reviewed-by: ihse
author erikj
date Tue, 19 Feb 2019 12:40:44 -0800
parents 0da72c89e368
children 56dc0b27536c
files make/copy/CopyCommon.gmk
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/make/copy/CopyCommon.gmk	Tue Feb 19 12:05:43 2019 -0800
+++ b/make/copy/CopyCommon.gmk	Tue Feb 19 12:40:44 2019 -0800
@@ -66,6 +66,8 @@
 # Setup make rules for copying legal files. This is only needed if the files
 # need to be filtered due to optional components being enabled/disabled.
 # Otherwise CreateJmods.gmk will find the legal files in the original src dirs.
+# If multiple license files with the same name are found, only the first one
+# found will get copied.
 #
 # Parameter 1 is the name of the rule.
 #
@@ -75,10 +77,12 @@
 define SetupCopyLegalFilesBody
   $$(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))) \
+    $$(if $$(filter $$($1_$$(notdir $$f)), $$($1)), , \
+      $$(eval $$(call SetupCopyFiles, $1_$$(notdir $$f), \
+          DEST := $$(LEGAL_DST_DIR), \
+          FILES := $$f, \
+      )) \
+      $$(eval $1 += $$($1_$$(notdir $$f))) \
+    ) \
   )
 endef