Cleaning up HEADER_FLAGS. ihse-jdk-library-branch
authorihse
Wed, 18 Apr 2018 14:22:53 +0200
branchihse-jdk-library-branch
changeset 56454 82c3ae69914f
parent 56435 e177cddcbf77
child 56455 3b8a1a702cdc
Cleaning up HEADER_FLAGS.
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.management.gmk
make/lib/Lib-java.prefs.gmk
make/lib/Lib-java.rmi.gmk
make/lib/Lib-java.security.jgss.gmk
make/lib/Lib-java.smartcardio.gmk
make/lib/Lib-jdk.attach.gmk
make/lib/Lib-jdk.crypto.cryptoki.gmk
make/lib/Lib-jdk.crypto.ec.gmk
make/lib/Lib-jdk.crypto.mscapi.gmk
make/lib/Lib-jdk.crypto.ucrypto.gmk
make/lib/Lib-jdk.hotspot.agent.gmk
make/lib/Lib-jdk.internal.le.gmk
make/lib/Lib-jdk.jdi.gmk
make/lib/Lib-jdk.jdwp.agent.gmk
make/lib/Lib-jdk.management.agent.gmk
make/lib/Lib-jdk.management.gmk
make/lib/Lib-jdk.net.gmk
make/lib/Lib-jdk.pack.gmk
make/lib/Lib-jdk.sctp.gmk
make/lib/Lib-jdk.security.auth.gmk
make/lib/LibCommon.gmk
src/java.desktop/share/native/libsplashscreen/java_awt_SplashScreen.c
src/java.prefs/macosx/native/libprefs/MacOSXPreferencesFile.m
src/java.prefs/unix/native/libprefs/FileSystemPreferences.c
src/java.prefs/windows/native/libprefs/WindowsPreferences.c
src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp
src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c
--- a/make/common/JdkNativeCompilation.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/common/JdkNativeCompilation.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -48,6 +48,9 @@
       $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/$(strip $2) \
       $(TOPDIR)/src/$(strip $1)/share/native/$(strip $2)))
 
+FindHeaderDirForModule = \
+  $(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1))
+
 # Setup make rules for creating a native shared library with suitable defaults
 # for the OpenJDK project.
 #
--- a/make/lib/Awt2dLibraries.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Awt2dLibraries.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -34,8 +34,6 @@
 
 BUILD_LIBMLIB_CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES -DMLIB_NO_LIBSUNMATH
 
-BUILD_LIBMLIB_HEADER_FLAGS := -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libmlib_image
-
 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
   BUILD_LIBMLIB_CFLAGS += -DMLIB_OS64BIT
 endif
@@ -47,7 +45,6 @@
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBMLIB_CFLAGS), \
-    HEADER_FLAGS := $(BUILD_LIBMLIB_HEADER_FLAGS), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
@@ -136,14 +133,6 @@
   LIBAWT_EXFILES += initIDs.c awt/image/cvutils/img_colors.c
 endif
 
-LIBAWT_HEADER_FLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-    $(LIBJAVA_HEADER_FLAGS) \
-    $(addprefix -I, $(BUILD_LIBMLIB_IMAGE_SRC)) \
-    $(addprefix -I, $(shell find $(LIBAWT_DIRS) -type d)) \
-    #
-    # FIXME:LIBS: I wish this FIND was not needed.
-
-
 LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES $(X_CFLAGS)
 
 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-sparcv9)
@@ -212,7 +201,15 @@
     EXCLUDE_FILES := $(LIBAWT_EXFILES), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
-    HEADER_FLAGS := $(LIBAWT_HEADER_FLAGS), \
+    HEADER_FLAGS := \
+        -I$(call FindHeaderDirForModule, $(MODULE)) \
+        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, libawt/java2d)) \
+        $(addprefix -I, $(call FindSrcDirsForLib, java.desktop, mlib_image)) \
+        -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 \
+        -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops, \
     DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
         format-nonliteral parentheses, \
     DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
@@ -277,23 +274,6 @@
 
     LIBAWT_XAWT_EXCLUDES := medialib
 
-    LIBAWT_XAWT_HEADER_FLAGS := \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-        -I$(TOPDIR)/src/java.desktop/share/native/include \
-        -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
-        -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-        -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-        -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
-        $(LIBJAVA_HEADER_FLAGS) \
-        $(addprefix -I, $(shell $(FIND) $(LIBAWT_XAWT_DIRS) -type d)) \
-        #
-        # FIXME:LIBS: I wish this FIND was not needed!!!
-
     LIBAWT_XAWT_CFLAGS += -DXAWT -DXAWT_HACK \
         -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
         $(FONTCONFIG_CFLAGS) \
