Introduce EXTRA_SRC and supply headers as dirs. ihse-jdk-library-branch
authorihse
Thu, 03 May 2018 14:30:20 +0200
branchihse-jdk-library-branch
changeset 56511 2b67c11c0db6
parent 56488 a6cb200daa5d
child 56512 c030d6f39dfd
Introduce EXTRA_SRC and supply headers as dirs.
make/common/JdkNativeCompilation.gmk
make/lib/Awt2dLibraries.gmk
make/lib/CoreLibraries.gmk
make/lib/Lib-java.base.gmk
make/lib/Lib-java.desktop.gmk
make/lib/Lib-java.instrument.gmk
make/lib/Lib-java.smartcardio.gmk
make/lib/Lib-jdk.accessibility.gmk
make/lib/Lib-jdk.jdi.gmk
make/lib/Lib-jdk.jdwp.agent.gmk
make/lib/Lib-jdk.pack.gmk
make/lib/Lib-jdk.sctp.gmk
make/lib/LibCommon.gmk
--- a/make/common/JdkNativeCompilation.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/common/JdkNativeCompilation.gmk	Thu May 03 14:30:20 2018 +0200
@@ -59,7 +59,8 @@
 # Remaining parameters are named arguments. These are all passed on to
 # SetupNativeCompilation, except for
 #   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
-#   HEADER_FLAGS - where to look for headers! FIXME:LIBS
+#   EXTRA_HEADER_DIRS -- additional directories to look for headers in
+#   EXTRA_SRC -- additional directories to look for source in
 SetupJdkLibrary = $(NamedParamsMacroTemplate)
 define SetupJdkLibraryBody
   ifeq ($$($1_OUTPUT_DIR), )
@@ -73,6 +74,10 @@
   ifeq ($$($1_SRC), )
     $1_SRC := $$(call FindSrcDirsForLib, $$(MODULE), $$($1_NAME))
   endif
+  $1_PRE_SRC := $$($1_SRC)
+  ifneq ($$($1_EXTRA_SRC), )
+    $1_SRC += $$($1_EXTRA_SRC)
+  endif
 
   ifeq ($$($1_VERSIONINFO_RESOURCE), )
     $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
@@ -90,19 +95,21 @@
   endif
 
   ifneq ($$($1_HEADERS_FROM_SRC), false)
-    $1_SRC_HEADER_FLAGS := \
-        $$(foreach dir, $$($1_SRC), -I$$(dir)) \
-        -I$(call FindHeaderDirForModule, $(MODULE)) \
-        #
+    $1_SRC_HEADER_FLAGS := $$(foreach dir, $$(wildcard $$($1_SRC) $$($1_EXTRA_SRC) \
+        $$(call FindHeaderDirForModule, $$(MODULE))), -I$$(dir))
   endif
+  ifneq ($$($1_EXTRA_HEADER_DIRS), )
+    $1_EXTRA_HEADER_FLAGS := $$(foreach dir, $$($1_EXTRA_HEADER_DIRS), -I$$(dir))
+  endif
+
   ifneq ($$($1_CFLAGS), )
-    $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_HEADER_FLAGS)
+    $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
   endif
   ifneq ($$($1_CXXFLAGS), )
-    $1_CXXFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_HEADER_FLAGS)
+    $1_CXXFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
   endif
   ifeq ($$($1_CFLAGS)$$($1_CXXFLAGS), )
-    $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_HEADER_FLAGS)
+    $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
   endif
   $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
 
--- a/make/lib/Awt2dLibraries.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/Awt2dLibraries.gmk	Thu May 03 14:30:20 2018 +0200
@@ -29,6 +29,8 @@
 
 ################################################################################
 
+# We must not include java.desktop/unix/native/libmlib_image, which is only
+# for usage by solaris-sparc in libmlib_image_v.
 BUILD_LIBMLIB_SRC := $(TOPDIR)/src/java.desktop/share/native/libmlib_image \
     $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib
 
@@ -110,22 +112,17 @@
 
 ################################################################################
 
