8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
authorihse
Thu, 15 Mar 2018 01:20:47 +0100
changeset 49244 995a5556edfa
parent 49243 176b3da8ce61
child 49245 6c3054543ede
child 56311 e05b4241302b
8199639: Introduce SetupJdkLibrary and SetupJdkExecutable Reviewed-by: erikj
make/autoconf/libraries.m4
make/common/JdkNativeCompilation.gmk
make/common/MakeBase.gmk
make/common/NativeCompilation.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
--- a/make/autoconf/libraries.m4	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/autoconf/libraries.m4	Thu Mar 15 01:20:47 2018 +0100
@@ -112,7 +112,6 @@
   if test "x$TOOLCHAIN_TYPE" != xmicrosoft; then
     BASIC_JDKLIB_LIBS="-ljava -ljvm"
   fi
-  BASIC_JDKLIB_LIBS="$BASIC_JDKLIB_LIBS"
 
   # Math library
   if test "x$OPENJDK_TARGET_OS" != xsolaris; then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/common/JdkNativeCompilation.gmk	Thu Mar 15 01:20:47 2018 +0100
@@ -0,0 +1,119 @@
+#
+# 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 are all passed on to
+# SetupNativeCompilation, except for 
+#   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
+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
+
+  $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
+
+  # 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 are all passed on to
+# SetupNativeCompilation, except for 
+#   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
+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
+
+  $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
+
+  # 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/common/MakeBase.gmk	Thu Mar 15 01:20:47 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/NativeCompilation.gmk	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/common/NativeCompilation.gmk	Thu Mar 15 01:20:47 2018 +0100
@@ -735,7 +735,7 @@
 		$$(call MakeDir, $$(@D) $$($1_OBJECT_DIR))
 		$$(call ExecuteWithLog, $$@, \
 		    $$($1_RC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
-		    $$($1_VERSIONINFO_RESOURCE))
+		    $$($1_VERSIONINFO_RESOURCE) 2>&1 )
                 # Windows RC compiler does not support -showIncludes, so we mis-use CL
                 # for this. Filter out RC specific arguments that are unknown to CL.
                 # For some unknown reason, in this case CL actually outputs the show
@@ -746,7 +746,7 @@
 		        $$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \
 		        $(CC_OUT_OPTION)$$($1_RES_DEP).obj -P -Fi$$($1_RES_DEP).pp \
 		        $$($1_VERSIONINFO_RESOURCE)) 2>&1 \
-		    | $(GREP) -v -e "^Note: including file:" \
+		    | $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \
 		        -e "^$$(notdir $$($1_VERSIONINFO_RESOURCE))$$$$" || test "$$$$?" = "1" ; \
 		$(ECHO) $$($1_RES): \\ > $$($1_RES_DEP) ; \
 		$(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).obj.log >> $$($1_RES_DEP) ; \
--- a/make/common/TestFilesCompilation.gmk	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/common/TestFilesCompilation.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/launcher/Launcher-java.base.gmk	Thu Mar 15 01:20:47 2018 +0100
@@ -27,8 +27,8 @@
 
 $(eval $(call IncludeCustomExtension, launcher/Launcher-java.base.gmk))
 
-JAVA_RC_FLAGS += -I $(TOPDIR)/src/java.base/windows/native/common
-JAVA_RC_FLAGS += -I $(TOPDIR)/src/java.base/windows/native/launcher/icons
+JAVA_RC_FLAGS += -I$(TOPDIR)/src/java.base/windows/native/common
+JAVA_RC_FLAGS += -I$(TOPDIR)/src/java.base/windows/native/launcher/icons
 
 ################################################################################
 
@@ -39,7 +39,7 @@
     CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
     LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR), \
     LIBS_windows := user32.lib comctl32.lib, \
-    RC_FLAGS := $(JAVA_RC_FLAGS), \
+    EXTRA_RC_FLAGS := $(JAVA_RC_FLAGS), \
     VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
     OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs, \
     OPTIMIZATION := HIGH, \
