Introduce SetupJdkLibrary and SetupJdkExecutable. ihse-jdk-library-branch
authorihse
Tue, 13 Mar 2018 14:33:34 +0100
branchihse-jdk-library-branch
changeset 56287 593a452fcbeb
parent 56283 871659d45aca
child 56301 ceb60eb3139e
Introduce SetupJdkLibrary and SetupJdkExecutable.
make/common/JdkNativeCompilation.gmk
make/common/MakeBase.gmk
make/common/TestFilesCompilation.gmk
make/launcher/Launcher-java.base.gmk
make/launcher/Launcher-jdk.accessibility.gmk
make/launcher/Launcher-jdk.pack.gmk
make/launcher/LauncherCommon.gmk
make/lib/Awt2dLibraries.gmk
make/lib/CoreLibraries.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.accessibility.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
make/lib/LibosxLibraries.gmk
make/lib/NetworkingLibraries.gmk
make/lib/NioLibraries.gmk
make/lib/PlatformLibraries.gmk
make/lib/SecurityLibraries.gmk
make/lib/SoundLibraries.gmk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/common/JdkNativeCompilation.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -0,0 +1,197 @@
+#
+# Copyright (c) 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+ifndef _JDK_NATIVE_COMPILATION_GMK
+_JDK_NATIVE_COMPILATION_GMK := 1
+
+ifeq ($(_MAKEBASE_GMK), )
+  $(error You must include MakeBase.gmk prior to including JdkNativeCompilation.gmk)
+endif
+
+include NativeCompilation.gmk
+
+# Setup make rules for creating a native shared library with suitable defaults
+# for the OpenJDK project.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
+#   NAME The base name for the resulting binary, excluding decorations (like *.exe)
+#   TYPE Type of binary (EXECUTABLE, LIBRARY or STATIC_LIBRARY). Default is LIBRARY.
+#   SUFFIX Override the default suffix for the output file
+#   TOOLCHAIN Name of toolchain setup to use. Defaults to TOOLCHAIN_DEFAULT.
+#   SRC one or more directory roots to scan for C/C++ files.
+#   CFLAGS the compiler flags to be used, used both for C and C++.
+#   CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS.
+#   LDFLAGS the linker flags to be used, used both for C and C++.
+#   LIBS the libraries to link to
+#   ARFLAGS the archiver flags to be used
+#   OBJECT_DIR the directory where we store the object files
+#   OUTPUT_DIR the directory where the resulting binary is put
+#   INCLUDES only pick source from these directories
+#   EXCLUDES do not pick source from these directories
+#   INCLUDE_FILES only compile exactly these files!
+#   EXCLUDE_FILES with these names
+#   EXCLUDE_PATTERN exclude files matching any of these substrings
+#   EXTRA_FILES List of extra files not in any of the SRC dirs
+#   EXTRA_OBJECT_FILES List of extra object files to include when linking
+#   VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
+#   RC_FLAGS flags for RC.
+#   EMBED_MANIFEST if true, embed manifest on Windows.
+#   MAPFILE mapfile
+#   REORDER reorder file
+#   USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
+#       mapfile for the output symbols file
+#   CC the compiler to use, default is $(CC)
+#   LD the linker to use, default is $(LD)
+#   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
+#   DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
+#   DISABLED_WARNINGS_C_<toolchain> Disable the given warnings for the specified toolchain
+#       when compiling C code
+#   DISABLED_WARNINGS_CXX_<toolchain> Disable the given warnings for the specified
+#       toolchain when compiling C++ code
+#   STRIP_SYMBOLS Set to false to override global strip policy and always leave
+#       symbols in the binary, if the toolchain allows for it
+#   DEBUG_SYMBOLS Set to false to disable generation of debug symbols
+#   COPY_DEBUG_SYMBOLS Set to false to override global setting of debug symbol copying
+#   ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol
+#       zipping
+#   STRIPFLAGS Optionally change the flags given to the strip command
+#   PRECOMPILED_HEADER Header file to use as precompiled header
+#   PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
+SetupJdkLibrary = $(NamedParamsMacroTemplate)
+define SetupJdkLibraryBody
+  ifeq ($$($1_OUTPUT_DIR), )
+    $1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE))
+  endif
+
+  ifeq ($$($1_OBJECT_DIR), )
+    $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/lib$$($1_NAME)
+  endif
+
+  ifeq ($$($1_VERSIONINFO_RESOURCE), )
+    $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
+  else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
+    $1_VERSIONINFO_RESOURCE :=
+  endif
+
+  ifeq ($$($1_RC_FLAGS), )
+    $1_RC_FLAGS :=  $(RC_FLAGS) \
+        -D "JDK_FNAME=$$($1_NAME).dll" \
+        -D "JDK_INTERNAL_NAME=$$($1_NAME)" \
+        -D "JDK_FTYPE=0x2L"
+  else ifeq ($$($1_RC_FLAGS), DISABLE)
+    $1_RC_FLAGS :=
+  endif
+
+  # Since we reuse the rule name ($1), all our arguments will pass through.
+  # We lose in transparency, but gain in brevity in this call...
+  $$(eval $$(call SetupNativeCompilation, $1, ))
+endef
+
+# Setup make rules for creating a native executable with suitable defaults for
+# the OpenJDK project.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
+#   NAME The base name for the resulting binary, excluding decorations (like *.exe)
+#   TYPE Type of binary (EXECUTABLE, LIBRARY or STATIC_LIBRARY). Default is LIBRARY.
+#   SUFFIX Override the default suffix for the output file
+#   TOOLCHAIN Name of toolchain setup to use. Defaults to TOOLCHAIN_DEFAULT.
+#   SRC one or more directory roots to scan for C/C++ files.
+#   CFLAGS the compiler flags to be used, used both for C and C++.
+#   CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS.
+#   LDFLAGS the linker flags to be used, used both for C and C++.
+#   LIBS the libraries to link to
+#   ARFLAGS the archiver flags to be used
+#   OBJECT_DIR the directory where we store the object files
+#   OUTPUT_DIR the directory where the resulting binary is put
+#   INCLUDES only pick source from these directories
+#   EXCLUDES do not pick source from these directories
+#   INCLUDE_FILES only compile exactly these files!
+#   EXCLUDE_FILES with these names
+#   EXCLUDE_PATTERN exclude files matching any of these substrings
+#   EXTRA_FILES List of extra files not in any of the SRC dirs
+#   EXTRA_OBJECT_FILES List of extra object files to include when linking
+#   VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
+#   RC_FLAGS flags for RC.
+#   EMBED_MANIFEST if true, embed manifest on Windows.
+#   MAPFILE mapfile
+#   REORDER reorder file
+#   USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
+#       mapfile for the output symbols file
+#   CC the compiler to use, default is $(CC)
+#   LD the linker to use, default is $(LD)
+#   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
+#   DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
+#   DISABLED_WARNINGS_C_<toolchain> Disable the given warnings for the specified toolchain
+#       when compiling C code
+#   DISABLED_WARNINGS_CXX_<toolchain> Disable the given warnings for the specified
+#       toolchain when compiling C++ code
+#   STRIP_SYMBOLS Set to false to override global strip policy and always leave
+#       symbols in the binary, if the toolchain allows for it
+#   DEBUG_SYMBOLS Set to false to disable generation of debug symbols
+#   COPY_DEBUG_SYMBOLS Set to false to override global setting of debug symbol copying
+#   ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol
+#       zipping
+#   STRIPFLAGS Optionally change the flags given to the strip command
+#   PRECOMPILED_HEADER Header file to use as precompiled header
+#   PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
+SetupJdkExecutable = $(NamedParamsMacroTemplate)
+define SetupJdkExecutableBody
+  $1_TYPE := EXECUTABLE
+
+  ifeq ($$($1_OUTPUT_DIR), )
+    $1_OUTPUT_DIR := $$(call FindExecutableDirForModule, $$(MODULE))
+  endif
+
+  ifeq ($$($1_OBJECT_DIR), )
+    $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/$$($1_NAME)
+  endif
+
+  ifeq ($$($1_VERSIONINFO_RESOURCE), )
+    $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
+  else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
+    $1_VERSIONINFO_RESOURCE :=
+  endif
+
+  ifeq ($$($1_RC_FLAGS), )
+    $1_RC_FLAGS :=  $(RC_FLAGS) \
+        -D "JDK_FNAME=$$($1_NAME).exe" \
+        -D "JDK_INTERNAL_NAME=$$($1_NAME)" \
+        -D "JDK_FTYPE=0x01L"
+  else ifeq ($$($1_RC_FLAGS), DISABLE)
+    $1_RC_FLAGS :=
+  endif
+
+  # Since we reuse the rule name ($1), all our arguments will pass through.
+  # We lose in transparency, but gain in brevity in this call...
+  $$(eval $$(call SetupNativeCompilation, $1))
+endef
+
+endif # _JDK_NATIVE_COMPILATION_GMK
--- a/make/common/MakeBase.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/common/MakeBase.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -1027,6 +1027,12 @@
     $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
 
 ################################################################################