-LIBAWT_DIRS := $(TOPDIR)/src/java.desktop/share/native/libawt \
-    $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
+LIBAWT_EXTRA_SRC := \
     $(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
     $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
     #
 
 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
-  LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), aix)
-  LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/libawt
+  LIBAWT_EXTRA_SRC += $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  LIBAWT_DIRS += \
+  LIBAWT_EXTRA_SRC += \
       $(TOPDIR)/src/java.desktop/share/native/common/awt/utility \
       $(TOPDIR)/src/java.desktop/share/native/common/font \
       $(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
@@ -197,28 +194,28 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
     NAME := awt, \
-    SRC := $(LIBAWT_DIRS), \
+    EXTRA_SRC := $(LIBAWT_EXTRA_SRC), \
     EXCLUDES := $(LIBAWT_EXCLUDES), \
     EXCLUDE_FILES := $(LIBAWT_EXFILES), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
-    HEADER_FLAGS := \
-        -I$(call FindHeaderDirForModule, java.base) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/d3d)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/loops)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/opengl)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/windows)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/windows)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/awt/medialib)) \
-        $(addprefix -I, $(call FindSrcDirsForLib, java.desktop, mlib_image)) \
-        $(addprefix -I, $(call FindSrcDirsForLib, java.base, java)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.base, include)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, include)) \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/medialib \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe, \
+    EXTRA_HEADER_DIRS := \
+        $(call FindHeaderDirForModule, java.base) \
+        $(call FindSrcDirsForComponent, java.desktop, libawt/java2d) \
+        $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/d3d) \
+        $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/loops) \
+        $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/opengl) \
+        $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/windows) \
+        $(call FindSrcDirsForComponent, java.desktop, libawt/windows) \
+        $(call FindSrcDirsForComponent, java.desktop, common/awt/medialib) \
+        $(call FindSrcDirsForLib, java.desktop, mlib_image) \
+        $(call FindSrcDirsForLib, java.base, java) \
+        $(call FindSrcDirsForComponent, java.base, include) \
+        $(call FindSrcDirsForComponent, java.desktop, include) \
+        $(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
+        $(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
+        $(TOPDIR)/src/java.desktop/share/native/libawt/awt/medialib \
+        $(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe, \
     DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
         format-nonliteral parentheses, \
     DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
@@ -264,23 +261,15 @@
 
 ################################################################################
 
-ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
+ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx), )
   ifeq ($(ENABLE_HEADLESS_ONLY), false)
 
-    LIBAWT_XAWT_DIRS := \
-        $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \
-        $(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-        $(TOPDIR)/src/java.desktop/share/native/common/awt/utility \
+    LIBAWT_XAWT_EXTRA_SRC := \
+        $(call FindSrcDirsForComponent, java.desktop, common/awt) \
+        $(call FindSrcDirsForComponent, java.desktop, common/java2d) \
         $(TOPDIR)/src/java.desktop/share/native/common/font \
-        $(TOPDIR)/src/java.desktop/share/native/common/java2d \
-        $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d \
-        $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
         #
 
-    ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
-      LIBAWT_XAWT_DIRS += $(TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
-    endif
-
     LIBAWT_XAWT_EXCLUDES := medialib
 
     LIBAWT_XAWT_CFLAGS += -DXAWT -DXAWT_HACK \
@@ -318,18 +307,20 @@
 
     $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_XAWT, \
         NAME := awt_xawt, \
-        SRC := $(LIBAWT_XAWT_DIRS), \
-        HEADER_FLAGS := \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt_xawt/awt)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, include)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/java2d/opengl)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/java2d/x11)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/font)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d)) \
-            -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-            -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-            -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-            -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe, \
+        EXTRA_SRC := $(LIBAWT_XAWT_EXTRA_SRC), \
+        EXTRA_HEADER_DIRS := \
+            $(call FindSrcDirsForComponent, java.desktop, libawt_xawt/awt) \
+            $(call FindSrcDirsForComponent, java.desktop, include) \
+            $(call FindSrcDirsForComponent, java.desktop, common/awt/systemscale) \
+            $(call FindSrcDirsForComponent, java.desktop, common/font) \
+            $(call FindSrcDirsForComponent, java.desktop, common/java2d/opengl) \
+            $(call FindSrcDirsForComponent, java.desktop, common/java2d/x11) \
+            $(call FindSrcDirsForComponent, java.desktop, libawt/java2d) \
+            $(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
+            $(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
+            $(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
+            $(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
+            $(TOPDIR)/src/java.desktop/share/native/common/awt/debug, \
         EXCLUDES := $(LIBAWT_XAWT_EXCLUDES), \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
@@ -382,9 +373,9 @@
         $(LCMS_CFLAGS), \
     CFLAGS_solaris := -xc99=no_lib, \
     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
-    HEADER_FLAGS := \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/awt/debug)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d)), \
+    EXTRA_HEADER_DIRS := \
+        $(call FindSrcDirsForComponent, java.desktop, common/awt/debug) \
+        $(call FindSrcDirsForComponent, java.desktop, libawt/java2d), \
     HEADERS_FROM_SRC := $(LIBLCMS_HEADERS_FROM_SRC), \
     DISABLED_WARNINGS_gcc := format-nonliteral type-limits misleading-indentation, \
     DISABLED_WARNINGS_clang := tautological-compare, \
@@ -446,10 +437,9 @@
 # Mac and Windows only use the native AWT lib, do not build libawt_headless
 ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
 
-  LIBAWT_HEADLESS_DIRS := $(TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
+  LIBAWT_HEADLESS_EXTRA_SRC := \
+      $(call FindSrcDirsForComponent, java.desktop, common/java2d) \
       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
-      $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d \
-      $(TOPDIR)/src/java.desktop/share/native/common/java2d \
       $(TOPDIR)/src/java.desktop/share/native/common/font \
       #
 
@@ -459,20 +449,20 @@
 
   $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_HEADLESS, \
       NAME := awt_headless, \
-      SRC := $(LIBAWT_HEADLESS_DIRS), \
+      EXTRA_SRC := $(LIBAWT_HEADLESS_EXTRA_SRC), \
       EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBAWT_HEADLESS_CFLAGS), \
-      HEADER_FLAGS := \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/awt/debug)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/font)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/java2d/opengl)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d)) \
-            -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-            -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-            -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-            -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe, \
+      EXTRA_HEADER_DIRS := \
+            $(call FindSrcDirsForComponent, java.desktop, common/awt/debug) \
+            $(call FindSrcDirsForComponent, java.desktop, common/font) \
+            $(call FindSrcDirsForComponent, java.desktop, common/java2d/opengl) \
+            $(call FindSrcDirsForComponent, java.desktop, libawt/java2d) \
+            $(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
+            $(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
+            $(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
+            $(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe, \
       DISABLED_WARNINGS_xlc := 1506-356, \
       DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -500,7 +490,7 @@
   LIBFREETYPE_CFLAGS := $(FREETYPE_CFLAGS)
   LIBFREETYPE_LIBS := $(FREETYPE_LIBS)
 else
-  BUILD_LIBFREETYPE_HEADERS := -I$(TOPDIR)/src/java.desktop/share/native/libfreetype/include
+  BUILD_LIBFREETYPE_HEADER_DIRS := $(TOPDIR)/src/java.desktop/share/native/libfreetype/include
   BUILD_LIBFREETYPE_CFLAGS := -DFT2_BUILD_LIBRARY $(EXPORT_ALL_SYMBOLS)
 
   # For use by libfontmanager:
@@ -516,7 +506,7 @@
       OPTIMIZATION := HIGHEST, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(BUILD_LIBFREETYPE_CFLAGS), \
-      HEADER_FLAGS := $(BUILD_LIBFREETYPE_HEADERS), \
+      EXTRA_HEADER_DIRS := $(BUILD_LIBFREETYPE_HEADER_DIRS), \
       DISABLED_WARNINGS_solstudio := \
          E_STATEMENT_NOT_REACHED \
          E_END_OF_LOOP_CODE_NOT_REACHED, \
@@ -530,14 +520,6 @@
 
 ###########################################################################
 
-LIBFONTMANAGER_HEADER_SRC := $(TOPDIR)/src/java.desktop/share/native/libfontmanager \
-    $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
-LIBFONTMANAGER_HEADER_FLAGS += \
-    $(addprefix -I, $(shell $(FIND) $(LIBFONTMANAGER_HEADER_SRC) -type d)) \
-    #
-    # FIXME:LIBS: I wish this was not needed
-
-
 #### Begin harfbuzz configuration
 
 HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN
@@ -607,14 +589,14 @@
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
     CFLAGS_windows = -DCC_NOEX, \
-    HEADER_FLAGS := \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/awt)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/font)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d)) \
-        -I$(TOPDIR)/src/java.desktop/share/native/libfontmanager/harfbuzz \
-        -I$(TOPDIR)/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe, \
+    EXTRA_HEADER_DIRS := \
+        $(call FindSrcDirsForComponent, java.desktop, common/awt) \
+        $(call FindSrcDirsForComponent, java.desktop, common/font) \
+        $(call FindSrcDirsForComponent, java.desktop, libawt/java2d) \
+        $(TOPDIR)/src/java.desktop/share/native/libfontmanager/harfbuzz \
+        $(TOPDIR)/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn \
+        $(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
+        $(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe, \
     WARNINGS_AS_ERRORS_xlc := false, \
     DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
         type-limits missing-field-initializers implicit-fallthrough, \
@@ -676,15 +658,15 @@
           $(LIBJAWT_CFLAGS), \
       CXXFLAGS := $(CXXFLAGS_JDKLIB) \
           $(LIBJAWT_CFLAGS), \
-      HEADER_FLAGS := \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.base, include)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, include)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/awt/debug)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/awt/image/cvutils)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/windows)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/windows)) \
-          $(addprefix -I, $(call FindSrcDirsForLib, java.base, java)),\
+      EXTRA_HEADER_DIRS := \
+          $(call FindSrcDirsForComponent, java.base, include) \
+          $(call FindSrcDirsForComponent, java.desktop, include) \
+          $(call FindSrcDirsForComponent, java.desktop, common/awt/debug) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt/awt/image/cvutils) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt/java2d) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/windows) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt/windows) \
+          $(call FindSrcDirsForLib, java.base, java),\
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
       LIBS := $(JDKLIB_LIBS) $(KERNEL32_LIB) advapi32.lib $(WIN_AWT_LIB), \
   ))
