8219129: Allow overriding of license files in legal dir
authorerikj
Tue, 19 Feb 2019 12:40:44 -0800
changeset 53828 9c44ab24b4a4
parent 53827 0da72c89e368
child 53829 56dc0b27536c
8219129: Allow overriding of license files in legal dir Reviewed-by: ihse
make/copy/CopyCommon.gmk
--- 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