+# Find executable dir for module
+# Param 1 - module name
+FindExecutableDirForModule = \
+    $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
+
+################################################################################
 # Return a string suitable for use after a -classpath or --module-path option. It
 # will be correct and safe to use on all platforms. Arguments are given as space
 # separate classpath entries. Safe for multiple nested calls.
--- a/make/common/TestFilesCompilation.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/common/TestFilesCompilation.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -86,7 +86,6 @@
         INCLUDE_FILES := $$(notdir $$(file)), \
         OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$($1_PREFIX)$$(name), \
         OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \
-        LANG := C, \
         CFLAGS := $$($1_CFLAGS) $$($1_CFLAGS_$$($1_PREFIX)$$(name)), \
         LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$($1_PREFIX)$$(name)), \
         LIBS := $$($1_LIBS_$$($1_PREFIX)$$(name)), \
--- a/make/launcher/Launcher-java.base.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/launcher/Launcher-java.base.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -72,9 +72,8 @@
 ################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
-  $(eval $(call SetupNativeCompilation, BUILD_JEXEC, \
+  $(eval $(call SetupJdkExecutable, BUILD_JEXEC, \
       NAME := jexec, \
-      TYPE := EXECUTABLE, \
       SRC := $(TOPDIR)/src/$(MODULE)/unix/native/launcher, \
       INCLUDE_FILES := jexec.c, \
       OPTIMIZATION := LOW, \
@@ -83,7 +82,6 @@
       CFLAGS_linux := -fPIC, \
       CFLAGS_solaris := -KPIC, \
       LDFLAGS := $(LDFLAGS_JDKEXE), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jexec_obj, \
       OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
   ))
 
@@ -93,15 +91,13 @@
 ################################################################################
 
 ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), )
