changeset 14472:20ccac7e0705

8141444: Clean up building of JDK launchers Reviewed-by: erikj
author ihse
date Thu, 05 Nov 2015 10:54:05 +0100
parents 9ecb10ce62c6
children 67d91e7479c1
files make/launcher/Launcher-java.base.gmk make/launcher/Launcher-java.corba.gmk make/launcher/Launcher-java.desktop.gmk make/launcher/Launcher-java.rmi.gmk make/launcher/Launcher-java.scripting.gmk make/launcher/Launcher-java.security.jgss.gmk make/launcher/Launcher-jdk.compiler.gmk make/launcher/Launcher-jdk.dev.gmk make/launcher/Launcher-jdk.hotspot.agent.gmk make/launcher/Launcher-jdk.jartool.gmk make/launcher/Launcher-jdk.javadoc.gmk make/launcher/Launcher-jdk.jcmd.gmk make/launcher/Launcher-jdk.jconsole.gmk make/launcher/Launcher-jdk.jdeps.gmk make/launcher/Launcher-jdk.jdi.gmk make/launcher/Launcher-jdk.jshell.gmk make/launcher/Launcher-jdk.jvmstat.gmk make/launcher/Launcher-jdk.pack200.gmk make/launcher/Launcher-jdk.policytool.gmk make/launcher/Launcher-jdk.rmic.gmk make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk make/launcher/Launcher-jdk.xml.bind.gmk make/launcher/Launcher-jdk.xml.ws.gmk make/launcher/LauncherCommon.gmk
diffstat 24 files changed, 311 insertions(+), 270 deletions(-) [+]
line wrap: on
line diff
--- a/make/launcher/Launcher-java.base.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-java.base.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -25,32 +25,51 @@
 
 include LauncherCommon.gmk
 
+JAVA_RC_FLAGS += -i $(JDK_TOPDIR)/src/java.base/windows/native/common
+ifdef OPENJDK
+  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/java.base/windows/native/launcher/icons"
+else
+  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons"
+endif
+
 ################################################################################
 
 # On windows, the debuginfo files get the same name as for java.dll. Build
 # into another dir and copy selectively so debuginfo for java.dll isn't
 # overwritten.
-$(eval $(call SetupLauncher,java, \
-    -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES,,,user32.lib comctl32.lib, \
-    $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \
-    $(JAVA_VERSION_INFO_RESOURCE), $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs,true))
+$(eval $(call SetupBuildLauncher, java, \
+    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), \
+    VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
+    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs, \
+    OPTIMIZATION := HIGH, \
+    WINDOWS_STATIC_LINK := true, \
+    NO_JAVA_MS := true, \
+))
 
 $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-	$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
+	$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs/java$(EXE_SUFFIX) $@
 
 TARGETS += $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX)
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  $(eval $(call SetupLauncher,javaw, \
-      -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES,,,user32.lib comctl32.lib, \
-      $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \
-      $(JAVA_VERSION_INFO_RESOURCE),,true))
+  $(eval $(call SetupBuildLauncher, javaw, \
+      CFLAGS := -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
+      LIBS_windows := user32.lib comctl32.lib, \
+      RC_FLAGS := $(JAVA_RC_FLAGS), \
+      VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
+      WINDOWS_STATIC_LINK := true, \
+      NO_JAVA_MS := true, \
+  ))
 endif
 
-$(eval $(call SetupLauncher,keytool, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.keytool.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, keytool, \
+    MAIN_CLASS := sun.security.tools.keytool.Main, \
+))
 
 ################################################################################
 
--- a/make/launcher/Launcher-java.corba.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-java.corba.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,23 +25,26 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,idlj, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, idlj, \
+    MAIN_CLASS := com.sun.tools.corba.se.idl.toJavaPortable.Compile, \
+))
 