@@ -324,16 +304,28 @@
       BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
       # initializing a declared 'extern'
       BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
-   endif
+    endif
+
 
     $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_XAWT, \
         NAME := awt_xawt, \
         SRC := $(LIBAWT_XAWT_DIRS), \
+        HEADER_FLAGS := \
+            -I$(call FindHeaderDirForModule, $(MODULE)) \
+            $(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, \
         EXCLUDES := $(LIBAWT_XAWT_EXCLUDES), \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
             $(X_CFLAGS), \
-        HEADER_FLAGS := $(LIBAWT_XAWT_HEADER_FLAGS), \
         WARNINGS_AS_ERRORS_xlc := false, \
         DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
             unused-result maybe-uninitialized format \
@@ -358,11 +350,6 @@
 
 ################################################################################
 
-LIBLCMS_HEADER_FLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-    -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-    -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-    $(LIBJAVA_HEADER_FLAGS) \
-    #
 # The fast floor code loses precision.
 LCMS_CFLAGS=-DCMS_DONT_USE_FAST_FLOOR
 
@@ -387,7 +374,10 @@
         $(LCMS_CFLAGS), \
     CFLAGS_solaris := -xc99=no_lib, \
     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
-    HEADER_FLAGS := $(LIBLCMS_HEADER_FLAGS), \
+    HEADER_FLAGS := \
+        -I$(call FindHeaderDirForModule, $(MODULE)) \
+        $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/awt/debug)) \
+        $(addprefix -I, $(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, \
@@ -427,17 +417,13 @@
   BUILD_LIBJAVAJPEG_INCLUDE_FILES :=
 endif
 
-LIBJPEG_HEADER_FLAGS := \
-    $(LIBJAVA_HEADER_FLAGS) \
-    -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-    #
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBJAVAJPEG, \
     NAME := javajpeg, \
     INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB), \
-    HEADER_FLAGS := $(LIBJPEG_HEADER_FLAGS), \
+    HEADER_FLAGS := \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     HEADERS_FROM_SRC := $(LIBJPEG_HEADERS_FROM_SRC), \
     DISABLED_WARNINGS_gcc := clobbered implicit-fallthrough shift-negative-value, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -463,21 +449,6 @@
       #
 
   LIBAWT_HEADLESS_EXCLUDES := medialib
-  LIBAWT_HEADLESS_HEADER_FLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-      -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 \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/font \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
-      $(LIBJAVA_HEADER_FLAGS) \
-      #
-
   LIBAWT_HEADLESS_CFLAGS := $(CUPS_CFLAGS) $(FONTCONFIG_CFLAGS) $(X_CFLAGS) \
       -DHEADLESS=true -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
 
@@ -488,7 +459,16 @@
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBAWT_HEADLESS_CFLAGS), \
-      HEADER_FLAGS := $(LIBAWT_HEADLESS_HEADER_FLAGS), \
+      HEADER_FLAGS := \
+          -I$(call FindHeaderDirForModule, $(MODULE)) \
+            $(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, \
       DISABLED_WARNINGS_xlc := 1506-356, \
       DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -546,16 +526,6 @@
 
 ###########################################################################
 
-LIBFONTMANAGER_HEADER_FLAGS := \
-    $(addprefix -I, $(shell $(FIND) \
-      $(TOPDIR)/src/java.desktop/share/native/libawt \
-      $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
-      $(TOPDIR)/src/java.desktop/share/native/common \
-      $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common -type d)) \
-    -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-    $(LIBJAVA_HEADER_FLAGS) \
-    #
-
 LIBFONTMANAGER_HEADER_SRC := $(TOPDIR)/src/java.desktop/share/native/libfontmanager \
     $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
 LIBFONTMANAGER_HEADER_FLAGS += \
@@ -600,7 +570,6 @@
   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
       X11TextRenderer.c
   LIBFONTMANAGER_OPTIMIZATION := HIGHEST
-  LIBFONTMANAGER_HEADER_FLAGS += -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows
 else ifeq ($(OPENJDK_TARGET_OS), macosx)
   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
       X11TextRenderer.c \
@@ -632,9 +601,17 @@
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
-    HEADER_FLAGS := $(LIBFONTMANAGER_HEADER_FLAGS), \
     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
     CFLAGS_windows = -DCC_NOEX, \
+    HEADER_FLAGS := \
+        -I$(call FindHeaderDirForModule, $(MODULE)) \
+        $(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, \
     WARNINGS_AS_ERRORS_xlc := false, \
     DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
         type-limits missing-field-initializers implicit-fallthrough, \
@@ -683,17 +660,6 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
 
-  LIBJAWT_HEADER_FLAGS := -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d/windows \
-      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-      -I$(TOPDIR)/src/java.desktop/windows/native/include \
-      -I$(TOPDIR)/src/java.desktop/share/native/include \
-      $(LIBJAVA_HEADER_FLAGS) \
-      #
-
   LIBJAWT_CFLAGS := -EHsc -DUNICODE -D_UNICODE
 
   ifeq ($(OPENJDK_TARGET_CPU), x86)
@@ -730,14 +696,6 @@
     LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
   endif
 
-  LIBJAWT_HEADER_FLAGS := \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
-      -I$(TOPDIR)/src/java.desktop/share/native/include \
-      $(LIBJAVA_HEADER_FLAGS) \
-      #
-
   ifeq ($(OPENJDK_TARGET_OS), macosx)
     JAWT_LIBS := -lawt_lwawt
   else
@@ -762,7 +720,9 @@
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(JAWT_CFLAGS), \
-      HEADER_FLAGS := $(LIBJAWT_HEADER_FLAGS), \
+      HEADER_FLAGS := \
+          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, include)) \
+          $(addprefix -I, $(call FindSrcDirsForComponent, java.desktop, common/awt)), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
@@ -830,11 +790,9 @@
   endif
   LIBSPLASHSCREEN_CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE -DPNG_ARM_NEON_OPT=0
 
