make/copy/CopyCommon.gmk
changeset 49537 149dc554808c
parent 48355 4944950606ef
child 49540 9704789737c1
--- a/make/copy/CopyCommon.gmk	Thu Apr 05 20:31:57 2018 +0000
+++ b/make/copy/CopyCommon.gmk	Thu Apr 05 23:46:05 2018 +0200
@@ -26,6 +26,7 @@
 LIB_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
 CONF_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)
 LEGAL_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)
+COMMON_LEGAL_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_legal/common
 
 ################################################################################
 #
@@ -60,3 +61,23 @@
 
   TARGETS += $(COPY_EXPORTED_INCLUDE_OS)
 endif
+
+################################################################################
+# 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.
+#
+# Parameter 1 is the name of the rule.
+#
+# Remaining parameters are named arguments. These include:
+#   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, \
+  ))
+endef