-$(eval $(call SetupLauncher,orbd, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-        "-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
-        "-J-Dcom.sun.CORBA.activation.Port=1049"$(COMMA) \
-        "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
-        "com.sun.corba.se.impl.activation.ORBD"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, orbd, \
+    MAIN_CLASS := com.sun.corba.se.impl.activation.ORBD, \
+    JAVA_ARGS := \
+        -Dcom.sun.CORBA.activation.DbDir=./orb.db \
+        -Dcom.sun.CORBA.activation.Port=1049 \
+        -Dcom.sun.CORBA.POA.ORBServerId=1, \
+))
 
-$(eval $(call SetupLauncher,servertool, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, servertool, \
+    MAIN_CLASS := com.sun.corba.se.impl.activation.ServerTool, \
+))
 
-$(eval $(call SetupLauncher,tnameserv, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-        "-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
-        "-J-Djava.util.logging.LoggingPermission=contol"$(COMMA) \
-        "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
-        "com.sun.corba.se.impl.naming.cosnaming.TransientNameServer"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, tnameserv, \
+    MAIN_CLASS := com.sun.corba.se.impl.naming.cosnaming.TransientNameServer, \
+    JAVA_ARGS := \
+        -Dcom.sun.CORBA.activation.DbDir=./orb.db \
+        -Djava.util.logging.LoggingPermission=contol \
+        -Dcom.sun.CORBA.POA.ORBServerId=1, \
+))
--- a/make/launcher/Launcher-java.desktop.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-java.desktop.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -29,8 +29,8 @@
 $(eval $(call IncludeCustomExtension, jdk, launcher/Launcher-java.desktop.gmk))
 
 ifndef BUILD_HEADLESS_ONLY
-  $(eval $(call SetupLauncher,appletviewer, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',, \
-      $(XLIBS)))
+  $(eval $(call SetupBuildLauncher, appletviewer, \
+      MAIN_CLASS := sun.applet.Main, \
+      LIBS_unix := $(X_LIBS), \
+  ))
 endif
-
--- a/make/launcher/Launcher-java.rmi.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-java.rmi.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,8 +25,10 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,rmid, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, rmid, \
+    MAIN_CLASS := sun.rmi.server.Activation, \
+))
 