@@ -702,7 +684,6 @@
 
 else # OPENJDK_TARGET_OS not windows
 
-  ## FIXME:LIBS -- solve this situation better?
   ifeq ($(OPENJDK_TARGET_OS), macosx)
     LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libjawt
   else
@@ -733,9 +714,9 @@
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(JAWT_CFLAGS), \
-      HEADER_FLAGS := \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, include)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/awt)), \
+      EXTRA_HEADER_DIRS := \
+          $(call FindSrcDirsForComponent, java.desktop, include) \
+          $(call FindSrcDirsForComponent, java.desktop, common/awt), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
@@ -772,14 +753,14 @@
     GIFLIB_LIBS := -lgif
     LIBSPLASHSCREEN_EXCLUDES := giflib
   else
-    LIBSPLASHSCREEN_HEADER_FLAGS += -I$(TOPDIR)/src/java.desktop/share/native/libsplashscreen/giflib
+    LIBSPLASHSCREEN_HEADER_DIRS += $(TOPDIR)/src/java.desktop/share/native/libsplashscreen/giflib
   endif
 
   ifeq ($(USE_EXTERNAL_LIBJPEG), true)
     LIBJPEG_LIBS := -ljpeg
   else
     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/share/native/libjavajpeg
-    LIBSPLASHSCREEN_HEADER_FLAGS += -I$(TOPDIR)/src/java.desktop/share/native/libjavajpeg
+    LIBSPLASHSCREEN_HEADER_DIRS += $(TOPDIR)/src/java.desktop/share/native/libjavajpeg
   endif
 
   ifeq ($(USE_EXTERNAL_LIBPNG), false)