-  LIBSPLASHSCREEN_HEADER_FLAGS += $(LIBJAVA_HEADER_FLAGS)
-
   ifeq ($(OPENJDK_TARGET_OS), macosx)
     LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
-    LIBSPLASHSCREEN_HEADER_FLAGS += -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp
+#    LIBSPLASHSCREEN_HEADER_FLAGS += -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp
 
     BUILD_LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS := -x objective-c -O0
     BUILD_LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS := -x objective-c -O0
@@ -887,7 +845,9 @@
       OPTIMIZATION := LOW, \
       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
           $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS) $(LIBZ_CFLAGS), \
-      HEADER_FLAGS := $(LIBSPLASHSCREEN_HEADER_FLAGS), \
+      HEADER_FLAGS := \
+          -I$(call FindHeaderDirForModule, $(MODULE)) \
+          $(LIBSPLASHSCREEN_HEADER_FLAGS), \
       DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result \
           maybe-uninitialized shift-negative-value implicit-fallthrough, \
       DISABLED_WARNINGS_clang := incompatible-pointer-types, \
@@ -922,27 +882,6 @@
       $(TOPDIR)/src/java.desktop/share/native/common/java2d \
       #
 
-  LIBAWT_LWAWT_HEADER_FLAGS := \
-      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
-      -I$(TOPDIR)/src/java.desktop/unix/native/libawt_xawt/awt \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/font \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/include \
-      -I$(TOPDIR)/src/java.desktop/share/native/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/java2d \
-      -I$(TOPDIR)/src/java.desktop/unix/native/libawt/java2d \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
-      -I$(TOPDIR)/src/java.desktop/share/native/libmlib_image/ \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp \
-      $(LIBJAVA_HEADER_FLAGS) \
-      #
-
   LIBAWT_LWAWT_CFLAGS := $(X_CFLAGS) $(X_LIBS)
 
   LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c
--- a/make/lib/CoreLibraries.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/CoreLibraries.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -133,8 +133,8 @@
     System.c_CFLAGS := $(VERSION_CFLAGS), \
     jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
     HEADER_FLAGS := \
-        -I$(TOPDIR)/src/java.base/share/native/libfdlibm \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
+        -I$(call FindHeaderDirForModule, $(MODULE)) \
+        $(addprefix -I, $(call FindSrcDirsForLib, java.base, fdlibm)), \
     WARNINGS_AS_ERRORS_xlc := false, \
     DISABLED_WARNINGS_gcc := unused-result, \
     DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