-$(eval $(call SetupLauncher,rmiregistry, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, rmiregistry, \
+    MAIN_CLASS := sun.rmi.registry.RegistryImpl, \
+))
--- a/make/launcher/Launcher-java.scripting.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-java.scripting.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,6 +25,6 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jrunscript, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, jrunscript, \
+    MAIN_CLASS := com.sun.tools.script.shell.Main, \
+))
--- a/make/launcher/Launcher-java.security.jgss.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-java.security.jgss.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,15 @@
 include LauncherCommon.gmk
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  $(eval $(call SetupLauncher,kinit, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }'))
+  $(eval $(call SetupBuildLauncher, kinit, \
+      MAIN_CLASS := sun.security.krb5.internal.tools.Kinit, \
+  ))
 
-  $(eval $(call SetupLauncher,klist, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }'))
+  $(eval $(call SetupBuildLauncher, klist, \
+      MAIN_CLASS := sun.security.krb5.internal.tools.Klist, \
+  ))
 
-  $(eval $(call SetupLauncher,ktab, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
+  $(eval $(call SetupBuildLauncher, ktab, \
+      MAIN_CLASS := sun.security.krb5.internal.tools.Ktab, \
+  ))
 endif
-
--- a/make/launcher/Launcher-jdk.compiler.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.compiler.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,26 +25,30 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,javac, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, javac, \
+   MAIN_CLASS := com.sun.tools.javac.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
 
-$(eval $(call SetupLauncher,javah, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, javah, \
+    MAIN_CLASS := com.sun.tools.javah.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
 
-$(eval $(call SetupLauncher,serialver, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, serialver, \
+    MAIN_CLASS := sun.tools.serialver.SerialVer, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \
+))
 
 ifeq ($(ENABLE_SJAVAC), yes)
   # Build sjavac directly to the exploded image so that it does not get included
   # into any real images
-  $(eval $(call SetupLauncher,sjavac, \
-      -DEXPAND_CLASSPATH_WILDCARDS \
-      -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.sjavac.Main"$(COMMA) }',,,,,,, \
-      $(JDK_OUTPUTDIR)/bin))
+  $(eval $(call SetupBuildLauncher, sjavac, \
+      MAIN_CLASS := com.sun.tools.sjavac.Main, \
+      CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+          -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+      OUTPUT_DIR := $(JDK_OUTPUTDIR)/bin, \
+  ))
 endif
--- a/make/launcher/Launcher-jdk.dev.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.dev.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,5 +25,6 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jimage,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.tools.jimage.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jimage,\
+    MAIN_CLASS := jdk.tools.jimage.Main, \
+))
--- a/make/launcher/Launcher-jdk.hotspot.agent.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.hotspot.agent.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,12 +25,13 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jsadebugd, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
-    ,,,,,,,,,Info-privileged.plist))
+$(eval $(call SetupBuildLauncher, jsadebugd, \
+    MAIN_CLASS := sun.jvm.hotspot.jdi.SADebugServer, \
+    MACOSX_SIGNED := true, \
+))
 
 
-$(eval $(call SetupLauncher,jhsdb, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.SALauncher"$(COMMA) }' \
-    ,,,,,,,,,Info-privileged.plist))
-
+$(eval $(call SetupBuildLauncher, jhsdb, \
+    MAIN_CLASS := sun.jvm.hotspot.SALauncher, \
+    MACOSX_SIGNED := true, \
+))
--- a/make/launcher/Launcher-jdk.jartool.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.jartool.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -25,8 +25,10 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jar, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jar, \
+    MAIN_CLASS := sun.tools.jar.Main, \
+))
 
-$(eval $(call SetupLauncher,jarsigner, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jarsigner, \
+    MAIN_CLASS := sun.security.tools.jarsigner.Main, \
+))
--- a/make/launcher/Launcher-jdk.javadoc.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.javadoc.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,8 +25,8 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,javadoc, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, javadoc, \
+    MAIN_CLASS := com.sun.tools.javadoc.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
--- a/make/launcher/Launcher-jdk.jcmd.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.jcmd.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,36 +25,41 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jinfo, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
-        "sun.tools.jinfo.JInfo"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
-    ,,,,,,,,,Info-privileged.plist))
+$(eval $(call SetupBuildLauncher, jinfo, \
+    MAIN_CLASS := sun.tools.jinfo.JInfo, \
+    JAVA_ARGS := \
+        -Dsun.jvm.hotspot.debugger.useProcDebugger \
+        -Dsun.jvm.hotspot.debugger.useWindbgDebugger, \
+    APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \
+    MACOSX_SIGNED := true, \
+))
 
-$(eval $(call SetupLauncher,jmap, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
-        "sun.tools.jmap.JMap"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
-    ,,,,,,,,,Info-privileged.plist))
+$(eval $(call SetupBuildLauncher, jmap, \
+    MAIN_CLASS := sun.tools.jmap.JMap, \
+    JAVA_ARGS := \
+        -Dsun.jvm.hotspot.debugger.useProcDebugger \
+        -Dsun.jvm.hotspot.debugger.useWindbgDebugger, \
+    APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \
+    MACOSX_SIGNED := true, \
+))
 
-$(eval $(call SetupLauncher,jps, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jps, \
+    MAIN_CLASS := sun.tools.jps.Jps, \
+))
 
-$(eval $(call SetupLauncher,jstack, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
-        "sun.tools.jstack.JStack"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
-    ,,,,,,,,,Info-privileged.plist))
+$(eval $(call SetupBuildLauncher, jstack, \
+    MAIN_CLASS := sun.tools.jstack.JStack, \
+    JAVA_ARGS := \
+        -Dsun.jvm.hotspot.debugger.useProcDebugger \
+        -Dsun.jvm.hotspot.debugger.useWindbgDebugger, \
+    APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \
+    MACOSX_SIGNED := true, \
+))
 
-$(eval $(call SetupLauncher,jstat, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jstat, \
+    MAIN_CLASS := sun.tools.jstat.Jstat, \
+))
 
-$(eval $(call SetupLauncher,jcmd, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, jcmd, \
+    MAIN_CLASS := sun.tools.jcmd.JCmd, \
+))
--- a/make/launcher/Launcher-jdk.jconsole.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.jconsole.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -25,9 +25,10 @@
 
 include LauncherCommon.gmk
 
-BUILD_LAUNCHER_jconsole_CFLAGS_windows := -DJAVAW
-BUILD_LAUNCHER_jconsole_LIBS_windows := user32.lib
-
-$(eval $(call SetupLauncher,jconsole, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "-J-Djconsole.showOutputViewer"$(COMMA) "sun.tools.jconsole.JConsole"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/jconsole.jar"$(COMMA) "/lib/tools.jar"$(COMMA) "/classes" }'))
+$(eval $(call SetupBuildLauncher, jconsole, \
+    MAIN_CLASS := sun.tools.jconsole.JConsole, \
+    JAVA_ARGS := -Djconsole.showOutputViewer, \
+    APP_CLASSPATH := /lib/jconsole.jar /lib/tools.jar /classes, \
+    CFLAGS_windows := -DJAVAW, \
+    LIBS_windows := user32.lib, \
+))
--- a/make/launcher/Launcher-jdk.jdeps.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.jdeps.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -25,12 +25,14 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,javap, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, javap, \
+    MAIN_CLASS := com.sun.tools.javap.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
 
-$(eval $(call SetupLauncher,jdeps, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.jdeps.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jdeps, \
+    MAIN_CLASS := com.sun.tools.jdeps.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
--- a/make/launcher/Launcher-jdk.jdi.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.jdi.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,7 +25,7 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jdb, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
-
+$(eval $(call SetupBuildLauncher, jdb, \
+    MAIN_CLASS := com.sun.tools.example.debug.tty.TTY, \
+    APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \
+))
--- a/make/launcher/Launcher-jdk.jshell.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.jshell.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -25,7 +25,8 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jshell, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.internal.jshell.tool.JShellTool"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jshell, \
+    MAIN_CLASS := jdk.internal.jshell.tool.JShellTool, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
--- a/make/launcher/Launcher-jdk.jvmstat.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.jvmstat.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,6 +25,6 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jstatd, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, jstatd, \
+    MAIN_CLASS := sun.tools.jstatd.Jstatd, \
+))
--- a/make/launcher/Launcher-jdk.pack200.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.pack200.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -25,8 +25,9 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,pack200, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, pack200, \
+    MAIN_CLASS := com.sun.java.util.jar.pack.Driver, \
+))
 
 ################################################################################
 # The order of the object files on the link command line affects the size of the resulting
@@ -92,7 +93,7 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
     LIBS_solaris :=  -lc, \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe$(OUTPUT_SUBDIR), \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \
     OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
     PROGRAM := unpack200, \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
--- a/make/launcher/Launcher-jdk.policytool.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.policytool.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
 include LauncherCommon.gmk
 
 ifndef BUILD_HEADLESS_ONLY
-  $(eval $(call SetupLauncher,policytool, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
-      $(XLIBS)))
+  $(eval $(call SetupBuildLauncher, policytool, \
+      MAIN_CLASS := sun.security.tools.policytool.PolicyTool, \
+      LIBS_unix := $(X_LIBS), \
+  ))
 endif
--- a/make/launcher/Launcher-jdk.rmic.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.rmic.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,7 +25,7 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,rmic, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, rmic, \
+    MAIN_CLASS := sun.rmi.rmic.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \
+))
--- a/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,7 +25,7 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jjs, \
-    -DENABLE_ARG_FILES \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.nashorn.tools.jjs.Main"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, jjs, \
+    MAIN_CLASS := jdk.nashorn.tools.jjs.Main, \
+    CFLAGS := -DENABLE_ARG_FILES, \
+))
--- a/make/launcher/Launcher-jdk.xml.bind.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.xml.bind.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,9 +25,10 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,schemagen, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, schemagen, \
+    MAIN_CLASS := com.sun.tools.internal.jxc.SchemaGenerator, \
+))
 