@@ -859,11 +840,11 @@
           $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS) $(LIBZ_CFLAGS), \
       CXXFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
           $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS) $(LIBZ_CFLAGS), \
-      HEADER_FLAGS := \
-          $(addprefix -I, $(call FindSrcDirsForLib, java.base, java)) \
-          $(addprefix -I, $(call FindSrcDirsForLib, java.desktop, osxapp)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.base, include)) \
-          $(LIBSPLASHSCREEN_HEADER_FLAGS), \
+      EXTRA_HEADER_DIRS := \
+          $(call FindSrcDirsForLib, java.base, java) \
+          $(call FindSrcDirsForLib, java.desktop, osxapp) \
+          $(call FindSrcDirsForComponent, java.base, include) \
+          $(LIBSPLASHSCREEN_HEADER_DIRS), \
       DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result \
           maybe-uninitialized shift-negative-value implicit-fallthrough, \
       DISABLED_WARNINGS_clang := incompatible-pointer-types, \
@@ -891,8 +872,7 @@
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 
-  LIBAWT_LWAWT_DIRS := \
-      $(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt \
+  LIBAWT_LWAWT_EXTRA_SRC := \
       $(TOPDIR)/src/java.desktop/unix/native/common/awt \
       $(TOPDIR)/src/java.desktop/share/native/common/font \
       $(TOPDIR)/src/java.desktop/share/native/common/java2d \
@@ -905,26 +885,26 @@
 
   $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_LWAWT, \
       NAME := awt_lwawt, \
-      SRC := $(LIBAWT_LWAWT_DIRS), \
+      EXTRA_SRC := $(LIBAWT_LWAWT_EXTRA_SRC), \
       INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
       EXCLUDE_FILES := $(LIBAWT_LWAWT_EXFILES), \
       EXCLUDES := $(LIBAWT_LWAWT_EXCLUDES), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBAWT_LWAWT_CFLAGS), \