@@ -180,9 +180,7 @@
         $(LIBZ_CFLAGS), \
     CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
     HEADER_FLAGS := \
-        -I$(TOPDIR)/src/java.base/share/native/libjava \
-        -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     DISABLED_WARNINGS_gcc := implicit-fallthrough, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -201,11 +199,9 @@
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB), \
+    CXXFLAGS := $(CXXFLAGS_JDKLIB), \
     HEADER_FLAGS := \
-        -I$(TOPDIR)/src/java.base/share/native/libjava \
-        -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
-    CXXFLAGS := $(CXXFLAGS_JDKLIB), \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     DISABLED_WARNINGS_gcc := implicit-fallthrough, \
     CFLAGS_unix := -UDEBUG, \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
--- a/make/lib/Lib-java.base.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-java.base.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -29,9 +29,7 @@
 $(eval $(call IncludeCustomExtension, lib/Lib-java.base.gmk))
 
 # Prepare the find cache.
-LIB_java.base_SRC_DIRS += $(TOPDIR)/src/java.base/*/native
-
-$(eval $(call FillCacheFind, $(wildcard $(LIB_java.base_SRC_DIRS))))
+$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/java.base/*/native)))
 
 ################################################################################
 # Create all the core libraries
@@ -47,8 +45,8 @@
     NAME := net, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB), \
-    HEADER_FLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-        $(LIBJAVA_HEADER_FLAGS), \
+    HEADER_FLAGS := \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     DISABLED_WARNINGS_gcc := format-nonliteral, \
     DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
     DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \
@@ -72,21 +70,16 @@
 ################################################################################
 # Create the nio library
 
-BUILD_LIBNIO_EXTRA_HEADERS := \
-    $(call FindSrcDirsForComponent, java.base, libnio/ch) \
-    $(call FindSrcDirsForComponent, java.base, libnio/fs) \
-    #
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \
     NAME := nio, \
     OPTIMIZATION := HIGH, \
     WARNINGS_AS_ERRORS_xlc := false, \
     CFLAGS := $(CFLAGS_JDKLIB), \
     HEADER_FLAGS := \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-        $(LIBJAVA_HEADER_FLAGS) \
-        $(addprefix -I, $(BUILD_LIBNET_SRC)) \
-        $(addprefix -I, $(BUILD_LIBNIO_EXTRA_HEADERS)), \
+        -I$(call FindHeaderDirForModule, $(MODULE)) \
+        $(addprefix -I, $(call FindSrcDirsForComponent, java.base, libnio/ch)) \
+        $(addprefix -I, $(call FindSrcDirsForComponent, java.base, libnio/fs)) \
+        $(addprefix -I, $(call FindSrcDirsForLib, java.base, net)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := -ljava -lnet, \
@@ -116,7 +109,7 @@
         NAME := osxsecurity, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB), \
-        HEADER_FLAGS := $(LIBJAVA_HEADER_FLAGS) \
+        HEADER_FLAGS :=  \
             -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
         DISABLED_WARNINGS_clang := deprecated-declarations, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
--- a/make/lib/Lib-java.desktop.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-java.desktop.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -29,9 +29,7 @@
 $(eval $(call IncludeCustomExtension, lib/Lib-java.desktop.gmk))
 
 # Prepare the find cache.
-LIB_java.desktop_SRC_DIRS += $(TOPDIR)/src/java.desktop/*/native
-
-$(eval $(call FillCacheFind, $(wildcard $(LIB_java.desktop_SRC_DIRS))))
+$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/java.desktop/*/native)))
 
 ################################################################################
 # Create the AWT/2D libraries
@@ -67,10 +65,9 @@
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBJSOUND_CFLAGS), \
+      CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
       HEADER_FLAGS := \
-          $(LIBJAVA_HEADER_FLAGS) \
-          -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
-      CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
+          -I$(call FindHeaderDirForModule, $(MODULE)), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS_unix := -ljava -ljvm, \
@@ -125,7 +122,6 @@
       CFLAGS := $(CFLAGS_JDKLIB), \
       HEADER_FLAGS := \
           -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp \
-          $(LIBJAVA_HEADER_FLAGS) \
           -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
       DISABLED_WARNINGS_clang := deprecated-declarations, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