-$(eval $(call SetupLauncher,xjc, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, xjc, \
+    MAIN_CLASS := com.sun.tools.internal.xjc.Driver, \
+))
--- a/make/launcher/Launcher-jdk.xml.ws.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/Launcher-jdk.xml.ws.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -25,9 +25,10 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,wsgen, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, wsgen, \
+    MAIN_CLASS := com.sun.tools.internal.ws.WsGen, \
+))
 
-$(eval $(call SetupLauncher,wsimport, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, wsimport, \
+    MAIN_CLASS := com.sun.tools.internal.ws.WsImport, \
+))
--- a/make/launcher/LauncherCommon.gmk	Wed Nov 04 14:06:45 2015 -0800
+++ b/make/launcher/LauncherCommon.gmk	Thu Nov 05 10:54:05 2015 +0100
@@ -28,28 +28,17 @@
 # Prepare the find cache.
 $(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
 
-# When building a legacy overlay image (on solaris 64 bit), the launchers
-# need to be built with a different rpath and a different output dir.
-ifeq ($(OVERLAY_IMAGES), true)
-  ORIGIN_ROOT := /../..
-  OUTPUT_SUBDIR := $(OPENJDK_TARGET_CPU_ISADIR)
-else
-  ORIGIN_ROOT := /..
-endif
-
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
 else
-  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
-endif
+  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
 
-#
-# Applications expect to be able to link against libjawt without invoking
-# System.loadLibrary("jawt") first. This was the behaviour described in the
-# devloper documentation of JAWT and what worked with OpenJDK6.
-#
-ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
-  ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR))
+  # Applications expect to be able to link against libjawt without invoking
+  # System.loadLibrary("jawt") first. This was the behaviour described in the
+  # devloper documentation of JAWT and what worked with OpenJDK6.
+  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
+    ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR))
+  endif
 endif
 
 LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher
@@ -61,51 +50,78 @@
 GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
 JAVA_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.rc
 MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher
-# Until the shuffle is permanent, we can't add this in configure
-CFLAGS_JDKEXE := $(filter-out %javavm/export, $(CFLAGS_JDKEXE))
-CFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \
-    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include
-CXXFLAGS_JDKEXE := $(filter-out %javavm/export, $(CXXFLAGS_JDKEXE))
-CXXFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \
-    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include
 JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest
 
-define SetupLauncher
-  # TODO: Fix mapfile on solaris. Won't work with ld as linker.
-  # Parameter 1 is the name of the launcher (java, javac, jar...)
-  # Parameter 2 is extra CFLAGS
-  # Parameter 3 is extra LDFLAGS
-  # Parameter 4 is extra LIBS_unix
-  # Parameter 5 is extra LIBS_windows
-  # Parameter 6 is optional Windows JLI library (full path)
-  # Parameter 7 is optional Windows resource (RC) flags
-  # Parameter 8 is optional Windows version resource file (.rc)
-  # Parameter 9 is different output dir
-  # Parameter 10 if set, link statically with c runtime on windows.
-  # Parameter 11 if set, override plist file on macosx.
-  $(call LogSetupMacroEntry,SetupLauncher($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11))
-  $(if $(13),$(error Internal makefile error: Too many arguments to SetupLauncher, please update CompileLaunchers.gmk))
+################################################################################
+# Build standard launcher.
 