-  $(eval $(call SetupNativeCompilation, BUILD_JSPAWNHELPER, \
+  $(eval $(call SetupJdkExecutable, BUILD_JSPAWNHELPER, \
       NAME := jspawnhelper, \
-      TYPE := EXECUTABLE, \
       SRC := $(TOPDIR)/src/$(MODULE)/unix/native/jspawnhelper, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKEXE) -I$(TOPDIR)/src/$(MODULE)/unix/native/libjava, \
       EXTRA_OBJECT_FILES := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava/childproc.o, \
       LDFLAGS := $(LDFLAGS_JDKEXE), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jspawnhelper, \
       OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
   ))
 
--- a/make/launcher/Launcher-jdk.accessibility.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/launcher/Launcher-jdk.accessibility.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -33,9 +33,8 @@
   JABSWITCH_SRC := $(TOPDIR)/src/jdk.accessibility/windows/native/jabswitch
   ACCESSBRIDGE_SRC := $(TOPDIR)/src/jdk.accessibility/windows/native/common
 
-  $(eval $(call SetupNativeCompilation, BUILD_JABSWITCH, \
+  $(eval $(call SetupJdkExecutable, BUILD_JABSWITCH, \
       NAME := jabswitch, \
-      TYPE := EXECUTABLE, \
       SRC := $(JABSWITCH_SRC), \
       INCLUDE_FILES := jabswitch.cpp, \
       CFLAGS := $(filter-out -Zc:wchar_t-, $(CFLAGS_JDKEXE)) -Zc:wchar_t \
@@ -44,13 +43,7 @@
       DISABLED_WARNINGS_microsoft := 4267 4996, \
       LDFLAGS := $(LDFLAGS_JDKEXE), \
       LIBS := advapi32.lib version.lib user32.lib, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jabswitch, \
-      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
       VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRC)/AccessBridgeStatusWindow.RC, \
-      RC_FLAGS := $(RC_FLAGS) \
-          -D "JDK_FNAME=jabswitch.exe" \
-          -D "JDK_INTERNAL_NAME=jabswitch" \
-          -D "JDK_FTYPE=0x01L", \
       MANIFEST := $(JABSWITCH_SRC)/jabswitch.manifest, \
       MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
   ))
@@ -70,21 +63,14 @@
   # Parameter 1 File name suffix
   # Parameter 2 ACCESSBRIDGE_ARCH_ -D suffix
 
-    $$(eval $$(call SetupNativeCompilation, BUILD_JACCESSINSPECTOR$1, \
+    $$(eval $$(call SetupJdkExecutable, BUILD_JACCESSINSPECTOR$1, \
       NAME := jaccessinspector$1, \
-      TYPE := EXECUTABLE, \
       SRC := $(TOPDIR)/jaccessinspector $(TOPDIR)/common \
           $(TOPDIR)/toolscommon $(TOPDIR)/bridge, \
       CFLAGS := $$(CFLAGS_JDKEXE) $(TOOLS_CFLAGS) -DACCESSBRIDGE_ARCH_$2 -EHsc, \
       LDFLAGS := $$(LDFLAGS_JDKEXE) -stack:655360, \
       LIBS := advapi32.lib user32.lib, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jaccessinspector$1, \
-      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
       VERSIONINFO_RESOURCE := $(TOPDIR)/jaccessinspector/jaccessinspectorWindow.rc, \
-      RC_FLAGS := $$(RC_FLAGS) \
-          -D "JDK_FNAME=jaccessinspector$1.exe" \
-          -D "JDK_INTERNAL_NAME=jaccessinspector$1" \
-          -D "JDK_FTYPE=0x01L", \
     ))
 
     TARGETS += $$(BUILD_JACCESSINSPECTOR$1)
@@ -98,21 +84,14 @@
   # Parameter 1 File name suffix
   # Parameter 2 ACCESSBRIDGE_ARCH_ -D suffix
 
-    $$(eval $$(call SetupNativeCompilation, BUILD_JACCESSWALKER$1, \
+    $$(eval $$(call SetupJdkExecutable, BUILD_JACCESSWALKER$1, \
       NAME := jaccesswalker$1, \
-      TYPE := EXECUTABLE, \
       SRC := $(TOPDIR)/jaccesswalker $(TOPDIR)/common \
           $(TOPDIR)/toolscommon $(TOPDIR)/bridge, \
       CFLAGS := $$(CFLAGS_JDKEXE) $(TOOLS_CFLAGS) -DACCESSBRIDGE_ARCH_$2 -EHsc, \
       LDFLAGS := $$(LDFLAGS_JDKEXE) -stack:655360, \
       LIBS := advapi32.lib comctl32.lib gdi32.lib user32.lib, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jaccesswalker$1, \
-      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
       VERSIONINFO_RESOURCE := $(TOPDIR)/jaccesswalker/jaccesswalkerWindow.rc, \
-      RC_FLAGS := $$(RC_FLAGS) \
-          -D "JDK_FNAME=jaccesswalker$1.exe" \
-          -D "JDK_INTERNAL_NAME=jaccesswalker$1" \
-          -D "JDK_FTYPE=0x01L", \
    ))
 
     TARGETS += $$(BUILD_JACCESSWALKER$1)
--- a/make/launcher/Launcher-jdk.pack.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/launcher/Launcher-jdk.pack.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -73,9 +73,8 @@
   UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_UNPACKEXE, \
+$(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
     NAME := unpack200, \
-    TYPE := EXECUTABLE, \
     SRC := $(UNPACKEXE_SRC), \
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
     OPTIMIZATION := LOW, \
@@ -92,12 +91,6 @@
     LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
     LIBS_solaris :=  -lc, \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \
-    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=unpack200.exe" \
-        -D "JDK_INTERNAL_NAME=unpack200" \
-        -D "JDK_FTYPE=0x1L", \
     MANIFEST := $(TOPDIR)/src/jdk.pack/windows/native/unpack200/unpack200_proto.exe.manifest, \
     MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
 ))
--- a/make/launcher/LauncherCommon.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/launcher/LauncherCommon.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -23,7 +23,7 @@
 # questions.
 #
 
-include NativeCompilation.gmk
+include JdkNativeCompilation.gmk
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   DISABLE_MAPFILES := true
@@ -85,14 +85,6 @@
 SetupBuildLauncher = $(NamedParamsMacroTemplate)
 define SetupBuildLauncherBody
   # Setup default values (unless overridden)
-  ifeq ($$($1_VERSION_INFO_RESOURCE), )
-    $1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE)
-  endif
-
-  ifeq ($$($1_OUTPUT_DIR), )
-    $1_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)
-  endif
-
   ifeq ($$($1_OPTIMIZATION), )
     $1_OPTIMIZATION := LOW
   endif
@@ -182,9 +174,8 @@
     endif
   endif
 
-  $$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \
+  $$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \
       NAME := $1, \
-      TYPE := EXECUTABLE, \
       EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \
       OPTIMIZATION := $$($1_OPTIMIZATION), \
       CFLAGS := $$($1_CFLAGS) \
@@ -211,14 +202,8 @@
       LIBS_windows := $$($1_WINDOWS_JLI_LIB) \
           $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib \
           $$($1_LIBS_windows), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs, \
       OUTPUT_DIR := $$($1_OUTPUT_DIR), \
       VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $$(RC_FLAGS) \
-          -D "JDK_FNAME=$1$(EXE_SUFFIX)" \
-          -D "JDK_INTERNAL_NAME=$1" \
-          -D "JDK_FTYPE=0x1L" \
-          $$($1_RC_FLAGS), \
       MANIFEST := $(JAVA_MANIFEST), \
       MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
       CODESIGN := $$($1_CODESIGN), \
--- a/make/lib/Awt2dLibraries.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Awt2dLibraries.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -48,9 +48,8 @@
   BUILD_LIBMLIB_LDLIBS += $(LIBM) $(LIBDL)
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBMLIB_IMAGE, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBMLIB_IMAGE, \
     NAME := mlib_image, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(BUILD_LIBMLIB_SRC), \
     EXCLUDE_FILES := mlib_c_ImageBlendTable.c, \
     OPTIMIZATION := HIGHEST, \
@@ -62,12 +61,6 @@
     LIBS := $(BUILD_LIBMLIB_LDLIBS) \
         $(JDKLIB_LIBS), \
     LIBS_solaris := -lc, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=mlib_image.dll" \
-        -D "JDK_INTERNAL_NAME=mlib_image" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image, \
 ))
 
 $(BUILD_LIBMLIB_IMAGE): $(call FindLib, java.base, java)
@@ -107,9 +100,8 @@
 
   LIBMLIB_IMAGE_V_CFLAGS += $(filter-out -DMLIB_NO_LIBSUNMATH, $(BUILD_LIBMLIB_CFLAGS))
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBMLIB_IMAGE_V, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBMLIB_IMAGE_V, \
       NAME := mlib_image_v, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBMLIB_IMAGE_V_SRC), \
       EXCLUDE_FILES := $(BUILD_LIBMLIB_IMAGE_V_EXFILES), \
       OPTIMIZATION := HIGHEST, \
@@ -120,7 +112,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := -ljava -ljvm -lc $(BUILD_LIBMLIB_LDLIBS), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image_v, \
   ))
 
   $(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
@@ -226,9 +217,8 @@
   LIBAWT_CFLAGS += -fgcse-after-reload
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBAWT, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
     NAME := awt, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBAWT_DIRS), \
     EXCLUDES := $(LIBAWT_EXCLUDES), \
     EXCLUDE_FILES := $(LIBAWT_EXFILES), \
@@ -268,7 +258,6 @@
         -D "JDK_FNAME=awt.dll" \
         -D "JDK_INTERNAL_NAME=awt" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt, \
 ))
 
 $(BUILD_LIBAWT): $(call FindLib, java.base, java)
@@ -347,9 +336,8 @@
       BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
    endif
 
-    $(eval $(call SetupNativeCompilation, BUILD_LIBAWT_XAWT, \
+    $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_XAWT, \
         NAME := awt_xawt, \
-        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(LIBAWT_XAWT_DIRS), \
         EXCLUDES := $(LIBAWT_XAWT_EXCLUDES), \
         OPTIMIZATION := LOW, \
@@ -367,12 +355,10 @@
             $(call SET_SHARED_LIBRARY_ORIGIN) \
             -L$(INSTALL_LIBRARIES_HERE), \
         LIBS :=  $(X_LIBS) $(LIBAWT_XAWT_LIBS), \
-        VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
         RC_FLAGS := $(RC_FLAGS) \
             -D "JDK_FNAME=xawt.dll" \
             -D "JDK_INTERNAL_NAME=xawt" \
             -D "JDK_FTYPE=0x2L", \
-        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_xawt, \
     ))
 
     $(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java)