--- a/make/lib/Lib-java.instrument.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-java.instrument.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -48,9 +48,8 @@
     CFLAGS_debug := -DJPLIS_LOGGING, \
     CFLAGS_release := -DNO_JPLIS_LOGGING, \
     HEADER_FLAGS := \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.instrument \
-        -I$(TOPDIR)/src/java.base/share/native/libjli \
-        -I$(TOPDIR)/src/java.base/share/native/libjava, \
+        -I$(call FindHeaderDirForModule, $(MODULE)) \
+        $(addprefix -I, $(call FindSrcDirsForLib, java.base, jli)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN) \
         $(LIBINSTRUMENT_LDFLAGS), \
--- a/make/lib/Lib-java.management.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-java.management.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -42,9 +42,7 @@
     OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB), \
     HEADER_FLAGS := \
-        -I$(TOPDIR)/src/hotspot/share/include \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.management \
-        $(LIBJAVA_HEADER_FLAGS), \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
--- a/make/lib/Lib-java.prefs.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-java.prefs.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -39,7 +39,8 @@
     SRC := $(LIBPREF_SRC_DIRS), \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(CFLAGS_JDKLIB), \
-    HEADER_FLAGS := $(LIBJAVA_HEADER_FLAGS), \
+    HEADER_FLAGS := \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := -ljvm, \
--- a/make/lib/Lib-java.rmi.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-java.rmi.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -31,7 +31,8 @@
     NAME := rmi, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB), \
-    HEADER_FLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.rmi, \
+    HEADER_FLAGS := \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := -ljvm, \
--- a/make/lib/Lib-java.security.jgss.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-java.security.jgss.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -31,8 +31,8 @@
     NAME := j2gss, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB), \
-    HEADER_FLAGS := $(LIBJAVA_HEADER_FLAGS) \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
+    HEADER_FLAGS := \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(LIBDL), \
--- a/make/lib/Lib-java.smartcardio.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-java.smartcardio.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -32,8 +32,8 @@
     CFLAGS := $(CFLAGS_JDKLIB), \
     CFLAGS_unix := -D__sun_jdk, \
     HEADER_FLAGS := \
-        -I$(TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pcsc/MUSCLE \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.smartcardio, \
+        -I$(call FindHeaderDirForModule, $(MODULE)) \
+        $(addprefix -I, $(call FindSrcDirsForComponent, $(MODULE), libj2pcsc/MUSCLE)), \
     OPTIMIZATION := LOW, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/Lib-jdk.attach.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.attach.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -40,8 +40,7 @@
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBATTACH_CFLAGS), \
     CFLAGS_windows := /Gy, \
     HEADER_FLAGS := \
-        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.attach \
-        $(LIBJAVA_HEADER_FLAGS), \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
--- a/make/lib/Lib-jdk.crypto.cryptoki.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.crypto.cryptoki.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -32,8 +32,7 @@
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB), \
     HEADER_FLAGS := \
-        $(LIBJAVA_HEADER_FLAGS) \
-        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.crypto.cryptoki, \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := $(LIBDL), \
--- a/make/lib/Lib-jdk.crypto.ec.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.crypto.ec.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -45,6 +45,8 @@
       CFLAGS := $(BUILD_LIBSUNEC_CFLAGS_JDKLIB) \
           -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B, \
       CXXFLAGS := $(BUILD_LIBSUNEC_CXXFLAGS_JDKLIB), \
+      HEADER_FLAGS := \
+          -I$(call FindHeaderDirForModule, $(MODULE)), \
       DISABLED_WARNINGS_gcc := sign-compare implicit-fallthrough, \
       DISABLED_WARNINGS_microsoft := 4101 4244 4146 4018, \
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
--- a/make/lib/Lib-jdk.crypto.mscapi.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.crypto.mscapi.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -29,6 +29,7 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
 