-  $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
-  ifneq ($6, )
-    $1_WINDOWS_JLI_LIB := $6
-  endif
-  $1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE)
-  ifneq ($8, )
-    $1_VERSION_INFO_RESOURCE := $8
+# Setup make rules for building a standard launcher.
+#
+# 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. It is also
+# used as the name of the executable.
+#
+# Remaining parameters are named arguments. These include:
+# MAIN_CLASS   The Java main class to launch
+# JAVA_ARGS   Processed into a -DJAVA_ARGS C flag
+# APP_CLASSPATH   Processed into a -DAPP_CLASSPATH C flag
+# CFLAGS   Additional CFLAGS
+# CFLAGS_windows   Additional CFLAGS_windows
+# LIBS_unix   Additional LIBS_unix
+# LIBS_windows   Additional LIBS_windows
+# LDFLAGS_solaris Additional LDFLAGS_solaris
+# RC_FLAGS   Additional RC_FLAGS
+# MACOSX_SIGNED   On macosx, sign this binary
+# WINDOWS_STATIC_LINK   On windows, link statically with C runtime and libjli.
+# OPTIMIZATION   Override default optimization level (LOW)
+# OUTPUT_DIR   Override default output directory
+# VERSION_INFO_RESOURCE   Override default Windows resource file
+# NO_JAVA_MS   Do not add -ms8m to JAVA_ARGS.
+SetupBuildLauncher = $(NamedParamsMacroTemplate)
+define SetupBuildLauncherBody
+  # Setup default values (unless overridden)
+  ifeq ($$($1_VERSION_INFO_RESOURCE), )
+    $1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE)
   endif
 
-  $1_LDFLAGS := $3
+  ifeq ($$($1_OUTPUT_DIR), )
+    $1_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)
+  endif
+
+  ifeq ($$($1_OPTIMIZATION), )
+    $1_OPTIMIZATION := LOW
+  endif
+
+  ifneq ($$($1_NO_JAVA_MS), true)
+    # The norm is to append -ms8m, unless otherwise instructed.
+    $1_JAVA_ARGS += -ms8m
+  endif
+
+  ifneq ($$($1_JAVA_ARGS), )
+    $1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
+        $$(addprefix -J, $$($1_JAVA_ARGS)) $$($1_MAIN_CLASS), "$$a"$(COMMA) )) }'
+    $1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR)
+  endif
+
+  ifneq ($$($1_APP_CLASSPATH), )
+    $1_APP_CLASSPATH_STR := '{ $$(strip $$(foreach a, \
+        $$($1_APP_CLASSPATH), "$$a"$(COMMA) )) }'
+    # Remove the trailing comma
+    $1_APP_CLASSPATH_STR := $$(strip $$(subst $$(COMMA) }', }', \
+        $$($1_APP_CLASSPATH_STR)))
+    $1_CFLAGS += -DAPP_CLASSPATH=$$($1_APP_CLASSPATH_STR)
+  endif
+
   $1_LIBS :=
   ifeq ($(OPENJDK_TARGET_OS), macosx)
-    $1_PLIST_FILE := Info-cmdline.plist
-    ifneq ($(11), )
-      $1_PLIST_FILE := $(11)
-      ifneq ($$(findstring privileged, $$($1_PLIST_FILE)), )
+    ifeq ($$($1_MACOSX_SIGNED), true)
+      $1_PLIST_FILE := Info-privileged.plist
         $1_CODESIGN := true
-      endif
+    else
+      $1_PLIST_FILE := Info-cmdline.plist
     endif
 
+    $1_CFLAGS += -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
     $1_LDFLAGS += -Wl,-all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a \
         -sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE)
     $1_LIBS += -framework Cocoa -framework Security \
@@ -121,22 +137,12 @@
     $1_LIBS += -lz
   endif
 