@@ -406,9 +392,8 @@
   LIBLCMS_CPPFLAGS += $(addprefix -I, $(LIBLCMS_SRC))
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBLCMS, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBLCMS, \
     NAME := lcms, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBLCMS_SRC), \
     INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
     OPTIMIZATION := HIGHEST, \
@@ -432,12 +417,6 @@
     LIBS_solaris := -lc, \
     LIBS_aix := $(LIBM),\
     LIBS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=lcms.dll" \
-        -D "JDK_INTERNAL_NAME=lcms" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/liblcms, \
 ))
 
 TARGETS += $(BUILD_LIBLCMS)
@@ -483,9 +462,8 @@
   BUILD_LIBJAVAJPEG_HEADERS := $(addprefix -I, $(LIBJAVAJPEG_SRC))
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBJAVAJPEG, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBJAVAJPEG, \
     NAME := javajpeg, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJAVAJPEG_SRC), \
     INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
     OPTIMIZATION := HIGHEST, \
@@ -498,13 +476,7 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(LIBJPEG_LIBS) $(JDKLIB_LIBS), \
     LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=javajpeg.dll" \
-        -D "JDK_INTERNAL_NAME=javajpeg" \
-        -D "JDK_FTYPE=0x2L", \
     REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavajpeg, \
 ))
 
 $(BUILD_LIBJAVAJPEG): $(call FindLib, java.base, java)
@@ -547,9 +519,8 @@
     endif
   endif
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBAWT_HEADLESS, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_HEADLESS, \
       NAME := awt_headless, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBAWT_HEADLESS_DIRS), \
       EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
       OPTIMIZATION := LOW, \
@@ -570,7 +541,6 @@
       LIBS_unix := -lawt -ljvm -ljava, \
       LIBS_linux := $(LIBM) $(LIBDL), \
       LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX) -lc, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
   ))
 
   # AIX warning explanation:
@@ -657,7 +627,7 @@
   BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBFONTMANAGER, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
     NAME := fontmanager, \
     OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
     SRC := $(LIBFONTMANAGER_SRC), \
@@ -695,12 +665,6 @@
     LIBS_aix := -lawt_headless,\
     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
         $(WIN_AWT_LIB), \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=fontmanager.dll" \
-        -D "JDK_INTERNAL_NAME=fontmanager" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
 ))
 
 $(INSTALL_LIBRARIES_HERE)/$(call SHARED_LIBRARY,fontmanager): $(BUILD_LIBFONTMANAGER_TARGET)
@@ -744,9 +708,8 @@
   ifeq ($(OPENJDK_TARGET_CPU), x86)
     KERNEL32_LIB := kernel32.lib
   endif
-  $(eval $(call SetupNativeCompilation, BUILD_LIBJAWT, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBJAWT, \
       NAME := jawt, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJAWT_SRC), \
       INCLUDE_FILES := $(LIBJAWT_INCLUDE_FILES), \
       OPTIMIZATION := LOW, \
@@ -755,12 +718,6 @@
           $(LIBJAWT_CFLAGS), \
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
       LIBS := $(JDKLIB_LIBS) $(KERNEL32_LIB) advapi32.lib $(WIN_AWT_LIB), \
-      VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $(RC_FLAGS) \
-          -D "JDK_FNAME=jawt.dll" \
-          -D "JDK_INTERNAL_NAME=jawt" \
-          -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
   ))
 
   $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
@@ -804,9 +761,8 @@
     endif
   endif
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBJAWT, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBJAWT, \
       NAME := jawt, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJAWT_SRC), \
       INCLUDE_FILES := $(JAWT_FILES), \
       OPTIMIZATION := LOW, \
@@ -822,7 +778,6 @@
       LIBS_unix := $(JAWT_LIBS) $(JDKLIB_LIBS), \
       LIBS_solaris := $(X_LIBS) -lXrender, \
       LIBS_macosx := -framework Cocoa, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
   ))
 
   ifeq ($(ENABLE_HEADLESS_ONLY), false)
@@ -935,9 +890,8 @@
     LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread -ldl
   endif
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBSPLASHSCREEN, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBSPLASHSCREEN, \
       NAME := splashscreen, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBSPLASHSCREEN_DIRS), \
       EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
       EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \
@@ -956,12 +910,6 @@
       LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ_LIBS) \
           $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
       LIBS_aix := -liconv, \
-      VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $(RC_FLAGS) \
-          -D "JDK_FNAME=splashscreen.dll" \
-          -D "JDK_INTERNAL_NAME=splashscreen" \
-          -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsplashscreen, \
   ))
 
   TARGETS += $(BUILD_LIBSPLASHSCREEN)
@@ -1008,9 +956,8 @@
   LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c
   LIBAWT_LWAWT_EXCLUDES := $(TOPDIR)/src/java.desktop/unix/native/common/awt/medialib
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBAWT_LWAWT, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_LWAWT, \
       NAME := awt_lwawt, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBAWT_LWAWT_DIRS), \
       INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
       EXCLUDE_FILES := $(LIBAWT_LWAWT_EXFILES), \
@@ -1038,7 +985,6 @@
           -framework JavaRuntimeSupport \
           -framework OpenGL \
           -framework QuartzCore -ljava, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_lwawt, \
   ))
 
   TARGETS += $(BUILD_LIBAWT_LWAWT)
@@ -1057,9 +1003,8 @@
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBOSXUI, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBOSXUI, \
       NAME := osxui, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(TOPDIR)/src/java.desktop/macosx/native/libosxui, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
@@ -1080,7 +1025,6 @@
           -framework JavaNativeFoundation \
           -framework JavaRuntimeSupport \
           -ljava -ljvm, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxui, \
   ))
 
   TARGETS += $(BUILD_LIBOSXUI)
--- a/make/lib/CoreLibraries.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/CoreLibraries.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -108,9 +108,8 @@
   endif
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBVERIFY, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBVERIFY, \
     NAME := verify, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(TOPDIR)/src/java.base/share/native/libverify, \
     OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB), \
@@ -121,13 +120,7 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := -ljvm -lc, \
     LIBS_windows := jvm.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=verify.dll" \
-        -D "JDK_INTERNAL_NAME=verify" \
-        -D "JDK_FTYPE=0x2L", \
     REORDER := $(BUILD_LIBVERIFY_REORDER), \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify, \
 ))
 
 TARGETS += $(BUILD_LIBVERIFY)
@@ -156,9 +149,8 @@
   endif
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBJAVA, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \
     NAME := java, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJAVA_SRC_DIRS), \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(CFLAGS_JDKLIB) \
@@ -186,13 +178,7 @@
     LIBS_windows := jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
         shell32.lib delayimp.lib \
         advapi32.lib version.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=java.dll" \
-        -D "JDK_INTERNAL_NAME=java" \
-        -D "JDK_FTYPE=0x2L", \
     REORDER := $(LIBJAVA_REORDER), \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava, \
 ))
 
 TARGETS += $(BUILD_LIBJAVA)