+#FIXME:LIBS severly broken includes!
   $(eval $(call SetupJdkLibrary, BUILD_LIBSUNMSCAPI, \
       NAME := sunmscapi, \
       OPTIMIZATION := LOW, \
--- a/make/lib/Lib-jdk.crypto.ucrypto.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.crypto.ucrypto.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -29,6 +29,8 @@
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
 
+#FIXME:LIBS - severly broken includes!
+
   $(eval $(call SetupJdkLibrary, BUILD_LIBJ2UCRYPTO, \
       NAME := j2ucrypto, \
       OPTIMIZATION := LOW, \
--- a/make/lib/Lib-jdk.hotspot.agent.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -58,8 +58,7 @@
     CFLAGS := $(CFLAGS_JDKLIB) $(SA_CFLAGS), \
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(SA_CFLAGS) $(SA_CXXFLAGS), \
     HEADER_FLAGS := \
-        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.hotspot.agent \
-        -I$(TOPDIR)/src/hotspot/os/$(OPENJDK_TARGET_OS), \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(SA_LDFLAGS), \
     LIBS_linux := -lthread_db $(LIBDL), \
     LIBS_solaris := -ldl -ldemangle -lthread -lproc, \
--- a/make/lib/Lib-jdk.internal.le.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.internal.le.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -34,8 +34,7 @@
       OPTIMIZATION := LOW, \
       CXXFLAGS := $(CXXFLAGS_JDKLIB), \
       HEADER_FLAGS := \
-          $(LIBJAVA_HEADER_FLAGS) \
-          -I$(SUPPORT_OUTPUTDIR)/headers/jdk.internal.le, \
+          -I$(call FindHeaderDirForModule, $(MODULE)), \
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LIBS := $(JDKLIB_LIBS) user32.lib, \
   ))
--- a/make/lib/Lib-jdk.jdi.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.jdi.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -29,15 +29,22 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
 
+# OLD
+#      HEADER_FLAGS := \
+          -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
+          -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
+          -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
+          -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdi, \
+
+
   $(eval $(call SetupJdkLibrary, BUILD_LIBDT_SHMEM, \
       NAME := dt_shmem, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP, \
       HEADER_FLAGS := \
-          -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
-          -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
-          -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
-          -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdi, \
+          -I$(call FindHeaderDirForModule, $(MODULE)) \
+          -I$(call FindHeaderDirForModule, jdk.jdwp.agent) \
+          -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include, \
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LIBS := $(JDKLIB_LIBS), \
   ))
--- a/make/lib/Lib-jdk.jdwp.agent.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.jdwp.agent.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -33,9 +33,8 @@
     CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
         $(LIBDT_SOCKET_CPPFLAGS), \
     HEADER_FLAGS := \
-        -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
-        -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp \
-        -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include, \
+        -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
+        -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_linux := -lpthread, \
@@ -56,9 +55,9 @@
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING, \
     HEADER_FLAGS := \
-      -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
+      -I$(call FindHeaderDirForModule, $(MODULE)) \
       -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
-      -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent, \
+      -I$(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.management.agent.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.management.agent.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -32,8 +32,7 @@
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB), \
     HEADER_FLAGS := \
-        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.management.agent \
-        $(LIBJAVA_HEADER_FLAGS), \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
--- a/make/lib/Lib-jdk.management.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.management.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -49,9 +49,7 @@
     OPTIMIZATION := $(LIBMANAGEMENT_EXT_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_EXT_CFLAGS), \
     HEADER_FLAGS := \
-        -I$(TOPDIR)/src/java.management/share/native/include \
-        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.management \
-        $(LIBJAVA_HEADER_FLAGS), \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
--- a/make/lib/Lib-jdk.net.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.net.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -33,7 +33,8 @@
       NAME := extnet, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB), \
-      HEADER_FLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/jdk.net, \
+      HEADER_FLAGS := \
+          -I$(call FindHeaderDirForModule, $(MODULE)), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := -ljava, \
--- a/make/lib/Lib-jdk.pack.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.pack.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -39,10 +39,9 @@
     OPTIMIZATION := LOW, \
     CXXFLAGS := $(CXXFLAGS_JDKLIB) \
         -DNO_ZLIB -DUNPACK_JNI -DFULL, \
+    CFLAGS_release := -DPRODUCT, \
     HEADER_FLAGS := \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-        $(LIBJAVA_HEADER_FLAGS), \
-    CFLAGS_release := -DPRODUCT, \
+            -I$(call FindHeaderDirForModule, java.base), \
     DISABLED_WARNINGS_gcc := implicit-fallthrough, \
     DISABLED_WARNINGS_microsoft := 4005, \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
--- a/make/lib/Lib-jdk.sctp.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.sctp.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -35,12 +35,10 @@
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB), \
         HEADER_FLAGS := \
-            -I $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \
-            -I $(TOPDIR)/src/java.base/share/native/libnio/ch \
+            -I$(call FindHeaderDirForModule, $(MODULE)) \
+            -I$(call FindHeaderDirForModule, java.base) \
             $(addprefix -I, $(call FindSrcDirsForLib, java.base, net)) \