@@ -58,7 +58,7 @@
   $(eval $(call SetupBuildLauncher, javaw, \
       CFLAGS := -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
       LIBS_windows := user32.lib comctl32.lib, \
-      RC_FLAGS := $(JAVA_RC_FLAGS), \
+      EXTRA_RC_FLAGS := $(JAVA_RC_FLAGS), \
       VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
       WINDOWS_STATIC_LINK := true, \
       NO_JAVA_MS := true, \
@@ -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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/launcher/Launcher-jdk.accessibility.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/launcher/Launcher-jdk.pack.gmk	Thu Mar 15 01:20:47 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, \
@@ -91,12 +90,6 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
     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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/launcher/LauncherCommon.gmk	Thu Mar 15 01:20:47 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,9 @@
       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), \
+      EXTRA_RC_FLAGS := $$($1_EXTRA_RC_FLAGS), \
       MANIFEST := $(JAVA_MANIFEST), \
       MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
       CODESIGN := $$($1_CODESIGN), \
--- a/make/lib/Awt2dLibraries.gmk	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Awt2dLibraries.gmk	Thu Mar 15 01:20:47 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, \
@@ -61,12 +60,6 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(BUILD_LIBMLIB_LDLIBS) \
         $(JDKLIB_LIBS), \
-    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)
@@ -106,9 +99,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, \
@@ -119,7 +111,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := -ljava -ljvm $(BUILD_LIBMLIB_LDLIBS), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image_v, \
   ))
 
   $(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
@@ -225,9 +216,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), \
@@ -267,7 +257,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)
@@ -346,9 +335,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, \
@@ -366,12 +354,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)
@@ -405,9 +391,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, \
@@ -430,12 +415,6 @@
     LIBS_macosx := $(LIBM), \
     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)
@@ -481,9 +460,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, \
@@ -496,13 +474,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)
@@ -545,9 +517,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, \
@@ -568,7 +539,6 @@
       LIBS_unix := -lawt -ljvm -ljava, \
       LIBS_linux := $(LIBM) $(LIBDL), \
       LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
   ))
 
   # AIX warning explanation:
@@ -596,9 +566,8 @@
     LIBFREETYPE_LIBS := -lfreetype
   endif
 
-  $(eval $(call SetupNativeCompilation, BUILD_LIBFREETYPE, \
+  $(eval $(call SetupJdkLibrary, BUILD_LIBFREETYPE, \
       NAME := freetype, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBFREETYPE_SRC)/src, \
       OPTIMIZATION := HIGHEST, \
       CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBFREETYPE_HEADERS) \
@@ -609,12 +578,6 @@
       DISABLED_WARNINGS_microsoft := 4267 2220 4244, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
-      VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $(RC_FLAGS) \
-          -D "JDK_FNAME=freetype.dll" \
-          -D "JDK_INTERNAL_NAME=freetype" \
-          -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfreetype, \
   ))
 
   TARGETS += $(BUILD_LIBFREETYPE)
@@ -694,9 +657,8 @@
   BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBFONTMANAGER, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
     NAME := fontmanager, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBFONTMANAGER_SRC), \
     EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
         AccelGlyphCache.c, \
@@ -730,12 +692,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, \
 ))
 
 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
@@ -768,9 +724,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, \
@@ -779,12 +734,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)
@@ -828,9 +777,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, \
@@ -846,7 +794,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)
@@ -957,9 +904,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), \
@@ -980,12 +926,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)
@@ -1032,9 +972,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), \
@@ -1062,7 +1001,6 @@
           -framework JavaRuntimeSupport \
           -framework OpenGL \
           -framework QuartzCore -ljava, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_lwawt, \
   ))
 
   TARGETS += $(BUILD_LIBAWT_LWAWT)
@@ -1081,9 +1019,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) \
@@ -1104,7 +1041,6 @@
           -framework JavaNativeFoundation \
           -framework JavaRuntimeSupport \
           -ljava -ljvm, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxui, \
   ))
 
   TARGETS += $(BUILD_LIBOSXUI)
--- a/make/lib/CoreLibraries.gmk	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/CoreLibraries.gmk	Thu Mar 15 01:20:47 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, \
     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), \