@@ -219,9 +205,8 @@
   BUILD_LIBZIP_MMAP := -DUSE_MMAP
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBZIP, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBZIP, \
     NAME := zip, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     OPTIMIZATION := LOW, \
     SRC := $(TOPDIR)/src/java.base/share/native/libzip, \
     EXCLUDES := $(LIBZIP_EXCLUDES), \
@@ -242,12 +227,6 @@
     LIBS_unix := -ljvm -ljava $(LIBZ_LIBS), \
     LIBS_solaris := -lc, \
     LIBS_windows := jvm.lib $(WIN_JAVA_LIB), \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=zip.dll" \
-        -D "JDK_INTERNAL_NAME=zip" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libzip, \
 ))
 
 $(BUILD_LIBZIP): $(BUILD_LIBJAVA)
@@ -263,10 +242,9 @@
     -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
     #
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBJIMAGE, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \
     NAME := jimage, \
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     OPTIMIZATION := LOW, \
     SRC := $(TOPDIR)/src/java.base/share/native/libjimage \
         $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjimage, \
@@ -286,12 +264,6 @@
     LIBS_solaris := -lc, \
     LIBS_macosx := -lc++, \
     LIBS_windows := jvm.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=jimage.dll" \
-        -D "JDK_INTERNAL_NAME=jimage" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjimage, \
 ))
 
 $(BUILD_LIBJIMAGE): $(BUILD_LIBJAVA)
@@ -359,7 +331,7 @@
       )
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBJLI, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \
     NAME := jli, \
     OUTPUT_DIR := $(LIBJLI_OUTPUT_DIR), \
     SRC := $(LIBJLI_SRC_DIRS), \
@@ -402,12 +374,6 @@
     LIBS_aix := $(LIBDL),\
     LIBS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \
     LIBS_windows := advapi32.lib comctl32.lib user32.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=jli.dll" \
-        -D "JDK_INTERNAL_NAME=jli" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli, \
 ))
 
 TARGETS += $(BUILD_LIBJLI)
--- a/make/lib/Lib-java.instrument.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-java.instrument.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -49,9 +49,8 @@
   LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBINSTRUMENT, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBINSTRUMENT, \
     NAME := instrument, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBINSTRUMENT_SRC), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(LIBINSTRUMENT_CFLAGS), \
@@ -77,12 +76,6 @@
         $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a, \
     LIBS_windows := jvm.lib $(WIN_JAVA_LIB) advapi32.lib \
         $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=instrument.dll" \
-        -D "JDK_INTERNAL_NAME=instrument" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libinstrument, \
 ))
 
 ifneq (, $(findstring $(OPENJDK_TARGET_OS), macosx windows aix))
--- a/make/lib/Lib-java.management.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-java.management.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -44,9 +44,8 @@
   endif
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBMANAGEMENT, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT, \
     NAME := management, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBMANAGEMENT_SRC), \
     OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_CFLAGS), \
@@ -57,12 +56,6 @@
     LIBS_solaris := -lkstat, \
     LIBS_aix := -lperfstat,\
     LIBS_windows := jvm.lib psapi.lib $(WIN_JAVA_LIB) advapi32.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=management.dll" \
-        -D "JDK_INTERNAL_NAME=management" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement, \
 ))
 
 $(BUILD_LIBMANAGEMENT): $(call FindLib, java.base, java)
--- a/make/lib/Lib-java.prefs.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-java.prefs.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -33,9 +33,8 @@
   LIBPREF_SRC_DIRS := $(TOPDIR)/src/java.prefs/$(OPENJDK_TARGET_OS_TYPE)/native/libprefs
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBPREFS, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBPREFS, \
     NAME := prefs, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBPREF_SRC_DIRS), \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBPREF_SRC_DIRS)) \
@@ -49,12 +48,6 @@
     LIBS_aix := -ljava, \
     LIBS_macosx := -framework CoreFoundation -framework Foundation, \
     LIBS_windows := advapi32.lib jvm.lib $(WIN_JAVA_LIB), \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=prefs.dll" \
-        -D "JDK_INTERNAL_NAME=prefs" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libprefs, \
 ))
 
 $(BUILD_LIBPREFS): $(call FindLib, java.base, java)
--- a/make/lib/Lib-java.rmi.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-java.rmi.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -27,9 +27,8 @@
 
 ################################################################################
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBRMI, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBRMI, \
     NAME := rmi, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(TOPDIR)/src/java.rmi/share/native/librmi, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/java.rmi, \
@@ -38,12 +37,6 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := -ljvm, \
     LIBS_windows := jvm.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-         -D "JDK_FNAME=rmi.dll" \
-         -D "JDK_INTERNAL_NAME=rmi" \
-         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/librmi, \
 ))
 
 $(BUILD_LIBRMI): $(call FindLib, java.base, java)
--- a/make/lib/Lib-java.security.jgss.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-java.security.jgss.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -32,9 +32,8 @@
       $(TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_TYPE)/native/libj2gss \
       #
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBJ2GSS, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBJ2GSS, \
       NAME := j2gss, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJ2GSS_SRC), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2GSS_SRC)) \
@@ -45,7 +44,6 @@
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := $(LIBDL), \
       LIBS_solaris := -lc, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2gss, \
   ))
 
   TARGETS += $(BUILD_LIBJ2GSS)
@@ -74,9 +72,8 @@
   ifneq ($(BUILD_LIBKRB5_NAME), )
     # libosxkrb5 needs to call deprecated krb5 APIs so that java
     # can use the native credentials cache.