-  $1_OUTPUT_DIR_ARG := $9
-  ifeq (, $$($1_OUTPUT_DIR_ARG))
-    $1_OUTPUT_DIR_ARG := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)
-  endif
-
-  # TODO: maybe it's better to move this if-statement out of this function
-  ifeq ($1, java)
-    $1_OPTIMIZATION_ARG := HIGH
-    $1_LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR)
+  ifeq ($$($1_WINDOWS_STATIC_LINK), true)
+    $1_CFLAGS += $(filter-out -MD, $(CFLAGS_JDKEXE))
+    $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib
   else
-    $1_OPTIMIZATION_ARG := LOW
-  endif
-
-  $1_CFLAGS := $(CFLAGS_JDKEXE)
-  ifeq ($(10), true)
-    $1_CFLAGS := $(filter-out -MD, $(CFLAGS_JDKEXE))
+    $1_CFLAGS += $(CFLAGS_JDKEXE)
+    $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
   endif
 
   # The linker on older SuSE distros (e.g. on SLES 10) complains with:
@@ -156,22 +162,23 @@
     endif
   endif
 
-  $(call SetupNativeCompilation,BUILD_LAUNCHER_$1, \
+  $$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \
       SRC := $(LAUNCHER_SRC), \
       INCLUDE_FILES := main.c, \
-      OPTIMIZATION := $$($1_OPTIMIZATION_ARG), \
+      OPTIMIZATION := $$($1_OPTIMIZATION), \
       CFLAGS := $$($1_CFLAGS) \
           $(LAUNCHER_CFLAGS) \
           -DFULL_VERSION='"$(FULL_VERSION)"' \
           -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
           -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
           -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
-          -DPROGNAME='"$1"' $(DPACKAGEPATH) \
-          $2, \
+          -DPROGNAME='"$1"' \
+          $$($1_CFLAGS), \
       CFLAGS_linux := -fPIC, \
       CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \
+      CFLAGS_windows := $$($1_CFLAGS_windows), \
       LDFLAGS := $(LDFLAGS_JDKEXE) \
-          $(ORIGIN_ARG) \
+          $$(ORIGIN_ARG) \
           $$($1_LDFLAGS), \
       LDFLAGS_linux := \
           $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)) \
@@ -182,27 +189,29 @@
           -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \
       MAPFILE := $$($1_MAPFILE), \
       LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \
-      LIBS_unix := $4, \
+      LIBS_unix := $$($1_LIBS_unix), \
       LIBS_linux := -lpthread -ljli $(LIBDL) -lc, \
       LIBS_solaris := -ljli -lthread $(LIBDL) -lc, \
       LIBS_windows := $$($1_WINDOWS_JLI_LIB) \
-          $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib $5, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs$(OUTPUT_SUBDIR), \
-      OUTPUT_DIR := $$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR), \
+          $(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), \
       PROGRAM := $1, \
       DEBUG_SYMBOLS := true, \
       VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $(RC_FLAGS) \
+      RC_FLAGS := $$(RC_FLAGS) \
           -D "JDK_FNAME=$1$(EXE_SUFFIX)" \
           -D "JDK_INTERNAL_NAME=$1" \
           -D "JDK_FTYPE=0x1L" \
-          $7, \
+          $$($1_RC_FLAGS), \
       MANIFEST := $(JAVA_MANIFEST), \
       MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \
       CODESIGN := $$($1_CODESIGN), \
-  )
+  ))
 
-  TARGETS += $$(BUILD_LAUNCHER_$1)
+  $1 += $$(BUILD_LAUNCHER_$1)
+  TARGETS += $$($1)
 
   ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
     $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
@@ -213,18 +222,3 @@
         $$($1_WINDOWS_JLI_LIB)
   endif
 endef
-
-##########################################################################################
-
-XLIBS := $(X_LIBS) -lX11
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  DPACKAGEPATH := -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
-  XLIBS :=
-endif
-
-JAVA_RC_FLAGS += -i $(JDK_TOPDIR)/src/java.base/windows/native/common
-ifdef OPENJDK
-  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/java.base/windows/native/launcher/icons"
-else
-  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons"
-endif