make/copy/CopyCommon.gmk
changeset 48305 522601e6dd0d
parent 48300 8a5edac3d5a2
child 48355 4944950606ef
--- a/make/copy/CopyCommon.gmk	Thu Nov 30 15:54:45 2017 +0100
+++ b/make/copy/CopyCommon.gmk	Tue Dec 05 11:23:27 2017 +0100
@@ -33,16 +33,17 @@
 #
 
 INCLUDE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)
+INCLUDE_SOURCE_DIR := $(TOPDIR)/src/$(MODULE)/share/native/include
 
-$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE, \
-    SRC := $(TOPDIR)/src/$(MODULE)/share/native/include, \
-    DEST := $(INCLUDE_TARGET_DIR), \
-    FILES := $(wildcard \
-        $(TOPDIR)/src/$(MODULE)/share/native/include/* \
-        $(TOPDIR)/src/$(MODULE)/share/native/include/*/*), \
-))
+ifneq ($(wildcard $(INCLUDE_SOURCE_DIR)/*), )
+  $(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE, \
+      SRC := $(INCLUDE_SOURCE_DIR), \
+      DEST := $(INCLUDE_TARGET_DIR), \
+      FILES := $(shell $(FIND) $(INCLUDE_SOURCE_DIR) -type f), \
+  ))
 
-TARGETS += $(COPY_EXPORTED_INCLUDE)
+  TARGETS += $(COPY_EXPORTED_INCLUDE)
+endif
 
 # For historical reasons, the OS include directories have odd names.
 INCLUDE_TARGET_OS_SUBDIR := $(OPENJDK_TARGET_OS)
@@ -53,19 +54,17 @@
 endif
 
 # Use the most specific of OS and OS_TYPE.
-ifneq ($(wildcard $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS)/native/include/*), )
-  INCLUDE_SOURCE_OS_SUBDIR := $(OPENJDK_TARGET_OS)
-else
-  INCLUDE_SOURCE_OS_SUBDIR := $(OPENJDK_TARGET_OS_TYPE)
+INCLUDE_SOURCE_OS_DIR := $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS)/native/include
+ifeq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
+  INCLUDE_SOURCE_OS_DIR := $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/include
 endif
 
-$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE_OS, \
-    SRC := $(TOPDIR)/src/$(MODULE)/$(INCLUDE_SOURCE_OS_SUBDIR)/native/include, \
-    DEST := $(INCLUDE_TARGET_DIR)/$(INCLUDE_TARGET_OS_SUBDIR), \
-    FILES := $(wildcard \
-        $(TOPDIR)/src/$(MODULE)/$(INCLUDE_SOURCE_OS_SUBDIR)/native/include/* \
-        $(TOPDIR)/src/$(MODULE)/$(INCLUDE_SOURCE_OS_SUBDIR)/native/include/*/*), \
-))
+ifneq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
+  $(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE_OS, \
+      SRC := $(INCLUDE_SOURCE_OS_DIR), \
+      DEST := $(INCLUDE_TARGET_DIR)/$(INCLUDE_TARGET_OS_SUBDIR), \
+      FILES := $(shell $(FIND) $(INCLUDE_SOURCE_OS_DIR) -type f), \
+  ))
 
-TARGETS += $(COPY_EXPORTED_INCLUDE_OS)
-
+  TARGETS += $(COPY_EXPORTED_INCLUDE_OS)
+endif