-    $(eval $(call SetupNativeCompilation, BUILD_LIBKRB5, \
+    $(eval $(call SetupJdkLibrary, BUILD_LIBKRB5, \
         NAME := $(BUILD_LIBKRB5_NAME), \
-        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(BUILD_LIBKRB5_SRC), \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) \
@@ -86,12 +83,6 @@
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
         LIBS := $(BUILD_LIBKRB5_LIBS), \
-        VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-        RC_FLAGS := $(RC_FLAGS) \
-            -D "JDK_FNAME=$(BUILD_LIBKRB5_NAME).dll" \
-            -D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
-            -D "JDK_FTYPE=0x2L", \
-        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libkrb5, \
     ))
 
     TARGETS += $(BUILD_LIBKRB5)
--- a/make/lib/Lib-java.smartcardio.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-java.smartcardio.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -33,9 +33,8 @@
     -I$(TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pcsc/MUSCLE \
     -I$(SUPPORT_OUTPUTDIR)/headers/java.smartcardio
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBJ2PCSC, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBJ2PCSC, \
     NAME := j2pcsc, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJ2PCSC_SRC), \
     CFLAGS_unix := -D__sun_jdk, \
     OPTIMIZATION := LOW, \
@@ -46,12 +45,6 @@
     LIBS_unix := $(LIBDL), \
     LIBS_solaris := -lc, \
     LIBS_windows := winscard.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=j2pcsc.dll" \
-        -D "JDK_INTERNAL_NAME=j2pcsc" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pcsc, \
 ))
 
 TARGETS += $(BUILD_LIBJ2PCSC)
--- a/make/lib/Lib-jdk.accessibility.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.accessibility.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -41,9 +41,8 @@
     # Parameter 1 Suffix
     # Parameter 2 ACCESSBRIDGE_ARCH_ suffix
 
-    $(call SetupNativeCompilation, BUILD_JAVAACCESSBRIDGE$1, \
+    $(call SetupJdkLibrary, BUILD_JAVAACCESSBRIDGE$1, \
         NAME := javaaccessbridge$1, \
-        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(JAVA_AB_SRCDIR), \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) $(ACCESSBRIDGE_CFLAGS) \
@@ -56,11 +55,6 @@
             $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib \
             ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib, \
         VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
-        RC_FLAGS := $(RC_FLAGS) \
-            -D "JDK_FNAME=javaaccessbridge$1.dll" \
-            -D "JDK_INTERNAL_NAME=javaaccessbridge$1" \
-            -D "JDK_FTYPE=0x02L", \
-        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavaaccessbridge$1, \
     )
 
     $$(BUILD_JAVAACCESSBRIDGE$1): $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib
@@ -71,9 +65,8 @@
   define SetupWinDLL
     # Parameter 1 Suffix
     # Parameter 2 ACCESSBRIDGE_ARCH_ suffix
-    $(call SetupNativeCompilation, BUILD_WINDOWSACCESSBRIDGE$1, \
+    $(call SetupJdkLibrary, BUILD_WINDOWSACCESSBRIDGE$1, \
         NAME := windowsaccessbridge$1, \
-        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(WIN_AB_SRCDIR), \
         OPTIMIZATION := LOW, \
         CFLAGS := $(filter-out -MD, $(CFLAGS_JDKLIB)) -MT $(ACCESSBRIDGE_CFLAGS) \
@@ -86,11 +79,6 @@
             winspool.lib comdlg32.lib advapi32.lib shell32.lib \
             ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib, \
         VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
-        RC_FLAGS := $(RC_FLAGS) \
-            -D "JDK_FNAME=windowsaccessbridge$1.dll" \
-            -D "JDK_INTERNAL_NAME=windowsaccessbridge$1" \
-            -D "JDK_FTYPE=0x02L", \
-        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libwindowsaccessbridge$1, \
     )
 
     TARGETS += $$(BUILD_WINDOWSACCESSBRIDGE$1)
@@ -99,20 +87,14 @@
 
   define SetupAccessBridgeSysInfo
 
-    $(call SetupNativeCompilation, BUILD_ACCESSBRIDGESYSINFO, \
+    $(call SetupJdkLibrary, BUILD_ACCESSBRIDGESYSINFO, \
         NAME := jabsysinfo, \
-        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(SYSINFO_SRCDIR), \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) $(ACCESSBRIDGE_CFLAGS), \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             -subsystem:windows -machine:I386, \
         VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
-        RC_FLAGS := $(RC_FLAGS) \
-            -D "JDK_FNAME=jabsysinfo.dll" \
-            -D "JDK_INTERNAL_NAME=jabsysinfo" \
-            -D "JDK_FTYPE=0x02L", \
-        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lib/libjabsysinfo, \
     )
 
     TARGETS += $$(BUILD_ACCESSBRIDGESYSINFO)
--- a/make/lib/Lib-jdk.attach.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.attach.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -34,9 +34,8 @@
   LIBATTACH_CFLAGS := -DPSAPI_VERSION=1
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBATTACH, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBATTACH, \
     NAME := attach, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(call FindSrcDirsForLib, jdk.attach, attach), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) \
@@ -44,18 +43,12 @@
         $(LIBJAVA_HEADER_FLAGS) $(LIBATTACH_CFLAGS), \
     CFLAGS_windows := /Gy, \
     MAPFILE := $(TOPDIR)/make/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=attach.dll" \
-        -D "JDK_INTERNAL_NAME=attach" \
-        -D "JDK_FTYPE=0x2L", \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_windows := -order:@$(TOPDIR)/make/mapfiles/libattach/reorder-windows-$(OPENJDK_TARGET_CPU), \
     LIBS := $(JDKLIB_LIBS), \
     LIBS_solaris := -ldoor, \
     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib psapi.lib, \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libattach, \
 ))
 
 $(BUILD_LIBATTACH): $(call FindLib, java.base, java)
--- a/make/lib/Lib-jdk.crypto.cryptoki.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.crypto.cryptoki.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -30,9 +30,8 @@
 LIBJ2PKCS11_SRC := $(TOPDIR)/src/jdk.crypto.cryptoki/share/native/libj2pkcs11 \
     $(TOPDIR)/src/jdk.crypto.cryptoki/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pkcs11
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBJ2PKCS11, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBJ2PKCS11, \
     NAME := j2pkcs11, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJ2PKCS11_SRC), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2PKCS11_SRC)) \
@@ -43,12 +42,6 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := $(LIBDL), \
     LIBS_solaris := -lc, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=j2pkcs11.dll" \
-        -D "JDK_INTERNAL_NAME=j2pkcs11" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pkcs11, \
 ))
 
 TARGETS += $(BUILD_LIBJ2PKCS11)
--- a/make/lib/Lib-jdk.crypto.ec.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.crypto.ec.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -43,9 +43,8 @@
     ECC_JNI_SOLSPARC_FILTER := -xregs=no%appl
   endif
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBSUNEC, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBSUNEC, \
       NAME := sunec, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBSUNEC_SRC), \
       TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
       OPTIMIZATION := LOW, \
@@ -62,12 +61,6 @@
       LIBS := $(LIBCXX), \
       LIBS_linux := -lc, \
       LIBS_solaris := -lc, \
-      VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $(RC_FLAGS) \
-          -D "JDK_FNAME=sunec.dll" \
-          -D "JDK_INTERNAL_NAME=sunec" \
-          -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunec, \
   ))
 
   TARGETS += $(BUILD_LIBSUNEC)
--- a/make/lib/Lib-jdk.crypto.mscapi.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.crypto.mscapi.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -31,9 +31,8 @@
 
   LIBSUNMSCAPI_SRC := $(TOPDIR)/src/jdk.crypto.mscapi/$(OPENJDK_TARGET_OS_TYPE)/native/libsunmscapi
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBSUNMSCAPI, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBSUNMSCAPI, \
       NAME := sunmscapi, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBSUNMSCAPI_SRC), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
@@ -41,12 +40,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := crypt32.lib advapi32.lib, \
-      VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $(RC_FLAGS) \
-          -D "JDK_FNAME=sunmscapi.dll" \
-          -D "JDK_INTERNAL_NAME=sunmscapi" \
-          -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunmscapi, \
   ))
 
   TARGETS += $(BUILD_LIBSUNMSCAPI)
--- a/make/lib/Lib-jdk.crypto.ucrypto.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.crypto.ucrypto.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -31,9 +31,8 @@
 
   LIBJ2UCRYPTO_SRC := $(TOPDIR)/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBJ2UCRYPTO, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBJ2UCRYPTO, \
       NAME := j2ucrypto, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJ2UCRYPTO_SRC), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