-      HEADER_FLAGS := \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt_lwawt/java2d/opengl)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt_lwawt/awt)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt_lwawt/font)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, include)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/awt/debug)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/java2d/opengl)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/awt/image)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/awt/image/cvutils)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/loops)) \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/pipe)) \
-          $(addprefix -I, $(call FindSrcDirsForLib, java.desktop, osxapp)), \
+      EXTRA_HEADER_DIRS := \
+          $(call FindSrcDirsForComponent, java.desktop, libawt_lwawt/java2d/opengl) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt_lwawt/awt) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt_lwawt/font) \
+          $(call FindSrcDirsForComponent, java.desktop, include) \
+          $(call FindSrcDirsForComponent, java.desktop, common/awt/debug) \
+          $(call FindSrcDirsForComponent, java.desktop, common/java2d/opengl) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt/awt/image) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt/awt/image/cvutils) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt/java2d) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/loops) \
+          $(call FindSrcDirsForComponent, java.desktop, libawt/java2d/pipe) \
+          $(call FindSrcDirsForLib, java.desktop, osxapp), \
       DISABLED_WARNINGS_clang := incomplete-implementation enum-conversion \
           deprecated-declarations objc-method-access bitwise-op-parentheses \
           incompatible-pointer-types parentheses-equality extra-tokens, \
@@ -965,9 +945,9 @@
       NAME := osxui, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB), \
-      HEADER_FLAGS := \
-          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt_lwawt/awt)) \
-          $(addprefix -I, $(call FindSrcDirsForLib, java.desktop, osxapp)), \
+      EXTRA_HEADER_DIRS := \
+          $(call FindSrcDirsForComponent, java.desktop, libawt_lwawt/awt) \
+          $(call FindSrcDirsForLib, java.desktop, osxapp), \
       DISABLED_WARNINGS_clang := deprecated-declarations, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN) \
--- a/make/lib/CoreLibraries.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/CoreLibraries.gmk	Thu May 03 14:30:20 2018 +0200
@@ -132,8 +132,7 @@
         $(LIBJAVA_CFLAGS), \
     System.c_CFLAGS := $(VERSION_CFLAGS), \
     jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
-    HEADER_FLAGS := \
-        $(addprefix -I, $(call FindSrcDirsForLib, java.base, fdlibm)), \
+    EXTRA_HEADER_DIRS := $(call FindSrcDirsForLib, java.base, fdlibm), \
     WARNINGS_AS_ERRORS_xlc := false, \
     DISABLED_WARNINGS_gcc := unused-result, \
     DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