-            $(LIBJAVA_HEADER_FLAGS) \
-            -I$(SUPPORT_OUTPUTDIR)/headers/jdk.sctp \
-            -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
+            $(addprefix -I, $(call FindSrcDirsForComponent, java.base, libnio/ch)), \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
         LIBS_unix := -lnio -lnet -ljava -ljvm, \
--- a/make/lib/Lib-jdk.security.auth.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/Lib-jdk.security.auth.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -31,7 +31,8 @@
     NAME := jaas, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB), \
-    HEADER_FLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/jdk.security.auth, \
+    HEADER_FLAGS := \
+        -I$(call FindHeaderDirForModule, $(MODULE)), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_windows := netapi32.lib user32.lib mpr.lib advapi32.lib $(JDKLIB_LIBS), \
--- a/make/lib/LibCommon.gmk	Mon Apr 16 14:51:31 2018 +0200
+++ b/make/lib/LibCommon.gmk	Wed Apr 18 14:22:53 2018 +0200
@@ -91,10 +91,6 @@
     $(addprefix $(SUPPORT_OUTPUTDIR)/native/, \
         $(strip $1)$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(STATIC_LIBRARY_SUFFIX))
 
-################################################################################
-# Define the header include flags needed to compile against it.
-LIBJAVA_HEADER_FLAGS := $(addprefix -I, $(call FindSrcDirsForLib, java.base, java))
-
 # Put the libraries here.
 INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE))
 
--- a/src/java.desktop/share/native/libsplashscreen/java_awt_SplashScreen.c	Mon Apr 16 14:51:31 2018 +0200
+++ b/src/java.desktop/share/native/libsplashscreen/java_awt_SplashScreen.c	Wed Apr 18 14:22:53 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 #include <jni.h>
 #include <jni_util.h>
 #include <sizecalc.h>
+#include "java_awt_SplashScreen.h"
 
 JNIEXPORT jint JNICALL
 DEF_JNI_OnLoad(JavaVM * vm, void *reserved)
--- a/src/java.prefs/macosx/native/libprefs/MacOSXPreferencesFile.m	Mon Apr 16 14:51:31 2018 +0200
+++ b/src/java.prefs/macosx/native/libprefs/MacOSXPreferencesFile.m	Wed Apr 18 14:22:53 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,6 +63,7 @@
 #include "jni_util.h"
 #include "jlong.h"
 #include "jvm.h"
+#include "java_util_prefs_MacOSXPreferencesFile.h"
 
 /*
  * Declare library specific JNI_Onload entry if static build
--- a/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c	Mon Apr 16 14:51:31 2018 +0200
+++ b/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c	Wed Apr 18 14:22:53 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 #include <errno.h>
 #include <utime.h>
 #include "jni_util.h"
+#include "java_util_prefs_FileSystemPreferences.h"
 
 /*
  * Declare library specific JNI_Onload entry if static build
--- a/src/java.prefs/windows/native/libprefs/WindowsPreferences.c	Mon Apr 16 14:51:31 2018 +0200
+++ b/src/java.prefs/windows/native/libprefs/WindowsPreferences.c	Wed Apr 18 14:22:53 2018 +0200
@@ -28,6 +28,8 @@
 #include "jni.h"
 #include "jni_util.h"
 #include "jvm.h"
+#include "java_util_prefs_WindowsPreferences.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
--- a/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp	Mon Apr 16 14:51:31 2018 +0200
+++ b/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp	Wed Apr 18 14:22:53 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,9 @@
 #include <jni.h>
 #include "jni_util.h"
 #include "impl/ecc_impl.h"
+#include "sun_security_ec_ECDHKeyAgreement.h"
+#include "sun_security_ec_ECKeyPairGenerator.h"
+#include "sun_security_ec_ECDSASignature.h"
 
 #define ILLEGAL_STATE_EXCEPTION "java/lang/IllegalStateException"
 #define INVALID_ALGORITHM_PARAMETER_EXCEPTION \
--- a/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c	Mon Apr 16 14:51:31 2018 +0200
+++ b/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c	Wed Apr 18 14:22:53 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 #include <jni.h>
 #include <netinet/tcp.h>
 #include "jni_util.h"
+#include "jdk_net_LinuxSocketOptions.h"
 
 /*
  * Class:     jdk_net_LinuxSocketOptions