@@ -42,7 +41,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LIBS := $(LIBDL), \
       LIBS_solaris := -lc, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2ucrypto, \
   ))
 
   $(BUILD_LIBJ2UCRYPTO): $(BUILD_LIBJAVA)
--- a/make/lib/Lib-jdk.hotspot.agent.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -97,14 +97,13 @@
 
 ################################################################################
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBSA, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBSA, \
     NAME := $(SA_NAME), \
     TOOLCHAIN := $(SA_TOOLCHAIN), \
     OPTIMIZATION := NONE, \
     DISABLED_WARNINGS_microsoft := 4267, \
     DISABLED_WARNINGS_gcc := sign-compare, \
     DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \
-    OUTPUT_DIR := $(call FindLibDirForModule, $(MODULE)), \
     SRC := $(SA_SRC), \
     EXCLUDE_FILES := test.c saproc_audit.cpp $(SA_EXCLUDE_FILES), \
     CFLAGS := $(SA_INCLUDES) $(SA_CFLAGS) $(SA_CUSTOM_CFLAGS), \
@@ -112,7 +111,6 @@
     LDFLAGS := $(SA_LDFLAGS) $(SA_CUSTOM_LDFLAGS), \
     LIBS := $(SA_LIBS), \
     MAPFILE := $(SA_MAPFILE), \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsa, \
 ))
 
 TARGETS += $(BUILD_LIBSA)
--- a/make/lib/Lib-jdk.internal.le.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.internal.le.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -36,21 +36,14 @@
       -I$(SUPPORT_OUTPUTDIR)/headers/jdk.internal.le \
       #
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBLE, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBLE, \
       NAME := le, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBLE_SRC), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBJAVA_HEADER_FLAGS)\
           $(LIBLE_CPPFLAGS), \
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LIBS := $(JDKLIB_LIBS) user32.lib, \
-      VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $(RC_FLAGS) \
-          -D "JDK_FNAME=le.dll" \
-          -D "JDK_INTERNAL_NAME=le" \
-          -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lible, \
   ))
 
   TARGETS += $(BUILD_LIBLE)
--- a/make/lib/Lib-jdk.jdi.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.jdi.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -39,9 +39,8 @@
       -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdi \
       #
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBDT_SHMEM, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBDT_SHMEM, \
       NAME := dt_shmem, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBDT_SHMEM_SRC), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
@@ -49,12 +48,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LDFLAGS_windows := -export:jdwpTransport_OnLoad, \
       LIBS := $(JDKLIB_LIBS), \
-      VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $(RC_FLAGS) \
-          -D "JDK_FNAME=dt_shmem.dll" \
-          -D "JDK_INTERNAL_NAME=dt_shmem" \
-          -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_shmem, \
   ))
 
   TARGETS += $(BUILD_LIBDT_SHMEM)
--- a/make/lib/Lib-jdk.jdwp.agent.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.jdwp.agent.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -36,9 +36,8 @@
     -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
     #
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBDT_SOCKET, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBDT_SOCKET, \
     NAME := dt_socket, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBDT_SOCKET_SRC), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
@@ -50,12 +49,6 @@
     LIBS_linux := -lpthread, \
     LIBS_solaris := -lnsl -lsocket -lc, \
     LIBS_windows := $(JDKLIB_LIBS) ws2_32.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=dt_socket.dll" \
-        -D "JDK_INTERNAL_NAME=dt_socket" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_socket, \
 ))
 
 $(BUILD_LIBDT_SOCKET): $(call FindLib, java.base, java)
@@ -73,9 +66,8 @@
     $(addprefix -I, $(LIBJDWP_SRC))
 
 # JDWP_LOGGING causes log messages to be compiled into the library.
-$(eval $(call SetupNativeCompilation, BUILD_LIBJDWP, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBJDWP, \
     NAME := jdwp, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJDWP_SRC), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING \
@@ -89,12 +81,6 @@
     LIBS_solaris := $(LIBDL), \
     LIBS_macosx := -liconv, \
     LIBS_aix := -liconv, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=jdwp.dll" \
-        -D "JDK_INTERNAL_NAME=jdwp" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjdwp, \
 ))
 
 $(BUILD_LIBJDWP): $(call FindLib, java.base, java)
--- a/make/lib/Lib-jdk.management.agent.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.management.agent.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -33,9 +33,8 @@
     $(LIBJAVA_HEADER_FLAGS) \
     #
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBMANAGEMENT_AGENT, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT_AGENT, \
     NAME := management_agent, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBMANAGEMENT_AGENT_SRC), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_AGENT_CFLAGS), \
@@ -44,12 +43,6 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=management_agent.dll" \
-        -D "JDK_INTERNAL_NAME=management_agent" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement_agent, \
 ))
 
 $(BUILD_LIBMANAGEMENT_AGENT): $(call FindLib, java.base, java)
--- a/make/lib/Lib-jdk.management.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.management.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -53,9 +53,8 @@
   endif
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBMANAGEMENT_EXT, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT_EXT, \
     NAME := management_ext, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBMANAGEMENT_EXT_SRC), \
     LANG := C, \
     OPTIMIZATION := $(LIBMANAGEMENT_EXT_OPTIMIZATION), \
@@ -67,12 +66,6 @@
     LIBS_solaris := -lkstat, \
     LIBS_aix := -lperfstat,\
     LIBS_windows := jvm.lib psapi.lib $(WIN_JAVA_LIB) advapi32.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=management_ext.dll" \
-        -D "JDK_INTERNAL_NAME=management_ext" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement_ext, \
 ))
 
 $(BUILD_LIBMANAGEMENT_EXT): $(call FindLib, java.base, java)
--- a/make/lib/Lib-jdk.net.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.net.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -29,9 +29,8 @@
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBEXTNET, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBEXTNET, \
       NAME := extnet, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(TOPDIR)/src/jdk.net/solaris/native/libextnet, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.net, \
@@ -39,7 +38,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := -lsocket -lc -ljava, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libextnet, \
   ))
 
   $(BUILD_LIBEXTNET): $(call FindLib, java.base, java)
@@ -50,9 +48,8 @@
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBEXTNET, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBEXTNET, \
       NAME := extnet, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(TOPDIR)/src/jdk.net/linux/native/libextnet, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.net, \
@@ -60,7 +57,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := -ljvm -ljava -lc, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libextnet, \
   ))
 
   $(BUILD_LIBEXTNET): $(call FindLib, java.base, java)
--- a/make/lib/Lib-jdk.pack.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.pack.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -27,9 +27,8 @@
 
 ################################################################################
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBUNPACK, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBUNPACK, \
     NAME := unpack, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(TOPDIR)/src/jdk.pack/share/native/libunpack \
         $(TOPDIR)/src/jdk.pack/share/native/common-unpack, \
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
@@ -47,12 +46,6 @@
     LDFLAGS_windows := -map:$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpack.map -debug, \
     LIBS_unix := -ljvm $(LIBCXX) -ljava -lc, \
     LIBS_windows := jvm.lib $(WIN_JAVA_LIB), \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libunpack, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=unpack.dll" \
-        -D "JDK_INTERNAL_NAME=unpack" \
-        -D "JDK_FTYPE=0x2L", \
 ))
 
 $(BUILD_LIBUNPACK): $(call FindLib, java.base, java)