--- a/make/lib/Lib-java.base.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/Lib-java.base.gmk	Thu May 03 14:30:20 2018 +0200
@@ -73,10 +73,10 @@
     OPTIMIZATION := HIGH, \
     WARNINGS_AS_ERRORS_xlc := false, \
     CFLAGS := $(CFLAGS_JDKLIB), \
-    HEADER_FLAGS := \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.base, libnio/ch)) \
-        $(addprefix -I, $(call FindSrcDirsForComponent, java.base, libnio/fs)) \
-        $(addprefix -I, $(call FindSrcDirsForLib, java.base, net)), \
+    EXTRA_HEADER_DIRS := \
+        $(call FindSrcDirsForComponent, java.base, libnio/ch) \
+        $(call FindSrcDirsForComponent, java.base, libnio/fs) \
+        $(call FindSrcDirsForLib, java.base, net), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := -ljava -lnet, \
--- a/make/lib/Lib-java.desktop.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/Lib-java.desktop.gmk	Thu May 03 14:30:20 2018 +0200
@@ -118,8 +118,7 @@
       NAME := osx, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB), \
-      HEADER_FLAGS := \
-          $(addprefix -I, $(call FindSrcDirsForLib, java.desktop, osxapp)), \
+      EXTRA_HEADER_DIRS := $(call FindSrcDirsForLib, java.desktop, osxapp), \
       DISABLED_WARNINGS_clang := deprecated-declarations, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
--- a/make/lib/Lib-java.instrument.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/Lib-java.instrument.gmk	Thu May 03 14:30:20 2018 +0200
@@ -47,8 +47,7 @@
     CFLAGS := $(LIBINSTRUMENT_CFLAGS_JDKLIB) $(LIBINSTRUMENT_CFLAGS), \
     CFLAGS_debug := -DJPLIS_LOGGING, \
     CFLAGS_release := -DNO_JPLIS_LOGGING, \
-    HEADER_FLAGS := \
-        $(addprefix -I, $(call FindSrcDirsForLib, java.base, jli)), \
+    EXTRA_HEADER_DIRS := $(call FindSrcDirsForLib, java.base, jli), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN) \
         $(LIBINSTRUMENT_LDFLAGS), \
--- a/make/lib/Lib-java.smartcardio.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/Lib-java.smartcardio.gmk	Thu May 03 14:30:20 2018 +0200
@@ -31,8 +31,7 @@
     NAME := j2pcsc, \
     CFLAGS := $(CFLAGS_JDKLIB), \
     CFLAGS_unix := -D__sun_jdk, \
-    HEADER_FLAGS := \
-        $(addprefix -I, $(call FindSrcDirsForComponent, $(MODULE), libj2pcsc/MUSCLE)), \
+    EXTRA_HEADER_DIRS := $(call FindSrcDirsForComponent, $(MODULE), libj2pcsc/MUSCLE), \
     OPTIMIZATION := LOW, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/Lib-jdk.accessibility.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/Lib-jdk.accessibility.gmk	Thu May 03 14:30:20 2018 +0200
@@ -45,10 +45,10 @@
         DISABLED_WARNINGS_microsoft := 4311 4302 4312, \
         CFLAGS := $(CFLAGS_JDKLIB) \
             -DACCESSBRIDGE_ARCH_$2, \
-        HEADER_FLAGS := \
-            $(addprefix -I, $(call FindSrcDirsForComponent, jdk.accessibility, include/bridge)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.base, include)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, include)), \
+        EXTRA_HEADER_DIRS := \
+            $(call FindSrcDirsForComponent, jdk.accessibility, include/bridge) \
+            $(call FindSrcDirsForComponent, java.base, include) \
+            $(call FindSrcDirsForComponent, java.desktop, include), \
         LDFLAGS := $(LDFLAGS_JDKLIB), \
         LIBS := kernel32.lib user32.lib gdi32.lib \
             winspool.lib comdlg32.lib advapi32.lib shell32.lib \
@@ -72,9 +72,9 @@
         DISABLED_WARNINGS_microsoft := 4311 4302 4312, \
         CFLAGS := $(filter-out -MD, $(CFLAGS_JDKLIB)) -MT \
             -DACCESSBRIDGE_ARCH_$2, \