@@ -241,12 +226,6 @@
         -export:ZIP_InflateFully -export:ZIP_CRC32 -export:ZIP_FreeEntry, \
     LIBS_unix := -ljvm -ljava $(LIBZ_LIBS), \
     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)
@@ -262,10 +241,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, \
@@ -284,12 +262,6 @@
     LIBS_unix := -ljvm -ldl $(LIBCXX), \
     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)
@@ -357,7 +329,7 @@
       )
 endif
 
-$(eval $(call SetupNativeCompilation, BUILD_LIBJLI, \
+$(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \
     NAME := jli, \
     OUTPUT_DIR := $(LIBJLI_OUTPUT_DIR), \
     SRC := $(LIBJLI_SRC_DIRS), \
@@ -400,12 +372,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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-java.instrument.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-java.management.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-java.prefs.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-java.rmi.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-java.security.jgss.gmk	Thu Mar 15 01:20:47 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)) \
@@ -44,7 +43,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := $(LIBDL), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2gss, \
   ))
 
   TARGETS += $(BUILD_LIBJ2GSS)
@@ -73,9 +71,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) \
@@ -85,12 +82,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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-java.smartcardio.gmk	Thu Mar 15 01:20:47 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, \
@@ -45,12 +44,6 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := $(LIBDL), \
     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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.accessibility.gmk	Thu Mar 15 01:20:47 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,19 +87,13 @@
 
   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), \
         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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.attach.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.crypto.cryptoki.gmk	Thu Mar 15 01:20:47 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)) \
@@ -42,12 +41,6 @@
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := $(LIBDL), \
-    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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.crypto.ec.gmk	Thu Mar 15 01:20:47 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, \
@@ -60,12 +59,6 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
       LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := $(LIBCXX), \
-      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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.crypto.mscapi.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.crypto.ucrypto.gmk	Thu Mar 15 01:20:47 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) \
@@ -41,7 +40,6 @@
       MAPFILE := $(TOPDIR)/make/mapfiles/libj2ucrypto/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LIBS := $(LIBDL), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2ucrypto, \
   ))
 
   $(BUILD_LIBJ2UCRYPTO): $(BUILD_LIBJAVA)
--- a/make/lib/Lib-jdk.hotspot.agent.gmk	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk	Thu Mar 15 01:20:47 2018 +0100
@@ -23,7 +23,7 @@
 # questions.
 #
 
-include NativeCompilation.gmk
+include LibCommon.gmk
 
 $(eval $(call IncludeCustomExtension, hotspot/lib/Lib-jdk.hotspot.agent.gmk))
 
@@ -87,14 +87,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), \
@@ -102,7 +101,6 @@
     LDFLAGS := $(LDFLAGS_JDKLIB) $(SA_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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.internal.le.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.jdi.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.jdwp.agent.gmk	Thu Mar 15 01:20:47 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, \
     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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.management.agent.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.management.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.net.gmk	Thu Mar 15 01:20:47 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 -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, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libextnet, \
   ))
 
   $(BUILD_LIBEXTNET): $(call FindLib, java.base, java)
--- a/make/lib/Lib-jdk.pack.gmk	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.pack.gmk	Thu Mar 15 01:20:47 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, \
     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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.sctp.gmk	Thu Mar 15 01:20:47 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, \
-        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsctp, \
     ))
 
     TARGETS += $(BUILD_LIBSCTP)
--- a/make/lib/Lib-jdk.security.auth.gmk	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/Lib-jdk.security.auth.gmk	Thu Mar 15 01:20:47 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, \
@@ -48,12 +47,6 @@
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/LibCommon.gmk	Thu Mar 15 01:20:47 2018 +0100
@@ -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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/LibosxLibraries.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/NetworkingLibraries.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/NioLibraries.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/PlatformLibraries.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/SecurityLibraries.gmk	Thu Mar 15 01:20:47 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	Wed Mar 14 21:35:41 2018 +0100
+++ b/make/lib/SoundLibraries.gmk	Thu Mar 15 01:20:47 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), \
@@ -132,12 +131,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)
@@ -148,9 +141,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) \
@@ -172,7 +164,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)
@@ -185,9 +176,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 \
@@ -199,12 +189,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)