--- a/make/lib/Lib-jdk.sctp.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.sctp.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -30,9 +30,8 @@
 ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
 
   ifeq (, $(filter $(OPENJDK_TARGET_OS), macosx aix))
-    $(eval $(call SetupNativeCompilation, BUILD_LIBSCTP, \
+    $(eval $(call SetupJdkLibrary, BUILD_LIBSCTP, \
         NAME := sctp, \
-        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(TOPDIR)/src/jdk.sctp/$(OPENJDK_TARGET_OS_TYPE)/native/libsctp, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) \
@@ -48,7 +47,6 @@
         LIBS_unix := -lnio -lnet -ljava -ljvm, \
         LIBS_linux := -lpthread $(LIBDL), \
         LIBS_solaris := -lsocket -lc, \
-        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsctp, \
     ))
 
     TARGETS += $(BUILD_LIBSCTP)
--- a/make/lib/Lib-jdk.security.auth.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/Lib-jdk.security.auth.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -38,9 +38,8 @@
   LIBJAAS_NAME := jaas_nt
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBJAAS, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBJAAS, \
     NAME := $(LIBJAAS_NAME), \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(call FindSrcDirsForLib, jdk.security.auth, jaas), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.security.auth, \
@@ -49,12 +48,6 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_solaris := -lc, \
     LIBS_windows := netapi32.lib user32.lib mpr.lib advapi32.lib $(JDKLIB_LIBS), \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=$(LIBJAAS_NAME).dll" \
-        -D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjaas, \
 ))
 
 $(BUILD_LIBJAAS): $(call FindLib, java.base, java)
--- a/make/lib/LibCommon.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/LibCommon.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, 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
@@ -23,7 +23,7 @@
 # questions.
 #
 
-include NativeCompilation.gmk
+include JdkNativeCompilation.gmk
 
 # Hook to include the corresponding custom file, if present.
 $(eval $(call IncludeCustomExtension, lib/LibCommon.gmk))
--- a/make/lib/LibosxLibraries.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/LibosxLibraries.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -34,9 +34,8 @@
       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
       #
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBOSX, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBOSX, \
       NAME := osx, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBOSX_DIRS), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
@@ -53,7 +52,6 @@
           -framework JavaRuntimeSupport \
           -framework SystemConfiguration \
           $(JDKLIB_LIBS), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \
   ))
 
   TARGETS += $(BUILD_LIBOSX)
--- a/make/lib/NetworkingLibraries.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/NetworkingLibraries.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -25,9 +25,8 @@
 
 LIBNET_SRC_DIRS := $(call FindSrcDirsForLib, java.base, net)
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBNET, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBNET, \
     NAME := net, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBNET_SRC_DIRS), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
@@ -47,12 +46,6 @@
     LIBS_windows := ws2_32.lib jvm.lib secur32.lib iphlpapi.lib winhttp.lib \
         delayimp.lib $(WIN_JAVA_LIB) advapi32.lib, \
     LIBS_macosx := -framework CoreFoundation -framework CoreServices, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=net.dll" \
-        -D "JDK_INTERNAL_NAME=net" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet, \
 ))
 
 $(BUILD_LIBNET): $(BUILD_LIBJAVA)
--- a/make/lib/NioLibraries.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/NioLibraries.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -56,9 +56,8 @@
   BUILD_LIBNIO_MAPFILE := $(TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBNIO, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \
     NAME := nio, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(BUILD_LIBNIO_SRC), \
     EXCLUDE_FILES := $(BUILD_LIBNIO_EXFILES), \
     OPTIMIZATION := HIGH, \
@@ -78,12 +77,6 @@
     LIBS_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
         $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib \
         advapi32.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=nio.dll" \
-        -D "JDK_INTERNAL_NAME=nio" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnio, \
 ))
 
 TARGETS += $(BUILD_LIBNIO)
--- a/make/lib/PlatformLibraries.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/PlatformLibraries.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -29,9 +29,8 @@
 
   LIBOSXAPP_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libosxapp
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBOSXAPP, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBOSXAPP, \
       NAME := osxapp, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBOSXAPP_SRC), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
@@ -53,7 +52,6 @@
           -framework OpenGL \
           -framework IOSurface \
           -framework QuartzCore, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxapp, \
   ))
 
   TARGETS += $(BUILD_LIBOSXAPP)
--- a/make/lib/SecurityLibraries.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/SecurityLibraries.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -36,9 +36,8 @@
         $(LIBJAVA_HEADER_FLAGS) \
         -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
 
-    $(eval $(call SetupNativeCompilation, BUILD_LIBOSXSECURITY, \
+    $(eval $(call SetupJdkLibrary, BUILD_LIBOSXSECURITY, \
         NAME := osxsecurity, \
-        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(LIBOSXSECURITY_DIRS), \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) \
@@ -53,7 +52,6 @@
             -framework CoreServices \
             -framework Security \
             $(JDKLIB_LIBS), \
-        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxsecurity, \
     ))
 
     $(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA)
--- a/make/lib/SoundLibraries.gmk	Tue Mar 13 11:32:32 2018 +0100
+++ b/make/lib/SoundLibraries.gmk	Tue Mar 13 14:33:34 2018 +0100
@@ -114,9 +114,8 @@
 
 LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBJSOUND, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBJSOUND, \
     NAME := jsound, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJSOUND_SRC_DIRS), \
     INCLUDE_FILES := $(LIBJSOUND_SRC_FILES), \
     TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \
@@ -133,12 +132,6 @@
         -framework CoreServices -framework AudioUnit $(LIBCXX) \
         -framework CoreMIDI -framework AudioToolbox, \
     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=jsound.dll" \
-        -D "JDK_INTERNAL_NAME=jsound" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsound, \
 ))
 
 $(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
@@ -149,9 +142,8 @@
 
 ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), )
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBJSOUNDALSA, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBJSOUNDALSA, \
       NAME := jsoundalsa, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJSOUND_SRC_DIRS), \
       INCLUDE_FILES := Utilities.c $(LIBJSOUND_MIDIFILES) $(LIBJSOUND_PORTFILES) \
           $(LIBJSOUND_DAUDIOFILES) \
@@ -173,7 +165,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := $(ALSA_LIBS) -ljava -ljvm, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundalsa, \
   ))
 
   $(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
@@ -186,9 +177,8 @@
 
 ifneq ($(filter jsoundds, $(EXTRA_SOUND_JNI_LIBS)), )
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBJSOUNDDS, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBJSOUNDDS, \
       NAME := jsoundds, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJSOUND_SRC_DIRS), \
       INCLUDE_FILES := Utilities.c $(LIBJSOUND_DAUDIOFILES) \
           PLATFORM_API_WinOS_Charset_Util.cpp \
@@ -200,12 +190,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := $(JDKLIB_LIBS) dsound.lib winmm.lib user32.lib ole32.lib, \
-      VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $(RC_FLAGS) \
-          -D "JDK_FNAME=jsoundds.dll" \
-          -D "JDK_INTERNAL_NAME=jsoundds" \
-          -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundds, \
   ))
 
   $(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)