-        HEADER_FLAGS := \
-            $(addprefix -I, $(call FindSrcDirsForComponent, jdk.accessibility, include/bridge)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.base, include)), \
+        EXTRA_HEADER_DIRS := \
+            $(call FindSrcDirsForComponent, jdk.accessibility, include/bridge) \
+            $(call FindSrcDirsForComponent, java.base, include), \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             -def:$(ROOT_SRCDIR)/libwindowsaccessbridge/WinAccessBridge.DEF, \
         LIBS := kernel32.lib user32.lib gdi32.lib \
--- a/make/lib/Lib-jdk.jdi.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/Lib-jdk.jdi.gmk	Thu May 03 14:30:20 2018 +0200
@@ -33,9 +33,9 @@
       NAME := dt_shmem, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP, \
-      HEADER_FLAGS := \
-          -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
-          -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export, \
+      EXTRA_HEADER_DIRS := \
+          $(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
+          $(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export, \
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LIBS := $(JDKLIB_LIBS), \
   ))
--- a/make/lib/Lib-jdk.jdwp.agent.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/Lib-jdk.jdwp.agent.gmk	Thu May 03 14:30:20 2018 +0200
@@ -32,9 +32,9 @@
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
         $(LIBDT_SOCKET_CPPFLAGS), \
-    HEADER_FLAGS := \
-        -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
-        -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export, \
+    EXTRA_HEADER_DIRS := \
+        $(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
+        $(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_linux := -lpthread, \
@@ -54,9 +54,9 @@
     NAME := jdwp, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING, \
-    HEADER_FLAGS := \
-      -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
-      -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export, \
+    EXTRA_HEADER_DIRS := \
+      $(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
+      $(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
--- a/make/lib/Lib-jdk.pack.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/Lib-jdk.pack.gmk	Thu May 03 14:30:20 2018 +0200
@@ -27,19 +27,15 @@
 
 ################################################################################
 
-LIBUNPACK_SRC := \
-    $(call FindSrcDirsForLib, jdk.pack, unpack) \
-    $(call FindSrcDirsForComponent, jdk.pack, common-unpack) \
-    #
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBUNPACK, \
     NAME := unpack, \
-    SRC := $(LIBUNPACK_SRC), \
+    EXTRA_SRC := $(call FindSrcDirsForComponent, jdk.pack, common-unpack), \
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
     OPTIMIZATION := LOW, \
     CXXFLAGS := $(CXXFLAGS_JDKLIB) \
         -DNO_ZLIB -DUNPACK_JNI -DFULL, \
     CFLAGS_release := -DPRODUCT, \
+    EXTRA_HEADER_DIRS := $(call FindHeaderDirForModule, java.base), \
     DISABLED_WARNINGS_gcc := implicit-fallthrough, \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/Lib-jdk.sctp.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/Lib-jdk.sctp.gmk	Thu May 03 14:30:20 2018 +0200
@@ -34,10 +34,10 @@
         NAME := sctp, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB), \
-        HEADER_FLAGS := \
-            -I$(call FindHeaderDirForModule, java.base) \
-            $(addprefix -I, $(call FindSrcDirsForLib, java.base, net)) \
-            $(addprefix -I, $(call FindSrcDirsForComponent, java.base, libnio/ch)), \
+        EXTRA_HEADER_DIRS := \
+            $(call FindHeaderDirForModule, java.base) \
+            $(call FindSrcDirsForLib, java.base, net) \
+            $(call FindSrcDirsForComponent, java.base, libnio/ch), \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
         LIBS_unix := -lnio -lnet -ljava -ljvm, \
--- a/make/lib/LibCommon.gmk	Thu Apr 26 15:52:17 2018 +0200
+++ b/make/lib/LibCommon.gmk	Thu May 03 14:30:20 2018 +0200
@@ -67,11 +67,11 @@
 # Find the default set of src dirs for a native library.
 # Param 1 - module name
 # Param 2 - library name
-FindSrcDirsForLib += \
-  $(call uniq, $(wildcard \
-      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
-      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
-      $(TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
+#FindSrcDirsForLib += \
+#  $(call uniq, $(wildcard \
+#      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
+#      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
+#      $(TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
 
 ################################################################################
 # Find a library