changeset 5905:4b8bb77fdda9

Merge
author lana
date Fri, 28 Sep 2012 10:54:12 -0700
parents ad467dee852a d94613ac03d8
children 3ac112755bb5
files make/common/Defs-embedded.gmk make/common/Release-embedded.gmk src/share/classes/sun/management/LockDataConverter.java src/share/classes/sun/management/LockDataConverterMXBean.java src/share/classes/sun/security/x509/CertificateIssuerUniqueIdentity.java src/share/classes/sun/security/x509/CertificateSubjectUniqueIdentity.java test/sun/misc/URLClassPath/ClassnameCharTest.sh test/sun/net/www/httptest/HttpServer.java test/sun/security/ssl/sun/net/www/httpstest/HttpServer.java
diffstat 180 files changed, 7961 insertions(+), 4771 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Sep 28 14:54:04 2012 +0400
+++ b/.hgtags	Fri Sep 28 10:54:12 2012 -0700
@@ -178,3 +178,4 @@
 70ad0ed1d6cef0e7712690d1bab21e4769708aad jdk8-b54
 1f3f4b333341873f00da3dee85e4879f0e89c9bb jdk8-b55
 2e9eeef2909b33c9224a024afddb61ccb0b77f14 jdk8-b56
+51594d095a4bcffac4a314bf6e148214501399e0 jdk8-b57
--- a/make/Makefile	Fri Sep 28 14:54:04 2012 +0400
+++ b/make/Makefile	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2012, 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,6 +29,7 @@
 #
 
 BUILDDIR=.
+
 include $(BUILDDIR)/common/Defs.gmk
 
 #
@@ -273,6 +274,7 @@
 # Release engineering targets.
 #
 include $(BUILDDIR)/common/Release.gmk
+-include $(CUSTOM_MAKE_DIR)/Release.gmk
 
 #
 # Cscope targets.
--- a/make/com/sun/java/pack/Makefile	Fri Sep 28 14:54:04 2012 +0400
+++ b/make/com/sun/java/pack/Makefile	Fri Sep 28 10:54:12 2012 -0700
@@ -159,7 +159,7 @@
 	$(prep-target)
 	$(RM) $(TEMPDIR)/mapfile-vers
 	$(CP) mapfile-vers-unpack200 $(TEMPDIR)/mapfile-vers
-	$(LINKER)  $(LDDFLAGS) $(UNPACK_EXE_FILES_o) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
+	$(LINKER)  $(LDDFLAGS) $(sort $(UNPACK_EXE_FILES_o)) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
 ifdef MT
 	$(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1
 endif
--- a/make/common/Defs-embedded.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-#
-# Copyright (c) 2011, 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.
-#
-
-#
-# Variable definitions for SE Embedded builds.  This file should
-# not contain rules.
-#
-ifdef JAVASE_EMBEDDED
-
-# Compress jar files
-COMPRESS_JARS = true
-
-# Don't mmap zip files
-LIBZIP_CAN_USE_MMAP = false
-
-# Disable ALSA version check
-REQUIRED_ALSA_VERSION =
-
-# Compilation settings
-OTHER_CPPFLAGS += -DJAVASE_EMBEDDED
-
-# Product naming
-PRODUCT_SUFFIX = SE Embedded Runtime Environment
-RUNTIME_NAME = $(PRODUCT_NAME) $(PRODUCT_SUFFIX)
-
-# Reduced JRE locations
-JRE_REDUCED_HEADLESS_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-headless-image
-JRE_REDUCED_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-image
-
-# Override on linux to further reduce binary/lib sizes in product build
-ifeq ($(PLATFORM), linux)
-  ifeq ($(VARIANT), OPT)
-    ifneq ($(NO_STRIP), true)
-      ifneq ($(DEBUG_BINARIES), true)
-        POST_STRIP_PROCESS = $(STRIP) --strip-unneeded
-      endif
-    endif
-  endif
-endif
-
-# NIO Platform specific source file location
-ifdef CROSS_COMPILE_ARCH
-  NIO_PLATFORM_CLASSES_ROOT_DIR = $(CLOSED_PLATFORM_SRC)/classes/
-endif
-
-# For ARM sflt we need to link to a library with improved FP accuracy
-# and it must be linked after fdlibm - this places it at the end after libc
-# -z muldefs avoids linker errors for duplicate symbols.
-ifeq ($(CROSS_COMPILE_ARCH), arm)
-  EXTRA_LIBS +=  $(EXT_LIBS_PATH)/sflt_glibc_jdk.a -Xlinker -z -Xlinker muldefs
-endif
-
-endif # JAVASE_EMBEDDED
-
--- a/make/common/Defs.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/make/common/Defs.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -109,6 +109,21 @@
   endif
 endif
 
+# We allow for potential specialization of build files. This has to be
+# done on a file-by-file, case-by-case basis. Here we define the basic control
+# over where custom files are being used. Later we will -include the custom
+# Defs.gmk if present. This works best because all Makefiles include defs.gmk.
+# In other cases we can either have foo.gmk include custom/foo.gmk, or
+# a Makefile can do:
+#  include foo.gmk
+#  -include $CUSTOM_MAKE_DIR/foo.gmk
+#
+# For non-OpenJDK builds the default location is the make/closed repository.
+# For OpenJDK builds a real value has to be supplied externally.
+ifneq ($(OPENJDK),true)
+  CUSTOM_MAKE_DIR = $(BUILDDIR)/closed
+endif
+
 #
 # Get platform definitions
 #
@@ -116,12 +131,6 @@
 include $(JDK_TOPDIR)/make/common/Defs-$(PLATFORM).gmk
 
 #
-# SE-Embedded support, if enabled
-#
-
-include $(JDK_TOPDIR)/make/common/Defs-embedded.gmk
-
-#
 # Cross-compilation Settings
 #
 ifdef CROSS_COMPILE_ARCH
@@ -611,4 +620,6 @@
 $(install-importonly-file)
 endef
 
+-include $(CUSTOM_MAKE_DIR)/Defs.gmk
+
 .PHONY: all build clean clobber
--- a/make/common/Release-embedded.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-#
-# Copyright (c) 2011, 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.
-#
-
-#
-# SE-Embedded Reduced JRE targets
-#
-ifdef JAVASE_EMBEDDED
-
-reduced-image-jre reduced-headless-image-jre ::
-	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
-
-# Add the reduced-jre images as pre-reqs. These will be processed last
-images:: reduced-image-jre reduced-headless-image-jre
-
-
-######################################################
-# Create the headless rt.jar
-######################################################
-
-NOT_HEADLESS_RT_JAR_LIST = $(ABS_TEMPDIR)/not_hl_rt_jar.list
-HEADLESS_RT_JAR_FILELIST=$(JARFILELISTS_TEMPDIR)/hl_rt_jar_list
-TOTAL_HEADLESS_JAR_FILELIST=$(REORDER_TEMPDIR)/hl_file_list
-HEADLESS_CLASSLIST=$(ABS_TEMPDIR)/headless_classlist
-
-# Add the jar file directories that we don't want in the
-# headless JRE.  If you want to remove most classes in a
-# directory, put the directory in the NOT_HEADLESS_RT_JAR_LIST
-# and put the individual classes you want to keep in the 
-# HEADLESS_CLASSLIST file. 
-$(NOT_HEADLESS_RT_JAR_LIST): $(NOT_RT_JAR_LIST)
-	$(RM) $(HEADLESS_CLASSLIST)
-	$(RM) $(NOT_HEADLESS_RT_JAR_LIST)
-	$(CP) $(NOT_RT_JAR_LIST) $(NOT_HEADLESS_RT_JAR_LIST)
-# List all the packages to be excluded
-	$(ECHO) "sun/awt/motif/" >> $@
-	$(ECHO) "sun/awt/X11/" >> $@
-	$(ECHO) "sun/applet/" >> $@
-	$(ECHO) "sun/java2d/opengl/" >> $@
-	$(ECHO) "com/sun/java/swing/plaf/" >> $@
-# List all the individual classes to be included
-	$(ECHO) "sun/awt/motif/MFontConfiguration.class" >$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/applet/AppContextCreator.class" >>$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/applet/AppletAudioClip.class" >>$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/java2d/opengl/GLXSurfaceData.class" >>$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/java2d/opengl/GLXSurfaceData"\$$"GLXOffScreenSurfaceData.class" >>$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/java2d/opengl/GLXVolatileSurfaceManager.class" >>$(HEADLESS_CLASSLIST)
-	$(ECHO) "sun/java2d/opengl/OGLSurfaceData.class" >>$(HEADLESS_CLASSLIST)
-
-
-$(TOTAL_HEADLESS_JAR_FILELIST): $(JARREORDER_JARFILE) $(NOT_HEADLESS_RT_JAR_LIST)
-	$(prep-target)
-	$(RM) $@.temp
-	$(CD) $(CLASSBINDIR) ; \
-		$(BOOT_JAVA_CMD) -jar $(JARREORDER_JARFILE) \
-		-o  $@.temp - $(NOT_HEADLESS_RT_JAR_LIST)  .
-# Add on the explicitly included class files from the otherwise excluded packages
-	$(CAT) $(HEADLESS_CLASSLIST) >> $@.temp
-	$(MV) $@.temp $@
-	@$(CD) $(CLASSBINDIR); $(java-vm-cleanup)
-
-# Create the headless rt.jar file list & non-class files list
-MakeHeadlessJarFileList: $(TOTAL_HEADLESS_JAR_FILELIST) $(JARSPLIT_JARFILE)
-	@$(RM) $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST)
-	$(BOOT_JAVA_CMD) -jar $(JARSPLIT_JARFILE) $(TOTAL_HEADLESS_JAR_FILELIST) \
-		-o  $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST)
-	@$(java-vm-cleanup)
-
-# Create headless rt.jar
-HL_RT_JAR=$(ABS_TEMPDIR)/rt-hl-orig.jar
-$(HL_RT_JAR): MakeHeadlessJarFileList $(RT_JAR_MANIFEST_FILE)
-	$(prep-target)
-	$(CD) $(CLASSBINDIR) ; \
-		$(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(RT_JAR_MANIFEST_FILE) $@ @$(HEADLESS_RT_JAR_FILELIST) \
-		 $(JAR_JFLAGS)
-	@$(CD) $(CLASSBINDIR); $(java-vm-cleanup)
-
-
-#
-# Produce a reduced Headful JRE for Embedded Devices
-#
-# The deployment binaries are added during the deployment build process
-#
-
-# Binaries that don't get included in reduced jre image bin directory
-NOT_REDUCEDJRE_BIN = \
- java_vm \
- kinit \
- klist \
- ktab \
- orbd \
- policytool \
- rmid \
- rmiregistry \
- servertool \
- tnameserv \
- pack200 \
- unpack200
-
-# jars/resources/libs that don't get included in reduced jre image lib directory
-NOT_REDUCEDJRE_LIB = \
- charsets.jar \
- ext/dnsns.jar \
- ext/localedata.jar \
- $(LIBARCH)/client/classes.jsa \
- $(LIBARCH)/libjavaplugin_jni.so \
- $(LIBARCH)/libjavaplugin_nscp_gcc29.so \
- $(LIBARCH)/libjavaplugin_nscp.so \
- $(LIBARCH)/libjavaplugin_oji.so
-
-# JRE docs that don't get included in reduced jre image top directory
-NOT_REDUCEDJRE_DOC = \
- Welcome.html
-
-reduced-image-jre::
-	@$(ECHO) Starting to Produce Reduced JRE
-	@#
-	@# First make a copy of the full JRE
-	@#
-	$(RM) -r $(JRE_REDUCED_IMAGE_DIR)
-	$(MKDIR) -p $(JRE_REDUCED_IMAGE_DIR)
-	$(CD) $(JRE_IMAGE_DIR); \
-	    $(TAR) cf - . | ($(CD) $(JRE_REDUCED_IMAGE_DIR); $(TAR) xf - ); 
-
-	@#
-	@# Remove all of the files that are not needed for the
-	@# reduced JRE
-	@#
-	for l in $(NOT_REDUCEDJRE_BIN) ; do \
-	    $(RM) $(JRE_REDUCED_IMAGE_DIR)/bin/$$l ; \
-	done
-	for l in $(NOT_REDUCEDJRE_LIB) ; do \
-	    $(RM) $(JRE_REDUCED_IMAGE_DIR)/lib/$$l ; \
-	done
-	for l in $(NOT_REDUCEDJRE_DOC) ; do \
-	    $(RM) $(JRE_REDUCED_IMAGE_DIR)/$$l ; \
-	done
-
-	@# Remove misc. other files
-	$(RM) -r $(JRE_REDUCED_IMAGE_DIR)/man
-	$(RM) -f $(JRE_REDUCED_IMAGE_DIR)/CHANGES
-
-	@$(ECHO) Done Creating Reduced JRE
-
-#
-# Produce a reduced Headless JRE
-#
-reduced-headless-image-jre:: $(RT_JAR) $(RESOURCES_JAR) $(BUILD_META_INDEX) $(HL_RT_JAR)
-	@$(ECHO) Starting to Produce Reduced Headless JRE
-	@#
-	@# First make a copy of the reduced JRE we just built
-	@#
-	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
-	$(MKDIR) -p $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
-	$(CD) $(JRE_REDUCED_IMAGE_DIR); \
-	    $(TAR) cf - . | ($(CD) $(JRE_REDUCED_HEADLESS_IMAGE_DIR); $(TAR) xf - ); 
-
-	@# Replace the full rt.jar with the headless rt.jar
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar
-	$(CP) $(HL_RT_JAR) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar
-
-	@#
-	@# Remove all of the files that are not needed for the
-	@# reduced Headless JRE
-	@#
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/gtkhelper
-	$(RM)  $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libjsoundalsa.so
-	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/audio
-	$(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/applet
-	$(RM)  $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/awt_robot
-	$(RM)  $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libawt_xawt.so
-	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libsplashscreen.so
-	@# Remove oblique fonts and reduce font support to LucidaSansRegular only
-	$(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/oblique-fonts
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiBold.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiItalic.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightItalic.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightRegular.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaSansDemiBold.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterBold.ttf
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterRegular.ttf
-
-ifeq ($(PLATFORM), linux)
-# put out minimal fonts.dir file for the remaining font
-	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) 6>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-2">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-4">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-5">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-7">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-9">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
-
-endif # Linux
-
-	@#
-	@# all done with JRE reduced headless image
-	@#
-
-	@$(ECHO) Done Creating Reduced Headless JRE
-
-images-clobber::
-	$(RM) -r $(JRE_REDUCED_IMAGE_DIR)
-	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
-
-.PHONY: reduced-image-jre reduced-headless-image-jre 
-
-endif # JAVASE_EMBEDDED
-
--- a/make/common/Release.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/make/common/Release.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -750,10 +750,6 @@
 
 BUILDMETAINDEX_JARFILE = $(ABS_BUILDTOOLJARDIR)/buildmetaindex.jar
 
-# SE-Embedded targets if enabled
-include $(JDK_TOPDIR)/make/common/Release-embedded.gmk
-
-
 ######################################################
 # JRE Image
 ######################################################
--- a/make/common/shared/Defs.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/make/common/shared/Defs.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -609,14 +609,18 @@
 #  2) ant attempts to detect JDK location based on java.exe location
 #     This is fragile as developer may have JRE first on the PATH. 
 #     To workaround this we will specify JAVA_HOME explicitly
+#  3) Sometimes we need to run ant with the boot jdk, sometimes with the import
+#     jdk, sometimes with the jdk we are building (see deploy repo).
 
 ANT_TMPDIR = $(ABS_OUTPUTDIR)/tmp
-ANT_WORKAROUNDS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)' JAVA_HOME='$(BOOTDIR)'
+ANT_WORKAROUNDS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)'
 
 ifeq ($(ANT_HOME),)
-  ANT = $(ANT_WORKAROUNDS) ant
+  ANT = $(ANT_WORKAROUNDS) JAVA_HOME='$(BOOTDIR)' ant
+  ANT_WITH_IMPORT = $(ANT_WORKAROUNDS) JAVA_HOME='$(JDK_IMPORT_PATH)' ant
 else
-  ANT = $(ANT_WORKAROUNDS) $(ANT_HOME)/bin/ant
+  ANT = $(ANT_WORKAROUNDS) JAVA_HOME='$(BOOTDIR)' $(ANT_HOME)/bin/ant
+  ANT_WITH_IMPORT = $(ANT_WORKAROUNDS) JAVA_HOME='$(JDK_IMPORT_PATH)' $(ANT_HOME)/bin/ant
 endif
 
 ifdef ALT_COPYRIGHT_YEAR
--- a/make/java/jli/Makefile	Fri Sep 28 14:54:04 2012 +0400
+++ b/make/java/jli/Makefile	Fri Sep 28 10:54:12 2012 -0700
@@ -190,7 +190,7 @@
 
   $(STATIC_LIBRARY): $(FILES_o)
 	@$(prep-target)
-	$(LIBEXE) -nologo -out:$@ $(FILES_o)
+	$(LIBEXE) -nologo -out:$@ $(sort $(FILES_o))
 
   library:: $(STATIC_LIBRARY)
 endif # PLATFORM
@@ -216,7 +216,7 @@
 
 $(STATIC_LIBRARY): $(STATIC_LIBRARY_DIR)
 	@$(prep-target)
-	$(AR) $(ARFLAGS) $@ $(FILES_o)
+	$(AR) $(ARFLAGS) $@ $(sort $(FILES_o))
 
 library:: $(STATIC_LIBRARY)
 
--- a/make/java/jobjc/Makefile	Fri Sep 28 14:54:04 2012 +0400
+++ b/make/java/jobjc/Makefile	Fri Sep 28 10:54:12 2012 -0700
@@ -62,15 +62,22 @@
 ABS_OUTPUTDIR=$(realpath $(OUTPUTDIR))
 ABS_STABLE_GEN_DIR=$(realpath $(STABLE_GEN_DIR))
 
+# How to run ant
+ifdef LANGTOOLS_DIST
+  ANT_CMD = $(ANT)
+else
+  ANT_CMD = $(ANT_WITH_IMPORT)
+endif
+
 $(BUILT_DYLIB) $(BUILT_JAR): $(STABLE_METADATA_FILES) $(CORE_SRC) $(GENERATOR_SRC) $(ADDITIONS_SRC) $(BUILD_SRC)
 	@echo JObjC dylib or jar out of data wrt FRAMEWORKS '(' $(FRAMEWORKS) ')' or JObjC source '(' core, generator, additions, build ')'
 	@echo Running ant with java_home set to ${ALT_BOOTDIR}
-	(cd $(SRCDIR); OBJROOT="$(ABS_OUTPUTDIR)/JObjC.build" DSTROOT="$(ABS_OUTPUTDIR)/JObjC.dst" JAVA_HOME=${ALT_BOOTDIR} STABLE_GEN_DIR="$(ABS_STABLE_GEN_DIR)" /usr/bin/ant -verbose all)
+	(cd $(SRCDIR); OBJROOT="$(ABS_OUTPUTDIR)/JObjC.build" DSTROOT="$(ABS_OUTPUTDIR)/JObjC.dst" JAVA_HOME=${ALT_BOOTDIR} STABLE_GEN_DIR="$(ABS_STABLE_GEN_DIR)" $(ANT_CMD) -verbose all)
 
 all: $(BUILD_DYLIB) $(BUILT_JAR)
 	$(CP) $(BUILT_DYLIB) $(LIB_LOCATION)/libJObjC.dylib
 
 clean clobber::
-	(cd $(SRCDIR); export OBJROOT=$(OUTPUTDIR)/JObjC.build; export DSTROOT=$(OUTPUTDIR)/JObjC.dst; /usr/bin/ant clean)
+	(cd $(SRCDIR); export OBJROOT=$(OUTPUTDIR)/JObjC.build; export DSTROOT=$(OUTPUTDIR)/JObjC.dst; $(ANT_CMD) clean)
 
 endif
--- a/makefiles/CompileDemos.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/CompileDemos.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -44,10 +44,11 @@
 
 define SetupAppletDemo
      $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_APPLET_$1,\
-                SETUP:=GENERATE_USINGJDKBYTECODE$2,\
+                SETUP:=GENERATE_USINGJDKBYTECODE,\
 		SRC:=$(JDK_TOPDIR)/src/$3share/demo/applets/$1,\
-		BIN:=$(JDK_OUTPUTDIR)/newdemo/applets/$1,\
-		COPY:=.html .java .xyz .obj .au .gif))
+		BIN:=$(JDK_OUTPUTDIR)/demo/applets/$1,\
+		COPY:=.html .java .xyz .obj .au .gif,\
+		DISABLE_SJAVAC:=$2))
      BUILD_DEMOS += $$(BUILD_DEMO_APPLET_$1)
 endef
 
@@ -67,11 +68,11 @@
 $(eval $(call SetupAppletDemo,SpreadSheet))
 # Build WireFrame without a server since it
 # has a class Matrix3D that also exists in MoleculeViewer.
-$(eval $(call SetupAppletDemo,WireFrame,_NOSERV))
+$(eval $(call SetupAppletDemo,WireFrame,true))
 
 ifndef OPENJDK
     $(eval $(call SetupAppletDemo,Animator,,closed/))
-    $(eval $(call SetupAppletDemo,GraphLayout,_NOSERV,closed/))
+    $(eval $(call SetupAppletDemo,GraphLayout,true,closed/))
     $(eval $(call SetupAppletDemo,JumpingBox,,closed/))
     $(eval $(call SetupAppletDemo,TicTacToe,,closed/))
 endif
@@ -111,29 +112,30 @@
 
     ifneq ($$($1_JAVA_FILES_EXIST),)
         $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_$1,\
-                SETUP:=GENERATE_USINGJDKBYTECODE$(12),\
+                SETUP:=GENERATE_USINGJDKBYTECODE,\
                 ADD_JAVAC_FLAGS:=$3,\
 		SRC:=$$($1_MAIN_SRC) $5,\
-		BIN:=$(JDK_OUTPUTDIR)/newdemoclasses/$2/$1,\
+		BIN:=$(JDK_OUTPUTDIR)/democlasses/$2/$1,\
 		COPY:=$(PATTERNS_TO_COPY) $(10),\
-		JAR:=$(JDK_OUTPUTDIR)/newdemo/$2/$1/$$($1_JARFILE),\
+		JAR:=$(JDK_OUTPUTDIR)/demo/$2/$1/$$($1_JARFILE),\
 		JARMAIN:=$4,\
 		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf,\
 		EXTRA_MANIFEST_ATTR:=$(11),\
-		SRCZIP:=$(JDK_OUTPUTDIR)/newdemo/$2/$1/src.zip,\
-		EXCLUDE_FILES:=$9))
+		SRCZIP:=$(JDK_OUTPUTDIR)/demo/$2/$1/src.zip,\
+		EXCLUDE_FILES:=$9,\
+		DISABLE_SJAVAC:=$(12)))
 
         BUILD_DEMOS +=  $$(BUILD_DEMO_$1) \
-			$(JDK_OUTPUTDIR)/newdemo/$2/$1/$$($1_JARFILE) \
-			$(JDK_OUTPUTDIR)/newdemo/$2/$1/src.zip 
+			$(JDK_OUTPUTDIR)/demo/$2/$1/$$($1_JARFILE) \
+			$(JDK_OUTPUTDIR)/demo/$2/$1/src.zip 
     endif
 
     # Copy files.
     $1_COPY_TARGETS :=  $$(patsubst $(JDK_TOPDIR)/src/$6share/demo/$2/$1/%,\
-			$(JDK_OUTPUTDIR)/newdemo/$2/$1/%,\
+			$(JDK_OUTPUTDIR)/demo/$2/$1/%,\
 			$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/$6share/demo/$2/$1/,$7)))
     ifneq ($7,)
-        $(JDK_OUTPUTDIR)/newdemo/$2/$1/% : $(JDK_TOPDIR)/src/$6share/demo/$2/$1/%
+        $(JDK_OUTPUTDIR)/demo/$2/$1/% : $(JDK_TOPDIR)/src/$6share/demo/$2/$1/%
 		$(MKDIR) -p $$(@D)
 		$(CP) $$< $$@
 		$(CHMOD) -f ug+w $$@
@@ -144,20 +146,20 @@
 endef
 
 $(eval $(call SetupDemo,CodePointIM,jfc,,CodePointIM,,,*.html))
-$(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/_the.services : \
-			$(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/CodePointIM.jar \
+$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services : \
+			$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar \
 			$(JDK_TOPDIR)/src/share/demo/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor
-	(cd $(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM && \
+	(cd $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM && \
 		$(MKDIR) -p _the.tmp/META-INF/services && \
 		$(CP) $(JDK_TOPDIR)/src/share/demo/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor _the.tmp/META-INF/services && \
 		cd _the.tmp && \
-		$(JAR) uf $(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/CodePointIM.jar META-INF/services/java.awt.im.spi.InputMethodDescriptor && \
+		$(JAR) uf $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar META-INF/services/java.awt.im.spi.InputMethodDescriptor && \
 		cd META-INF/services && \
-		$(JAR) uf $(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/CodePointIM.jar java.awt.im.spi.InputMethodDescriptor)
-	$(RM) -r $(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/_the.tmp
+		$(JAR) uf $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar java.awt.im.spi.InputMethodDescriptor)
+	$(RM) -r $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.tmp
 	$(TOUCH) $@
 
-BUILD_DEMOS+=$(JDK_OUTPUTDIR)/newdemo/jfc/CodePointIM/_the.services
+BUILD_DEMOS+=$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services
 
 $(eval $(call SetupDemo,FileChooserDemo,jfc,,FileChooserDemo,,,README*))
 $(eval $(call SetupDemo,Font2DTest,jfc,,Font2DTest,,,*.html *.txt))
@@ -182,12 +184,12 @@
     $(eval $(call SetupDemo,Stylepad,jfc,,Stylepad,\
 		$(JDK_TOPDIR)/src/share/demo/jfc/Notepad,closed/,*.txt,,$(JDK_TOPDIR)/src/share/demo/jfc/Notepad/README.txt))
     $(eval $(call SetupDemo,SwingSet2,jfc,,SwingSet2,,closed/,README* *.html,,,.java COPYRIGHT,\
-		SplashScreen-Image: resources/images/splash.png,_NOSERV))
+		SplashScreen-Image: resources/images/splash.png,true))
 
     BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%,\
-			$(JDK_OUTPUTDIR)/newdemo/nbproject/%,\
+			$(JDK_OUTPUTDIR)/demo/nbproject/%,\
 			$(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/demo/nbproject/ -type f))
-    $(JDK_OUTPUTDIR)/newdemo/nbproject/% : $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%
+    $(JDK_OUTPUTDIR)/demo/nbproject/% : $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
@@ -196,7 +198,7 @@
 ##################################################################################################
 
 # Why do we install a demo jar into the main jre/lib/ext????????????????
-$(JDK_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/newdemo/nio/zipfs/zipfs.jar
+$(JDK_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 
@@ -207,52 +209,74 @@
 # In the old makefiles, j2dbench was not compiled. 
 #$(eval $(call SetupDemo,J2DBench,java2d,/src,,j2dbench/J2DBench))
 
+# JVMTI demos are a bit strange and share some files, but be careful the
+#    shared files are just the *.c and *.h files, not the README or sample
+#    makefiles. So we always exclude the README.txt and sample.makefile.txt
+#    from the extra sources.
 define SetupJVMTIDemo
      # Param 1 = Name of the demo
      # Param 2 = add these directories to the includes, default is agent_util
      # Param 3 = extra CFLAGS
      # Param 4 = C or C++ (defaults to C)
      # Param 5 = libs for posix
-     # Param 6 = libs for winapi
+     # Param 6 = libs for windows
      # Param 7 = libs for solaris
-     BUILD_DEMO_JVMTI_$1_EXTRA_SRC:=	$$(wildcard $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/demo/jvmti/$1) \
-					$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2))
+     BUILD_DEMO_JVMTI_$1_EXTRA_SRC:= \
+        $$(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/demo/jvmti/$1) \
+	$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2))
+     BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE:= \
+	$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2)/README.txt) \
+	$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2)/sample.makefile.txt)
      BUILD_DEMO_JVMTI_$1_EXTRA_INC:=$$(addprefix -I,$$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC))
      BUILD_DEMO_JVMTI_$1_LANG:=C
-     BUILD_DEMO_JVMTI_$1_O_FLAG:=$(C_O_FLAG_NORM)
      ifneq (,$4)
          BUILD_DEMO_JVMTI_$1_LANG:=$4
      endif
      ifeq (C++,$4)
-         $1_EXTRA_CXX:=$(LIBCXX)
-         BUILD_DEMO_JVMTI_$1_O_FLAG:=$(CXX_O_FLAG_NORM)
+         $1_EXTRA_CXX:=$(LDFLAGS_CXX_JDK) $(LIBCXX)
      endif
 
-     $1_CXXFLAGS:=$(CXXFLAGS_JDKLIB) $$(BUILD_DEMO_JVMTI_$1_O_FLAG) -I$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3
+     $1_CXXFLAGS:=$(CXXFLAGS_JDKLIB) -I$(JDK_TOPDIR)/src/share/demo/jvmti/$1 \
+		  $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3 \
+		  $(CXXFLAGS_DEBUG_SYMBOLS)
      ifeq ($1-$(OPENJDK_TARGET_CPU_ARCH),waiters-sparc)
-       $1_FILTER:=-xregs=no%appl
-       $1_CXXFLAGS:=$$(filter-out $$($1_FILTER),$$($1_CXXFLAGS))
+         $1_FILTER:=-xregs=no%appl
+         $1_CXXFLAGS:=$$(filter-out $$($1_FILTER),$$($1_CXXFLAGS))
      endif
 
+     # Workaround for CFLAGS_JDKLIB containing ',' on solaris. If this is added as 'CFLAGS' to the
+     # eval call below, the comma gets expanded too early.
+     BUILD_DEMO_JVMTI_$1_CFLAGS:=$(CFLAGS_JDKLIB) $(CFLAGS_DEBUG_SYMBOLS) \
+		-I$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3
+
+     # Remove the -incremental:no setting to get .ilk-files like in the old build.
      $$(eval $$(call SetupNativeCompilation,BUILD_DEMO_JVMTI_$1,\
 		SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC),\
 		LANG:=$$(BUILD_DEMO_JVMTI_$1_LANG),\
-		CFLAGS:=$(CFLAGS_JDKLIB) $$(BUILD_DEMO_JVMTI_$1_O_FLAG) -I$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3,\
+		OPTIMIZATION:=LOW,\
 		CXXFLAGS:=$$($1_CXXFLAGS),\
-		LDFLAGS:=$(LDFLAGS_JDKLIB),\
+		LDFLAGS:=$(filter-out -incremental:no -opt:ref,$(LDFLAGS_JDKLIB)),\
+		LDFLAGS_macosx:=$(call SET_EXECUTABLE_ORIGIN),\
 		LDFLAGS_SUFFIX:=$$($1_EXTRA_CXX),\
 		LDFLAGS_SUFFIX_posix:=$5,\
-		LDFLAGS_SUFFIX_winapi:=$6,\
-		LDFLAGS_SUFFIX_solaris:=-lc $7,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/newdemoobjs/jvmti/$1,\
-		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/newdemo/jvmti/$1/lib,\
+		LDFLAGS_SUFFIX_windows:=$6,\
+		LDFLAGS_SUFFIX_solaris:=$7 -lc,\
+		LDFLAGS_SUFFIX_linux:=$8,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$$(RC_FLAGS) \
+			  /D "JDK_FNAME=$1.dll" \
+			  /D "JDK_INTERNAL_NAME=$1" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/demoobjs/jvmti/$1,\
+		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/demo/jvmti/$1/lib,\
 		LIBRARY:=$1))
 
     $$(eval $$(call SetupZipArchive,BUILD_DEMO_JVMTI_SRC_$1,\
 		SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC),\
-		ZIP:=$(JDK_OUTPUTDIR)/newdemo/jvmti/$1/src.zip))
+		EXCLUDE_FILES:=$$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE), \
+		ZIP:=$(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip))
 
-     $(JDK_OUTPUTDIR)/newdemo/jvmti/$1/README.txt : $(JDK_TOPDIR)/src/share/demo/jvmti/$1/README.txt
+     $(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt : $(JDK_TOPDIR)/src/share/demo/jvmti/$1/README.txt
 		$(MKDIR) -p $$(@D)
 		$(CP) $$< $$@
 		$(CHMOD) -f ug+w $$@
@@ -261,29 +285,40 @@
          $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_JVMTI_$1_JAVA,\
                 SETUP:=GENERATE_USINGJDKBYTECODE,\
 		SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/$1,\
-		BIN:=$(JDK_OUTPUTDIR)/newdemoclasses/jvmti/$1,\
+		BIN:=$(JDK_OUTPUTDIR)/democlasses/jvmti/$1,\
 		COPY:=$(PATTERNS_TO_COPY),\
-		JAR:=$(JDK_OUTPUTDIR)/newdemo/jvmti/$1/$1.jar,\
+		JAR:=$(JDK_OUTPUTDIR)/demo/jvmti/$1/$1.jar,\
 		EXTRA_MANIFEST_ATTR:=Main-Class: \n,\
 		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf))
 
-         BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/jvmti/$1/$1.jar
+         BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jvmti/$1/$1.jar
      endif
 
      BUILD_DEMOS += 	$$(BUILD_DEMO_JVMTI_$1) \
-			$(JDK_OUTPUTDIR)/newdemo/jvmti/$1/src.zip \
-			$(JDK_OUTPUTDIR)/newdemo/jvmti/$1/README.txt
+			$(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip \
+			$(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt
+
+     ifeq ($(OPENJDK_TARGET_OS),windows)
+         # These files normally end up in OBJECT_DIR but for demos they
+         # are supposed to be included in the distro.
+         $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.lib: $$(BUILD_DEMO_JVMTI_$1)
+		$(CP) $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1/$1.lib $$@
+
+         $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.exp: $$(BUILD_DEMO_JVMTI_$1)
+		$(CP) $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1/$1.exp $$@
+
+         BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.lib \
+			$(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.exp
+     endif
 endef
 
 $(eval $(call SetupJVMTIDemo,compiledMethodLoad,	agent_util))
 $(eval $(call SetupJVMTIDemo,gctest,			agent_util))
 $(eval $(call SetupJVMTIDemo,heapTracker,		agent_util java_crw_demo))
 $(eval $(call SetupJVMTIDemo,heapViewer,		agent_util))
-# hprof contains error messages using __FILE__ macro. These expand to the absolute path
-# in the new build system and relative in the old, causing the binaries to differ.
 $(eval $(call SetupJVMTIDemo,hprof,			java_crw_demo,\
-		-I$(JDK_TOPDIR)/src/share/npt -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/npt,C,\
-		-ldl,ws2_32.lib winmm.lib,-lsocket -lnsl))
+		-I$(JDK_TOPDIR)/src/share/npt -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt,C,\
+		-ldl,ws2_32.lib winmm.lib,-lsocket -lnsl,-lpthread))
 
 $(eval $(call SetupJVMTIDemo,minst,			agent_util java_crw_demo))
 $(eval $(call SetupJVMTIDemo,mtrace,			agent_util java_crw_demo))
@@ -298,11 +333,11 @@
 # The number of files are few enough so that we can use echo safely below to list them.
 JPDA_FILES:=$(subst $(JDK_TOPDIR)/src/share/classes/,,$(JPDA_SOURCES))
 
-$(JDK_OUTPUTDIR)/newdemo/jpda/src.zip : $(JPDA_SOURCES)
+$(JDK_OUTPUTDIR)/demo/jpda/src.zip : $(JPDA_SOURCES)
 		$(MKDIR) -p $(@D)
 		(cd $(JDK_TOPDIR)/src/share/classes && $(ZIP) -qru $@ com -i "com/sun/tools/example/*")
 
-$(JDK_OUTPUTDIR)/newdemo/jpda/examples.jar : $(JPDA_SOURCES)
+$(JDK_OUTPUTDIR)/demo/jpda/examples.jar : $(JPDA_SOURCES)
 		$(MKDIR) -p $(@D)
 		$(RM) $(@D)/_the.sources
 		$(call ListPathsSafely,JPDA_FILES,\n, >> $(@D)/_the.sources)
@@ -312,103 +347,104 @@
 		(cd $(JDK_TOPDIR)/src/share/classes && $(JAR) cfm  $@ $(@D)/_the.manifest @$(@D)/_the.sources)
 		(cd $(JDK_TOPDIR)/src/share/classes/com/sun/tools/example && $(JAR) uf $@ README)
 
-$(JDK_OUTPUTDIR)/newdemo/jpda/com/sun/tools/example/README : $(JDK_TOPDIR)/src/share/classes/com/sun/tools/example/README
+$(JDK_OUTPUTDIR)/demo/jpda/com/sun/tools/example/README : $(JDK_TOPDIR)/src/share/classes/com/sun/tools/example/README
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/jpda/src.zip $(JDK_OUTPUTDIR)/newdemo/jpda/examples.jar \
-		$(JDK_OUTPUTDIR)/newdemo/jpda/com/sun/tools/example/README
+BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jpda/src.zip $(JDK_OUTPUTDIR)/demo/jpda/examples.jar \
+		$(JDK_OUTPUTDIR)/demo/jpda/com/sun/tools/example/README
 
 ##################################################################################################
 
-$(JDK_OUTPUTDIR)/newdemo/management/index.html : $(JDK_TOPDIR)/src/share/demo/management/index.html
+$(JDK_OUTPUTDIR)/demo/management/index.html : $(JDK_TOPDIR)/src/share/demo/management/index.html
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
 
-$(JDK_OUTPUTDIR)/newdemo/jvmti/index.html : $(JDK_TOPDIR)/src/share/demo/jvmti/index.html
+$(JDK_OUTPUTDIR)/demo/jvmti/index.html : $(JDK_TOPDIR)/src/share/demo/jvmti/index.html
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/management/index.html \
-		$(JDK_OUTPUTDIR)/newdemo/jvmti/index.html
+BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/management/index.html \
+		$(JDK_OUTPUTDIR)/demo/jvmti/index.html
 
 ##################################################################################################
 
 # The netbeans project files are copied into the demo directory.
 BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/share/demo/nbproject/%,\
-		$(JDK_OUTPUTDIR)/newdemo/nbproject/%,\
+		$(JDK_OUTPUTDIR)/demo/nbproject/%,\
 		$(shell $(FIND) $(JDK_TOPDIR)/src/share/demo/nbproject/ -type f))
 
-$(JDK_OUTPUTDIR)/newdemo/nbproject/% : $(JDK_TOPDIR)/src/share/demo/nbproject/%
+$(JDK_OUTPUTDIR)/demo/nbproject/% : $(JDK_TOPDIR)/src/share/demo/nbproject/%
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 	$(CHMOD) -f ug+w $@
 
 ##################################################################################################
 
-$(JDK_OUTPUTDIR)/newdemo/README: $(JDK_TOPDIR)/src/share/demo/README
+$(JDK_OUTPUTDIR)/demo/README: $(JDK_TOPDIR)/src/share/demo/README
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/README
+BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/README
 
 ##################################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
 
-$(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller/% : $(JDK_TOPDIR)/src/solaris/demo/jni/Poller/%
+$(JDK_OUTPUTDIR)/democlasses/jni/Poller/% : $(JDK_TOPDIR)/src/solaris/demo/jni/Poller/%
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
 
-$(JDK_OUTPUTDIR)/newdemo/jni/Poller/README.txt : $(JDK_TOPDIR)/src/solaris/demo/jni/Poller/README.txt
+$(JDK_OUTPUTDIR)/demo/jni/Poller/README.txt : $(JDK_TOPDIR)/src/solaris/demo/jni/Poller/README.txt
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
 		$(CHMOD) -f ug+w $@
 
-$(JDK_OUTPUTDIR)/newdemo/jni/Poller/Poller.jar : \
-  $(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller/README.txt $(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller/Poller.c
+$(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar : \
+  $(JDK_OUTPUTDIR)/democlasses/jni/Poller/README.txt $(JDK_OUTPUTDIR)/democlasses/jni/Poller/Poller.c
 
 $(eval $(call SetupJavaCompilation,BUILD_DEMO_POLLER_JAR,\
 		SETUP:=GENERATE_USINGJDKBYTECODE, \
 		SRC:=$(JDK_TOPDIR)/src/solaris/demo/jni/Poller, \
-		BIN:=$(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller, \
-		HEADERS:=$(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller, \
-		JAR:=$(JDK_OUTPUTDIR)/newdemo/jni/Poller/Poller.jar, \
+		BIN:=$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
+		HEADERS:=$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
+		JAR:=$(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar, \
 		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf, \
-		SRCZIP:=$(JDK_OUTPUTDIR)/newdemo/jni/Poller/src.zip, \
-		COPY := README.txt Poller.c, \
-		JARMAIN := Client))
+		SRCZIP:=$(JDK_OUTPUTDIR)/demo/jni/Poller/src.zip, \
+		COPY:=README.txt Poller.c, \
+		JARMAIN:=Client))
 
 
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/jni/Poller/Poller.jar $(JDK_OUTPUTDIR)/newdemo/jni/Poller/src.zip \
-               $(JDK_OUTPUTDIR)/newdemo/jni/Poller/README.txt
+BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar $(JDK_OUTPUTDIR)/demo/jni/Poller/src.zip \
+               $(JDK_OUTPUTDIR)/demo/jni/Poller/README.txt
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBPOLLER,\
 		SRC:=$(JDK_TOPDIR)/src/solaris/demo/jni/Poller, \
-		LANG := C, \
-		CFLAGS:=$(CFLAGS_JDKLIB) $(C_O_FLAG_NORM) $(SHARED_LIBRARY_FLAGS) \
-                        -I$(JDK_OUTPUTDIR)/newdemoclasses/jni/Poller, \
+		LANG:=C,\
+		OPTIMIZATION:=LOW,\
+		CFLAGS:=$(CFLAGS_JDKLIB) $(SHARED_LIBRARY_FLAGS) \
+                        -I$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB), \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/newdemoobjs/jni/Poller,\
-                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/newdemoobjs, \
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/demoobjs/jni/Poller,\
+                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/demoobjs, \
 		LIBRARY:=Poller))
 
 #
 # We can only compile native code after jar has been build (since we depend on generated .h files)
 #
-$(JDK_OUTPUTDIR)/newdemoobjs/jni/Poller/Poller.o : $(JDK_OUTPUTDIR)/newdemo/jni/Poller/Poller.jar
+$(JDK_OUTPUTDIR)/demoobjs/jni/Poller/Poller.o : $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar
 
-$(JDK_OUTPUTDIR)/newdemo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX) : \
-  $(JDK_OUTPUTDIR)/newdemoobjs/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
+$(JDK_OUTPUTDIR)/demo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX) : \
+  $(JDK_OUTPUTDIR)/demoobjs/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
+BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
 
 endif
 
@@ -417,20 +453,20 @@
 ifndef OPENJDK
     DB_DEMO_ZIPFILE := $(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/db -name "*demo*.zip")
 
-    $(JDK_OUTPUTDIR)/newdemo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
+    $(JDK_OUTPUTDIR)/demo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
 	$(MKDIR) -p $(@D)
-	$(RM) -rf $(JDK_OUTPUTDIR)/newdemo/db $(JDK_OUTPUTDIR)/newdemo/demo
-	$(CD) $(JDK_OUTPUTDIR)/newdemo && $(UNZIP) -o $<
-	$(MV) $(JDK_OUTPUTDIR)/newdemo/demo $(JDK_OUTPUTDIR)/newdemo/db
+	$(RM) -r $(JDK_OUTPUTDIR)/demo/db $(JDK_OUTPUTDIR)/demo/demo
+	$(CD) $(JDK_OUTPUTDIR)/demo && $(UNZIP) -o $<
+	$(MV) $(JDK_OUTPUTDIR)/demo/demo $(JDK_OUTPUTDIR)/demo/db
 	$(TOUCH) $@
 
 #    Copy this after the unzip above to avoid race with directory creation and mv command.
-     $(JDK_OUTPUTDIR)/newdemo/db/README-JDK-DEMOS.html: \
+     $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html: \
 		$(JDK_TOPDIR)/src/closed/share/db/README-JDK-DEMOS.html \
-		| $(JDK_OUTPUTDIR)/newdemo/_the.db.unzipped
+		| $(JDK_OUTPUTDIR)/demo/_the.db.unzipped
 	$(MKDIR) -p $(@D)
 	$(CP) '$<' '$@'
-     BUILD_DEMOS += $(JDK_OUTPUTDIR)/newdemo/_the.db.unzipped $(JDK_OUTPUTDIR)/newdemo/db/README-JDK-DEMOS.html
+     BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/_the.db.unzipped $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html
 endif
 
 ##################################################################################################
--- a/makefiles/CompileJavaClasses.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/CompileJavaClasses.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -45,10 +45,6 @@
 		com/sun/tools/example/debug/gui \
 		com/oracle/security
 
-ifeq ($(OPENJDK_TARGET_OS)-$(ARCH_DATA_MODEL),windows-64)
-     EXCLUDES += sun/security/pkcs11
-endif
-
 ifdef OPENJDK
     EXCLUDES+=	sun/dc \
 		com/sun/jmx/snmp \
@@ -59,6 +55,13 @@
 ifndef OPENJDK
    # There exists two versions of this file...
    EXFILES := $(JDK_TOPDIR)/src/share/classes/javax/crypto/JarVerifier.java
+
+   ifeq ($(OPENJDK_TARGET_OS),windows)
+      # This gets built on unix platforms implicitly in the old build even though
+      # it's excluded in the closed build.
+      EXCLUDES+=sun/java2d/pisces
+   endif
+
 endif
 
 ifneq ($(OPENJDK_TARGET_OS),solaris)
@@ -90,12 +93,14 @@
     # Exclude Window security related files in src/share/classes
     EXFILES+=NTLoginModule.java \
              NTSystem.java
-
+else
+    EXFILES+=UnixLoginModule.java \
+	     UnixSystem.java
 endif
 
 ifeq ($(OPENJDK_TARGET_OS),windows)
     # Don't build GTK L&F on Windows
-    EXCLUDES+=	com/sun/java/swing/plaf/gtk
+    EXCLUDES+=com/sun/java/swing/plaf/gtk
 endif
 
 ifneq ($(OPENJDK_TARGET_OS),linux)
@@ -115,6 +120,9 @@
 	     sun/nio/fs/BsdFileSystem.java \
              sun/nio/fs/BsdFileSystemProvider.java \
              sun/nio/fs/BsdNativeDispatcher.java \
+             sun/nio/fs/MacOSXFileSystemProvider.java \
+             sun/nio/fs/MacOSXFileSystem.java \
+             sun/nio/fs/MacOSXNativeDispatcher.java \
              sun/tools/attach/BsdAttachProvider.java \
              sun/tools/attach/BsdVirtualMachine.java
 endif
@@ -122,7 +130,7 @@
 # Exclude BreakIterator classes that are just used in compile process to generate
 # data files and shouldn't go in the product
 EXFILES+=sun/text/resources/BreakIteratorRules.java \
-	sun/text/resources/BreakIteratorRules_th.java
+	 sun/text/resources/BreakIteratorRules_th.java
 
 # TODO: Add BUILD_HEADLESS_ONLY to configure?
 ifdef BUILD_HEADLESS_ONLY
@@ -245,7 +253,7 @@
 
 ifndef OPENJDK
     CLOSED_SRC_DIRS:=$(JDK_TOPDIR)/src/closed/share/classes \
-		     $(JDK_TOPDIR)/src/closed/$(LEGACY_OPENJDK_TARGET_OS_API)/classes
+		     $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS_API_DIR)/classes
 endif
 
 MACOSX_SRC_DIRS :=
@@ -257,7 +265,8 @@
                $(JDK_TOPDIR)/src/solaris/classes/sun/java2d/BackBufferCapsProvider.java \
                $(JDK_TOPDIR)/src/solaris/classes/java/net/DefaultInterface.java \
                $(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
-               $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
+               $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
+               $(JDK_TOPDIR)/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java
 
      # JObjC.jar contains 1.5 byte-code...so skip it here :-(
      # MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/jobjc/src
@@ -273,14 +282,21 @@
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 
+# The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
+# JDK_FILTER at the make command line, only a subset of the JDK java files will
+# be recompiled. If multiple paths are separated by comma, convert that into a
+# space separated list.
+JDK_USER_DEFINED_FILTER:=$(strip $(subst $(COMMA),$(SPACE),$(JDK_FILTER)))
+
 $(eval $(call SetupJavaCompilation,BUILD_JDK,\
                 SETUP:=GENERATE_JDKBYTECODE,\
 		SRC:=$(JDK_TOPDIR)/src/share/classes \
-		     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes \
+		     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
 		     $(MACOSX_SRC_DIRS) \
 		     $(JDK_OUTPUTDIR)/gensrc \
 		     $(JDK_OUTPUTDIR)/gensrc_swing/javax/swing/beaninfo \
 		     $(CLOSED_SRC_DIRS),\
+		INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
 		EXCLUDES:=$(EXCLUDES),\
 		EXCLUDE_FILES:=$(EXFILES),\
 		BIN:=$(JDK_OUTPUTDIR)/classes,\
@@ -360,13 +376,12 @@
 $(eval $(call SetupJavaCompiler,GENERATE_15BYTECODE,\
      JAVAC:=$(JAVAC),\
      FLAGS:=-source 1.5 -target 1.5 -g -bootclasspath $(BOOT_RTJAR) -cp $(JDK_OUTPUTDIR)/../langtools/dist/lib/classes.jar $(DISABLE_WARNINGS),\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
 $(eval $(call SetupJavaCompilation,BUILD_JOBJC_JAR,\
 		SETUP:=GENERATE_15BYTECODE,\
+		DISABLE_SJAVAC:=true,\
 		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
 		     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
 		     $(JDK_OUTPUTDIR)/gensrc, \
--- a/makefiles/CompileLaunchers.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/CompileLaunchers.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -1,511 +1,557 @@
-#
-# Copyright (c) 2011, 2012, 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.
-#
-
-defalt: all
-
-include $(SPEC)
-include MakeBase.gmk
-include NativeCompilation.gmk
-
-# Setup the java compilers for the JDK build.
-include Setup.gmk
-
-# Build tools
-include Tools.gmk
-
-BUILD_LAUNCHERS=
-
-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 LDFLAGS_SUFFIX_posix
-    # Parameter 5 is extra LDFLAGS_SUFFIX_winapi
-    # 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 is FULL DEBUG SYMBOLS (set value to turn OFF, since most(all) seems to have it)
-
-    $1_WINDOWS_JLI_LIB:=$(JDK_OUTPUTDIR)/objs/libjli/jli.lib
-    ifneq ($6,)
-        $1_WINDOWS_JLI_LIB:=$6
-    endif
-    $1_VERSION_INFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc
-    ifneq ($8,)
-        $1_VERSION_INFO_RESOURCE:=$8
-    endif
-
-    $1_LDFLAGS := $3
-    ifeq ($(OPENJDK_TARGET_OS), macosx)
-        $1_LDFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-                       -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
-    endif
-
-    $1_LDFLAGS_SUFFIX :=
-    ifeq ($(USE_EXTERNAL_LIBZ), true)
-        $1_LDFLAGS_SUFFIX += -lz
-    endif
-
-    ifeq ($(OPENJDK_TARGET_OS), macosx)
-        $1_LDFLAGS_SUFFIX += -Wl,-all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
-                             -framework Cocoa -framework Security -framework ApplicationServices \
-                             -sectcreate __TEXT __info_plist $(JDK_TOPDIR)/src/macosx/lib/Info-cmdline.plist
-    endif
-
-
-    $1_OUTPUT_DIR_ARG:=$9
-    ifeq (,$$($1_OUTPUT_DIR_ARG))
-        $1_OUTPUT_DIR_ARG:=$(JDK_OUTPUTDIR)/bin
-    endif
-
-    $1_DEBUG_SYMBOLS:=yes
-    ifneq (,$(10))
-      $1_DEBUG_SYMBOLS:=
-    endif
-
-    $1_OPTIMIZATION:= LOW
-
-    # TODO: maybe it's better to move this if-statement out of this function
-    ifeq ($(1),java)
-      $1_OPTIMIZATION:=HIGH
-    endif
-
-    $(call SetupNativeCompilation,BUILD_LAUNCHER_$1,\
-	SRC:=$(JDK_TOPDIR)/src/share/bin,\
-	INCLUDE_FILES:=main.c,\
-	LANG:=C,\
-	OPTIMIZATION :=$$($1_OPTIMIZATION), \
-	CFLAGS:=$(CFLAGS_JDKEXE) \
-		-I$(JDK_TOPDIR)/src/share/bin \
-		-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin \
-		-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS)/bin \
-                -DFULL_VERSION='"$(FULL_VERSION)"' \
-                -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
-                -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
-		-DLIBARCHNAME='"$(ARCH)"' \
-		-DLAUNCHER_NAME='"java"' \
-		-DPROGNAME='"$1"' $(DPACKAGEPATH) \
-		$2,\
-	CFLAGS_linux:=-fPIC,\
-        CFLAGS_solaris:=-KPIC -DHAVE_GETHRTIME,\
-	LDFLAGS:=$(LDFLAGS_JDKEXE) \
-                 $(call SET_SHARED_LIBRARY_ORIGIN,../lib/$(LIBARCH)/jli) \
-                 $(call SET_SHARED_LIBRARY_ORIGIN,../jre/lib/$(LIBARCH)/jli) \
-		 $$($1_LDFLAGS),\
-	MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/launchers/mapfile-$(ARCH), \
-        LDFLAGS_SUFFIX:=$(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX),\
-	LDFLAGS_SUFFIX_posix:=$4 -lc,\
-	LDFLAGS_SUFFIX_winapi:=$$($1_WINDOWS_JLI_LIB) \
-			       $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5,\
-	LDFLAGS_SUFFIX_solaris := -lthread $(LIBDL), \
-	OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/$1_objs,\
-	OUTPUT_DIR:=$$($1_OUTPUT_DIR_ARG),\
-	PROGRAM:=$1,\
-	DEBUG_SYMBOLS:=$$($1_DEBUG_SYMBOLS),\
-	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" \
-		  $7,\
-	MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/java.manifest)
-
-    BUILD_LAUNCHERS += $$(BUILD_LAUNCHER_$1)
-
-    ifeq ($(OPENJDK_TARGET_OS),macosx)
-        $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjli_static.a
-    endif
-
-    ifeq ($(OPENJDK_TARGET_OS),windows)
-        $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
-				$$($1_WINDOWS_JLI_LIB)
-    endif    	 
-endef
-
-##########################################################################################
-
-XLIBS:=$(X_LIBS) -lX11
-ifeq ($(OPENJDK_TARGET_OS),macosx)
-    DPACKAGEPATH:=-DPACKAGE_PATH='"$(PACKAGE_PATH)"'
-    XLIBS:=
-endif
-
-ifdef OPENJDK
-    JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/windows/resource/icons"
-else
-    JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
-endif
-
-$(eval $(call SetupLauncher,java,\
-    -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
-    $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
-    $(JDK_TOPDIR)/src/windows/resource/java.rc))
-
-ifeq ($(OPENJDK_TARGET_OS),windows)
-    $(eval $(call SetupLauncher,javaw,\
-        -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
-        $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
-        $(JDK_TOPDIR)/src/windows/resource/java.rc))
-endif
-
-ifeq ($(OPENJDK_TARGET_OS),solaris)
-    THREAD_LIB:=-lthread
-endif
-ifeq ($(OPENJDK_TARGET_OS),linux)
-    THREAD_LIB:=-lpthread
-endif
-
-ifndef BUILD_HEADLESS_ONLY
-$(eval $(call SetupLauncher,appletviewer,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',,\
-    $(THREAD_LIB) $(XLIBS) -ldl))
-endif
-
-$(eval $(call SetupLauncher,extcheck,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.extcheck.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,idlj,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jar,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jarsigner,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.JarSigner"$(COMMA) }'))
-
-$(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 SetupLauncher,javadoc,\
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))
-
-$(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 SetupLauncher,javap,\
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))
-
-BUILD_LAUNCHER_jconsole_CPPFLAGS_windows:=-DJAVAW
-BUILD_LAUNCHER_jconsole_LDFLAGS_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 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 SetupLauncher,jhat,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))
-
-$(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" }'))
-
-$(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" }'))
-
-$(eval $(call SetupLauncher,jps,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jrunscript,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jsadebugd,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
-
-$(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" }'))
-
-$(eval $(call SetupLauncher,jstat,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jstatd,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,keytool,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.KeyTool"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,native2ascii,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))
-
-ifndef BUILD_HEADLESS_ONLY
-$(eval $(call SetupLauncher,policytool,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }'))
-endif
-
-$(eval $(call SetupLauncher,rmic,\
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,schemagen,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,serialver,\
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,xjc,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,wsgen,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,wsimport,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))
-
-$(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 SetupLauncher,servertool,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }'))
-
-$(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 SetupLauncher,pack200,\
-    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) "--pack" }'))
-
-$(eval $(call SetupLauncher,rmid,\
-    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,rmiregistry,\
-    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jcmd,\
-    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
-
-ifeq ($(OPENJDK_TARGET_OS),windows)
-    $(eval $(call SetupLauncher,kinit,\
-        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }'))
-
-    $(eval $(call SetupLauncher,klist,\
-        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }'))
-
-    $(eval $(call SetupLauncher,ktab,\
-        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
-endif
-
-##########################################################################################
-# The order of the object files on the link command line affects the size of the resulting
-# binary (at least on linux) which causes the size to differ between old and new build.
-ifeq ($(USE_EXTERNAL_LIBZ), true)
-UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
-UNPACKEXE_ZIPOBJS := -lz
-else
-UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
-UNPACKEXE_ZIPOBJS := 	$(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
-		     	$(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
-			$(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
-
-endif
-
-ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
-     UNPACKEXE_CFLAGS += -xregs=no%appl
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE,\
-                SRC:=$(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack,\
-		EXCLUDE_FILES:=jni.cpp,\
-		LANG:=C,\
-		OPTIMIZATION := LOW, \
-		CFLAGS:=$(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE)\
-			 -DFULL, \
-		CFLAGS_release:=-DPRODUCT,\
-		CFLAGS_linux:=-fPIC,\
-		CFLAGS_solaris := -KPIC, \
-		CFLAGS_macosx := -fPIC, \
-		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers-unpack200, \
-		LDFLAGS:=$(LDFLAGS_JDKEXE) \
-			 $(call SET_SHARED_LIBRARY_ORIGIN), \
-		LDFLAGS_SUFFIX:=$(UNPACKEXE_ZIPOBJS) $(LIBCXX),\
-		LDFLAGS_SUFFIX_solaris:=-lc,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/unpackexe,\
-		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/bin,\
-		PROGRAM:=unpack200,\
-		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
-		RC_FLAGS:=$(RC_FLAGS)\
-			  /D "JDK_FNAME=unpack200.exe" \
-			  /D "JDK_INTERNAL_NAME=unpack200" \
-			  /D "JDK_FTYPE=0x1L",\
-		MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest))
-
-ifneq ($(USE_EXTERNAL_LIBZ), true)
-
-$(BUILD_UNPACKEXE) : $(UNPACKEXE_ZIPOBJS)
-
-endif
-
-BUILD_LAUNCHERS += $(BUILD_UNPACKEXE)
-
-##########################################################################################
-
-
-BUILD_JEXEC := 
-BUILD_JEXEC_SRC :=
-BUILD_JEXEC_INC :=
-BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib/$(LIBARCH)
-
-#
-# UNHANDLED:
-# - COMPILE_APPROACH = normal
-#
-
-#
-# jdk/make/java/Makefile
-#
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-	ifeq ($(ARCH_DATA_MODEL), 32)
-		BUILD_JEXEC := 1
-	endif
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), linux)
-	BUILD_JEXEC := 1
-endif # OPENJDK_TARGET_OS
-
-#
-# jdk/make/java/jexec/Makefile
-#
-ifeq ($(BUILD_JEXEC), 1)
-
-	ifeq ($(OPENJDK_TARGET_OS),windows)
-	else ifeq ($(OPENJDK_TARGET_OS),macosx)
-		BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/macosx/bin
-	else
-		BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/solaris/bin
-	endif
-
-	ifeq ($(OPENJDK_TARGET_OS), linux)
-                BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
-		BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/share/bin
-	endif
-endif
-
-#
-# Note that the two Makefile's seems to contradict each other,
-#   and that src/macosx/bin/jexec.c seems unused
-#
-ifneq ($(BUILD_JEXEC_SRC),)
-        $(eval $(call SetupNativeCompilation,BUILD_JEXEC,\
-		SRC:=$(BUILD_JEXEC_SRC),\
-		INCLUDE_FILES:=jexec.c,\
-		LANG:=C,\
-		OPTIMIZATION := LOW, \
-		CFLAGS:=$(CFLAGS_JDKEXE)\
-                        $(BUILD_JEXEC_INC), \
-		LDFLAGS:=$(LDFLAGS_JDKEXE), \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/jexec_obj,\
-		OUTPUT_DIR:=$(BUILD_JEXEC_DST_DIR),\
-		PROGRAM:=jexec))
-
-	BUILD_LAUNCHERS += $(BUILD_JEXEC)
-endif
-
-##########################################################################################
-
-#
-# The java-rmi.cgi script in bin/ only gets delivered in certain situations
-#
-JAVA_RMI_CGI:=$(JDK_OUTPUTDIR)/bin/java-rmi.cgi
-ifeq ($(OPENJDK_TARGET_OS), linux)
-  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
-endif
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-  ifeq ($(ARCH_DATA_MODEL), 32)
-    BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
-  endif
-endif
-
-# TODO: 
-# On windows java-rmi.cgi shouldn't be bundled since Java 1.2, but has been built all
-# this time anyway. Since jdk6, it has been built from the wrong source and resulted
-# in a copy of the standard java launcher named "java-rmi.exe" ending up in the final
-# images bin dir. This weird behavior is mimicked here in the converted makefiles for
-# now. Should probably just be deleted.
-# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
-ifeq ($(OPENJDK_TARGET_OS_API),winapi)
-    $(eval $(call SetupLauncher,java-rmi,\
-        -DEXPAND_CLASSPATH_WILDCARDS,\
-        $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/makefiles/java/main/java/mapfile-$(ARCH)),\
-        ,,,,,$(JDK_OUTPUTDIR)/objs))
-
-    $(JAVA_RMI_CGI): $(BUILD_LAUNCHER_java-rmi)
-	$(MKDIR) -p $(@D)
-	$(CP) $< $@
-
-    BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
-else
-    $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
-	$(MKDIR) -p $(@D)
-	$(CP) $< $@
-	$(CHMOD) a+x $@
-endif
-
-##########################################################################################
-
-$(BUILD_LAUNCHERS) : $(JDK_TOPDIR)/makefiles/CompileLaunchers.gmk
-
-all: $(BUILD_LAUNCHERS)
-
-.PHONY: all
+#
+# Copyright (c) 2011, 2012, 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.
+#
+
+defalt: all
+
+include $(SPEC)
+include MakeBase.gmk
+include NativeCompilation.gmk
+
+# Setup the java compilers for the JDK build.
+include Setup.gmk
+
+# Build tools
+include Tools.gmk
+
+BUILD_LAUNCHERS=
+
+# 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) \
+                $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
+endif
+
+#
+# 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)) \
+                $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)) 
+endif
+
+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 LDFLAGS_SUFFIX_posix
+    # Parameter 5 is extra LDFLAGS_SUFFIX_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.
+
+    $1_WINDOWS_JLI_LIB:=$(JDK_OUTPUTDIR)/objs/libjli/jli.lib
+    ifneq ($6,)
+        $1_WINDOWS_JLI_LIB:=$6
+    endif
+    $1_VERSION_INFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc
+    ifneq ($8,)
+        $1_VERSION_INFO_RESOURCE:=$8
+    endif
+
+    $1_LDFLAGS := $3
+    $1_LDFLAGS_SUFFIX :=
+    ifeq ($(OPENJDK_TARGET_OS), macosx)
+        $1_PLIST_FILE:=Info-cmdline.plist
+        ifneq ($(11),)
+            $1_PLIST_FILE:=$(11)
+        endif
+
+        $1_LDFLAGS += -Wl,-all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
+                      -framework Cocoa -framework Security -framework ApplicationServices \
+                      -sectcreate __TEXT __info_plist $(JDK_TOPDIR)/src/macosx/lib/$$($1_PLIST_FILE)
+        $1_LDFLAGS_SUFFIX += -pthread
+    endif
+
+    ifeq ($(USE_EXTERNAL_LIBZ), true)
+        $1_LDFLAGS_SUFFIX += -lz
+    endif
+
+    $1_OUTPUT_DIR_ARG:=$9
+    ifeq (,$$($1_OUTPUT_DIR_ARG))
+        $1_OUTPUT_DIR_ARG:=$(JDK_OUTPUTDIR)/bin
+    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)
+    else
+        $1_OPTIMIZATION_ARG:=LOW
+    endif
+
+    $1_CFLAGS:=$(CFLAGS_JDKEXE)
+    ifeq ($(10),true)
+        $1_CFLAGS:=$(filter-out -MD,$(CFLAGS_JDKEXE))
+    endif
+
+    $(call SetupNativeCompilation,BUILD_LAUNCHER_$1,\
+	SRC:=$(JDK_TOPDIR)/src/share/bin,\
+	INCLUDE_FILES:=main.c,\
+	LANG:=C,\
+	OPTIMIZATION:=$$($1_OPTIMIZATION_ARG), \
+	CFLAGS:=$$($1_CFLAGS) \
+		-I$(JDK_TOPDIR)/src/share/bin \
+		-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin \
+		-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS)/bin \
+                -DFULL_VERSION='"$(FULL_VERSION)"' \
+                -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
+                -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
+		-DLIBARCHNAME='"$(OPENJDK_TARGET_CPU_LEGACY)"' \
+		-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
+		-DPROGNAME='"$1"' $(DPACKAGEPATH) \
+		$2,\
+	CFLAGS_linux:=-fPIC,\
+        CFLAGS_solaris:=-KPIC -DHAVE_GETHRTIME,\
+	LDFLAGS:=$(LDFLAGS_JDKEXE) \
+                 $(ORIGIN_ARG) \
+		 $$($1_LDFLAGS),\
+	LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_NAME,$1),\
+	LDFLAGS_linux:=-lpthread \
+                       $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)),\
+	LDFLAGS_solaris:=$$($1_LDFLAGS_solaris) \
+                       $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)),\
+	MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU), \
+        LDFLAGS_SUFFIX:=$(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX),\
+	LDFLAGS_SUFFIX_posix:=$4,\
+	LDFLAGS_SUFFIX_windows:=$$($1_WINDOWS_JLI_LIB) \
+			       $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5,\
+	LDFLAGS_SUFFIX_linux:=-L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
+	LDFLAGS_SUFFIX_solaris:=-L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \
+	OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/$1_objs$(OUTPUT_SUBDIR),\
+	OUTPUT_DIR:=$$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR),\
+	PROGRAM:=$1,\
+	DEBUG_SYMBOLS:=true,\
+	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" \
+		  $7,\
+	MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/java.manifest)
+
+    BUILD_LAUNCHERS += $$(BUILD_LAUNCHER_$1)
+
+    ifeq ($(OPENJDK_TARGET_OS),macosx)
+        $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjli_static.a
+    endif
+
+    ifeq ($(OPENJDK_TARGET_OS),windows)
+        $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
+				$$($1_WINDOWS_JLI_LIB)
+    endif    	 
+endef
+
+##########################################################################################
+
+XLIBS:=$(X_LIBS) -lX11
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+    DPACKAGEPATH:=-DPACKAGE_PATH='"$(PACKAGE_PATH)"'
+    XLIBS:=
+endif
+
+ifdef OPENJDK
+    JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/windows/resource/icons"
+else
+    JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
+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,,,user32.lib comctl32.lib,\
+    $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
+    $(JDK_TOPDIR)/src/windows/resource/java.rc,$(JDK_OUTPUTDIR)/objs/java_objs,true))
+
+$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
+
+BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX)
+
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    $(eval $(call SetupLauncher,javaw,\
+        -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
+        $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
+        $(JDK_TOPDIR)/src/windows/resource/java.rc,,true))
+endif
+
+
+ifndef BUILD_HEADLESS_ONLY
+$(eval $(call SetupLauncher,appletviewer,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',,\
+    $(XLIBS)))
+endif
+
+$(eval $(call SetupLauncher,extcheck,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.extcheck.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,idlj,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jar,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jarsigner,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.JarSigner"$(COMMA) }'))
+
+$(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 SetupLauncher,javadoc,\
+    -DEXPAND_CLASSPATH_WILDCARDS \
+    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))
+
+$(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 SetupLauncher,javap,\
+    -DEXPAND_CLASSPATH_WILDCARDS \
+    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))
+
+BUILD_LAUNCHER_jconsole_CFLAGS_windows:=-DJAVAW
+BUILD_LAUNCHER_jconsole_LDFLAGS_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 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 SetupLauncher,jhat,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))
+
+$(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 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 SetupLauncher,jps,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jrunscript,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jsadebugd,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
+    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
+    ,,,,,,,,,Info-privileged.plist))
+
+$(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 SetupLauncher,jstat,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jstatd,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,keytool,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.KeyTool"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,native2ascii,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))
+
+ifndef BUILD_HEADLESS_ONLY
+$(eval $(call SetupLauncher,policytool,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',,\
+    $(XLIBS)))
+endif
+
+$(eval $(call SetupLauncher,rmic,\
+    -DEXPAND_CLASSPATH_WILDCARDS \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,schemagen,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,serialver,\
+    -DEXPAND_CLASSPATH_WILDCARDS \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,xjc,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,wsgen,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,wsimport,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))
+
+$(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 SetupLauncher,servertool,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }'))
+
+$(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 SetupLauncher,pack200,\
+    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) "--pack" }'))
+
+$(eval $(call SetupLauncher,rmid,\
+    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,rmiregistry,\
+    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jcmd,\
+    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
+
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    $(eval $(call SetupLauncher,kinit,\
+        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }'))
+
+    $(eval $(call SetupLauncher,klist,\
+        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }'))
+
+    $(eval $(call SetupLauncher,ktab,\
+        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
+endif
+
+##########################################################################################
+# The order of the object files on the link command line affects the size of the resulting
+# binary (at least on linux) which causes the size to differ between old and new build.
+ifeq ($(USE_EXTERNAL_LIBZ), true)
+UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
+UNPACKEXE_ZIPOBJS := -lz
+else
+UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
+UNPACKEXE_ZIPOBJS := 	$(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
+		     	$(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
+			$(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
+
+endif
+
+ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
+    UNPACKEXE_CFLAGS += -xregs=no%appl
+endif
+
+UNPACKEXE_LANG:=C
+ifeq ($(OPENJDK_TARGET_OS),solaris)
+    UNPACKEXE_LANG:=C++
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE,\
+                SRC:=$(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack,\
+		EXCLUDE_FILES:=jni.cpp,\
+		LANG:=$(UNPACKEXE_LANG),\
+		OPTIMIZATION := LOW, \
+		CFLAGS:=$(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE)\
+                        -DFULL, \
+		CFLAGS_release:=-DPRODUCT,\
+		CFLAGS_linux:=-fPIC,\
+		CFLAGS_solaris := -KPIC, \
+		CFLAGS_macosx := -fPIC, \
+		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers-unpack200, \
+		LDFLAGS:=$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
+			 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \
+			 $(call SET_SHARED_LIBRARY_ORIGIN) \
+			 $(UNPACKEXE_ZIPOBJS),\
+		LDFLAGS_linux:=-lc,\
+		LDFLAGS_SUFFIX:=$(LIBCXX),\
+		LDFLAGS_SUFFIX_solaris:=-lc,\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR),\
+		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR),\
+		PROGRAM:=unpack200,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=unpack200.exe" \
+			  /D "JDK_INTERNAL_NAME=unpack200" \
+			  /D "JDK_FTYPE=0x1L",\
+		MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest))
+
+ifneq ($(USE_EXTERNAL_LIBZ), true)
+
+$(BUILD_UNPACKEXE) : $(UNPACKEXE_ZIPOBJS)
+
+endif
+
+BUILD_LAUNCHERS += $(BUILD_UNPACKEXE)
+
+##########################################################################################
+
+
+BUILD_JEXEC := 
+BUILD_JEXEC_SRC :=
+BUILD_JEXEC_INC :=
+BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+
+#
+# UNHANDLED:
+# - COMPILE_APPROACH = normal
+#
+
+#
+# jdk/make/java/Makefile
+#
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+	ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+		BUILD_JEXEC := 1
+	endif
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), linux)
+	BUILD_JEXEC := 1
+endif # OPENJDK_TARGET_OS
+
+#
+# jdk/make/java/jexec/Makefile
+#
+ifeq ($(BUILD_JEXEC), 1)
+
+	ifeq ($(OPENJDK_TARGET_OS),windows)
+	else ifeq ($(OPENJDK_TARGET_OS),macosx)
+		BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/macosx/bin
+	else
+		BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/solaris/bin
+	endif
+
+	ifeq ($(OPENJDK_TARGET_OS), linux)
+                BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
+		BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/share/bin
+	endif
+endif
+
+#
+# Note that the two Makefile's seems to contradict each other,
+#   and that src/macosx/bin/jexec.c seems unused
+#
+ifneq ($(BUILD_JEXEC_SRC),)
+        $(eval $(call SetupNativeCompilation,BUILD_JEXEC,\
+		SRC:=$(BUILD_JEXEC_SRC),\
+		INCLUDE_FILES:=jexec.c,\
+		LANG:=C,\
+		OPTIMIZATION := LOW, \
+		CFLAGS:=$(CFLAGS_JDKEXE)\
+                        $(BUILD_JEXEC_INC), \
+		CFLAGS_linux:=-fPIC,\
+		CFLAGS_solaris:=-KPIC,\
+		LDFLAGS:=$(LDFLAGS_JDKEXE) \
+			 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/jexec_obj,\
+		OUTPUT_DIR:=$(BUILD_JEXEC_DST_DIR),\
+		PROGRAM:=jexec))
+
+	BUILD_LAUNCHERS += $(BUILD_JEXEC)
+endif
+
+##########################################################################################
+
+#
+# The java-rmi.cgi script in bin/ only gets delivered in certain situations
+#
+JAVA_RMI_CGI:=$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
+ifeq ($(OPENJDK_TARGET_OS), linux)
+  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
+endif
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+  ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+    BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
+  endif
+endif
+
+# TODO: 
+# On windows java-rmi.cgi shouldn't be bundled since Java 1.2, but has been built all
+# this time anyway. Since jdk6, it has been built from the wrong source and resulted
+# in a copy of the standard java launcher named "java-rmi.exe" ending up in the final
+# images bin dir. This weird behavior is mimicked here in the converted makefiles for
+# now. Should probably just be deleted.
+# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    $(eval $(call SetupLauncher,java-rmi,\
+        -DEXPAND_CLASSPATH_WILDCARDS,\
+        $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/makefiles/java/main/java/mapfile-$(OPENJDK_TARGET_CPU))))
+else
+    $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
+	$(MKDIR) -p $(@D)
+	$(CP) $< $@
+	$(CHMOD) a+x $@
+endif
+
+##########################################################################################
+
+$(BUILD_LAUNCHERS) : $(JDK_TOPDIR)/makefiles/CompileLaunchers.gmk
+
+all: $(BUILD_LAUNCHERS)
+
+.PHONY: all
--- a/makefiles/CompileNativeLibraries.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/CompileNativeLibraries.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -44,13 +44,7 @@
 
 # Put the libraries here. Different locations for different target apis.
 ifeq ($(OPENJDK_TARGET_OS_API),posix)
-    ifneq ($(OPENJDK_TARGET_OS),macosx)
-        INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib/$(LIBARCH)
-        LIBARCHDIR=$(LIBARCH)/
-    else
-        INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib
-        LIBARCHDIR=/
-    endif
+    INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
 else
     INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/bin
 endif
@@ -63,6 +57,18 @@
 WIN_JAVA_LIB := $(JDK_OUTPUTDIR)/objs/libjava/java.lib
 WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib
 
+# Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
+# not on other platforms.
+ifeq ($(OPENJDK_TARGET_OS), windows)
+    WINDOWS_ONLY := true
+endif
+
+#
+# TODO replace with X_FLAGS / X_LIBS
+#   and add them to configure
+#
+OPENWIN_LIB:=$(OPENWIN_HOME)/lib
+
 ##########################################################################################
 
 BUILD_LIBFDLIBM_OPTIMIZATION:=HIGH
@@ -80,7 +86,7 @@
 		OPTIMIZATION:=$(BUILD_LIBFDLIBM_OPTIMIZATION), \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
-		CFLAGS_winapi_debug:=-DLOGGING,\
+		CFLAGS_windows_debug:=-DLOGGING,\
 		ARFLAGS:=$(ARFLAGS),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
 
@@ -98,7 +104,7 @@
 		LANG:=C,\
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
-		LDFLAGS:=-nostdlib -r,\
+		LDFLAGS:=-nostdlib -r -arch i386 -arch x86_64,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
 
 $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) : $(BUILD_LIBFDLIBM)
@@ -112,11 +118,18 @@
 BUILD_LIBVERIFY_SRC:=check_code.c check_format.c
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-	ifneq ($(ARCH), amd64)
-		BUILD_LIBVERIFY_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libverify/reorder-$(ARCH)
+	ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+		BUILD_LIBVERIFY_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libverify/reorder-$(OPENJDK_TARGET_CPU)
 	endif
 endif
 
+LIBVERIFY_OPTIMIZATION:=HIGH
+ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
+    ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
+        LIBVERIFY_OPTIMIZATION:=LOW
+    endif
+endif
+
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY,\
 		LIBRARY:=verify, \
@@ -124,13 +137,18 @@
 		SRC:=$(JDK_TOPDIR)/src/share/native/common,\
 		INCLUDE_FILES:=$(BUILD_LIBVERIFY_SRC),\
 		LANG:=C,\
-		OPTIMIZATION:=HIGH, \
+		OPTIMIZATION:=$(LIBVERIFY_OPTIMIZATION), \
 		CFLAGS:=$(CFLAGS_JDKLIB),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libverify/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN), \
 		LDFLAGS_SUFFIX_posix:=-ljvm -lc,\
 		LDFLAGS_SUFFIX_windows:=jvm.lib,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS) \
+			  /D "JDK_FNAME=verify.dll" \
+			  /D "JDK_INTERNAL_NAME=verify" \
+			  /D "JDK_FTYPE=0x2L",\
 		REORDER:=$(BUILD_LIBVERIFY_REORDER),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libverify,\
 		DEBUG_SYMBOLS:=true))
@@ -139,40 +157,32 @@
 
 ##########################################################################################
 
-LIBJAVA_SRC_DIRS:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/lang \
+LIBJAVA_SRC_DIRS:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/lang \
 		$(JDK_TOPDIR)/src/share/native/java/lang \
 		$(JDK_TOPDIR)/src/share/native/java/lang/ref \
 		$(JDK_TOPDIR)/src/share/native/java/lang/reflect \
 		$(JDK_TOPDIR)/src/share/native/java/io \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/io \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
 		$(JDK_TOPDIR)/src/share/native/java/nio \
 		$(JDK_TOPDIR)/src/share/native/java/security \
 		$(JDK_TOPDIR)/src/share/native/common \
 		$(JDK_TOPDIR)/src/share/native/sun/misc \
 		$(JDK_TOPDIR)/src/share/native/sun/reflect \
-		$(JDK_TOPDIR)/src/share/native/java/sql \
 		$(JDK_TOPDIR)/src/share/native/java/util \
 		$(JDK_TOPDIR)/src/share/native/java/util/concurrent/atomic \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/common \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/util \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/provider \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/io
-
-#
-# TODO
-#
-ARCHPROPNAME:=$(LIBARCH)
-ifeq ($(OPENJDK_TARGET_OS)-$(ARCH), solaris-i586)
-     ARCHPROPNAME:=x86
-else ifeq ($(OPENJDK_TARGET_OS)-$(ARCH_DATA_MODEL), windows-32)
-     ARCHPROPNAME:=x86
-else ifeq ($(OPENJDK_TARGET_OS), macosx)
-     ARCHPROPNAME:=$(ARCH)
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/util \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/provider \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/io
+ifneq ($(OPENJDK_TARGET_OS),macosx)
+    LIBJAVA_SRC_DIRS+=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/util/locale/provider
+else
+    LIBJAVA_SRC_DIRS+=$(JDK_TOPDIR)/src/macosx/native/sun/util/locale/provider
 endif
 
 LIBJAVA_CFLAGS:=$(foreach dir,$(LIBJAVA_SRC_DIRS),-I$(dir)) \
 		  -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include \
-                  -DARCHPROPNAME='"$(ARCHPROPNAME)"'
+                  -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
 
 LIBJAVA_CFLAGS += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
                   -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
@@ -208,8 +218,8 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-    ifneq ($(ARCH), amd64)
-        LIBJAVA_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libjava/reorder-$(ARCH)
+    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+        LIBJAVA_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libjava/reorder-$(OPENJDK_TARGET_CPU)
     endif
 endif
 
@@ -233,11 +243,17 @@
 		LDFLAGS_SUFFIX_posix:=-ljvm -lverify, \
 		LDFLAGS_SUFFIX_solaris:=-lnsl -lsocket -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc,\
 		LDFLAGS_SUFFIX_linux:=$(LIBDL) $(BUILD_LIBFDLIBM),\
-		LDFLAGS_SUFFIX_macosx:=$(BUILD_LIBFDLIBM) \
+		LDFLAGS_SUFFIX_macosx:=-L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
                                          -framework CoreFoundation \
                                          -framework Security -framework SystemConfiguration, \
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=java.dll" \
+			  /D "JDK_INTERNAL_NAME=java" \
+			  /D "JDK_FTYPE=0x2L",\
 		REORDER:=$(LIBJAVA_REORDER), \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJAVA)
 
@@ -252,20 +268,14 @@
 BUILD_LIBMLIB_SRC:=$(JDK_TOPDIR)/src/share/native/sun/awt/medialib
 BUILD_LIBMLIB_CFLAGS:=-D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \
 			-I$(BUILD_LIBMLIB_SRC) \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt/medialib 
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/medialib 
 
 BUILD_LIBMLIB_LDLIBS:=
 BUILD_LIBMLIB_IMAGE_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libmlib_image/mapfile-vers
 
-ifneq ($(OPENJDK_TARGET_OS), sparc)
-#
-# Yes, this will always be true (until someone makes an OS called sparc)
-#   but this is how it was writtin in old system...keep it like this for now
-#
-	BUILD_LIBMLIB_CFLAGS += -DMLIB_NO_LIBSUNMATH
-endif
-
-ifeq ($(ARCH_DATA_MODEL), 64)
+BUILD_LIBMLIB_CFLAGS += -DMLIB_NO_LIBSUNMATH
+
+ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
 	BUILD_LIBMLIB_CFLAGS += -DMLIB_OS64BIT
 endif
 
@@ -284,11 +294,16 @@
                         $(BUILD_LIBMLIB_CFLAGS),\
 		MAPFILE:=$(BUILD_LIBMLIB_IMAGE_MAPFILE), \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
-                         $(BUILD_LIBMLIB_LDLIBS) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-                LDFLAGS_SUFFIX_posix:=-lm,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image))
+		LDFLAGS_SUFFIX:=$(BUILD_LIBMLIB_LDLIBS) \
+				$(LDFLAGS_JDKLIB_SUFFIX),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=mlib_image.dll" \
+			  /D "JDK_INTERNAL_NAME=mlib_image" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBMLIB_IMAGE) : $(BUILD_LIBJAVA)
 
@@ -296,15 +311,7 @@
 
 ##########################################################################################
 
-ifeq ($(OPENJDK_TARGET_OS),solaris)
-ifeq ($(ARCH),sparc)
-	BUILD_LIBMLIB_IMAGE_V:=1
-else ifeq ($(ARCH), sparcv9)
-	BUILD_LIBMLIB_IMAGE_V:=1
-endif
-endif
-
-ifeq ($(BUILD_LIBMLIB_IMAGE_V), 1)
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH),solaris-sparc)
 
 BUILD_LIBMLIB_IMAGE_V_FILES:=\
         mlib_v_ImageLookUp.c \
@@ -411,7 +418,7 @@
 		INCLUDE_FILES:=$(BUILD_LIBMLIB_IMAGE_V_FILES),\
 		OPTIMIZATION:=HIGHEST, \
 		CFLAGS:=-xarch=sparcvis \
-                      $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(ARCH_DATA_MODEL).il\
+                      $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(OPENJDK_TARGET_CPU_BITS).il\
                       $(BUILD_LIBMLIB_V_CFLAGS) \
                       $(CFLAGS_JDKLIB), \
 		MAPFILE:=$(BUILD_LIBMLIB_IMAGE_MAPFILE), \
@@ -428,7 +435,7 @@
 
 LIBAWT_DIRS:=\
 	$(JDK_TOPDIR)/src/share/native/sun/awt \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/image \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/image/gif \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
@@ -437,17 +444,17 @@
 	$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/utility \
 	$(JDK_TOPDIR)/src/share/native/sun/java2d \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
 	$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
 	$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/image \
 	$(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/opengl \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/x11 \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/opengl \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11 \
 	$(JDK_TOPDIR)/src/share/native/sun/font \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/windows \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/windows \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/d3d
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/d3d
 
 
 LIBAWT_CFLAGS:=-D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES \
@@ -524,11 +531,12 @@
 	debug_trace.c \
 	debug_util.c
 
-ifneq (,$(filter $(OPENJDK_TARGET_OS), solaris linux macosx))
+ifneq (,$(filter $(OPENJDK_TARGET_OS), solaris linux))
 	LIBAWT_FILES += awt_LoadLibrary.c initIDs.c img_colors.c
 endif
 
 ifeq ($(OPENJDK_TARGET_OS),macosx)
+	LIBAWT_FILES += awt_LoadLibrary.c img_colors.c
 	LIBAWT_DIRS += $(JDK_TOPDIR)/src/macosx/native/com/apple/resources
 	LIBAWT_FILES += awt_LoadLibrary.c MacOSXResourceBundle.m
 	LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks
@@ -539,7 +547,7 @@
 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
         LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
         LIBAWT_CFLAGS += -xarch=sparcvis
-	LIBAWT_CFLAGS += $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(ARCH_DATA_MODEL).il
+	LIBAWT_CFLAGS += $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(OPENJDK_TARGET_CPU_BITS).il
         LIBAWT_CFLAGS += \
             -I$(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib \
             -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d/medialib \
@@ -591,7 +599,7 @@
                 vis_XorBlit.c             \
                 mlib_v_ImageCopy_blk.s
 
-	ifeq ($(OPENJDK_TARGET_CPU_BITS),64)
+	ifeq ($(OPENJDK_TARGET_CPU),sparcv9)
 		LIBAWT_ASFLAGS=-P -xarch=v9a
 	else
 		LIBAWT_ASFLAGS=-P -xarch=v8plusa
@@ -644,8 +652,8 @@
 			MouseInfo.cpp \
 			rect.c
 	LIBAWT_LANG:=C++
-	LIBAWT_CFLAGS += $(GX_OPTION) -DUNICODE -D_UNICODE
-	ifeq ($(ARCH_DATA_MODEL), 64)
+	LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE
+	ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
 		LIBAWT_CFLAGS += -DMLIB_OS64BIT
 	endif
 
@@ -686,22 +694,25 @@
 				 /DELAYLOAD:winspool.drv /DELAYLOAD:imm32.dll \
 				 /DELAYLOAD:ole32.dll /DELAYLOAD:comdlg32.dll \
 				 /DELAYLOAD:comctl32.dll /DELAYLOAD:shlwapi.dll,\
-		LDFLAGS_macosx:=-lmlib_image \
-                                 -framework Cocoa \
-				 -framework OpenGL \
-				 -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-				 -framework JavaNativeFoundation \
-				 -framework JavaRuntimeSupport \
-				 -framework ApplicationServices \
-				 -framework AudioToolbox,\
-		LDFLAGS_solaris:=-R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_LIB)$(ISA_DIR),\
-		LDFLAGS_SUFFIX_posix:=-ljvm $(LIBM) -ljava $(LIBDL),\
+		LDFLAGS_solaris:=-R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR),\
+		LDFLAGS_SUFFIX_linux:=-ljvm $(LIBM) $(LIBDL) -ljava,\
+		LDFLAGS_SUFFIX_solaris:=-ljvm $(LIBM) $(LIBDL) -ljava,\
+		LDFLAGS_SUFFIX_macosx:=-lmlib_image -ljvm $(LIBM) \
+				       -framework Cocoa \
+				       -framework OpenGL \
+				       -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+				       -framework JavaNativeFoundation \
+				       -framework JavaRuntimeSupport \
+				       -framework ApplicationServices \
+				       -framework AudioToolbox \
+				       -ljava,\
 		VERSIONINFO_RESOURCE:=$(LIBAWT_VERSIONINFO_RESOURCE),\
 		RC_FLAGS:=$(RC_FLAGS) $(LIBAWT_RC_FLAGS) \
 			  /D "JDK_FNAME=awt.dll" \
 			  /D "JDK_INTERNAL_NAME=awt" \
 			  /D "JDK_FTYPE=0x2L",\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBAWT) : $(BUILD_LIBJAVA)
 
@@ -728,25 +739,25 @@
 		$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 		$(JDK_TOPDIR)/src/share/native/sun/awt/utility \
 		$(JDK_TOPDIR)/src/share/native/sun/font \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/font \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font \
 		$(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/opengl \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/x11 \
-		$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/xawt \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/opengl \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11 \
+		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/xawt \
 
 LIBAWT_XAWT_CFLAGS:=-DXAWT -DXAWT_HACK \
         -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
 	$(CUPS_CFLAGS) \
 	$(foreach dir,$(LIBAWT_XAWT_DIRS),-I$(dir)) \
 	-I$(JDK_TOPDIR)/src/share/native/sun/java2d \
-	-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d \
+	-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
 	-I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
 	-I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
 	-I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
 	-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
 	-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
-	-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/jdga
+	-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga
 
 ifeq ($(OPENJDK_TARGET_OS),solaris)
 	LIBAWT_XAWT_CFLAGS += -DFUNCPROTO=15
@@ -816,13 +827,15 @@
 LIBAWT_XAWT_LDFLAGS_SUFFIX:=$(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi  -ljava -ljvm -lc
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
-	LIBAWT_XAWT_LDFLAGS_SUFFIX += -lpthread
+        # To match old build, add this to LDFLAGS instead of suffix.
+	LIBAWT_XAWT_LDFLAGS += -lpthread
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 	LIBAWT_XAWT_LDFLAGS_SUFFIX += -lpthread
 endif
 
+# On macosx, the shared library origin is set twice for this lib.
 $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT,\
 		LIBRARY:=awt_xawt,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
@@ -834,12 +847,26 @@
                         $(X_CFLAGS),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_xawt/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
-			 $(call SET_SHARED_LIBRARY_ORIGIN) \
-			 $(X_LIBS),\
-		LDFLAGS_solaris:=-L$(OPENWIN_HOME)/sfw/lib$(ISA_DIR) -L$(OPENWIN_HOME)/lib$(ISA_DIR) \
-				 -R$(OPENWIN_HOME)/sfw/lib$(ISA_DIR) -R$(OPENWIN_HOME)/lib$(ISA_DIR) \
-				 -R/usr/dt/lib$(ISA_DIR),\
+			 $(X_LIBS) $(LIBAWT_XAWT_LDFLAGS),\
+		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN) \
+			       $(call SET_SHARED_LIBRARY_ORIGIN,/..),\
+		LDFLAGS_solaris:=-L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+				 -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
+				 -R$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+				 -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
+				 -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+			 	 $(call SET_SHARED_LIBRARY_ORIGIN) \
+			 	 $(call SET_SHARED_LIBRARY_ORIGIN,/..),\
+		LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_ORIGIN) \
+				$(call SET_SHARED_LIBRARY_ORIGIN). \
+				$(call SET_SHARED_LIBRARY_ORIGIN) \
+				$(call SET_SHARED_LIBRARY_ORIGIN).,\
 		LDFLAGS_SUFFIX:=$(LIBAWT_XAWT_LDFLAGS_SUFFIX),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=xawt.dll" \
+			  /D "JDK_INTERNAL_NAME=xawt" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_xawt))
 
 $(BUILD_LIBAWT_XAWT) : $(BUILD_LIBJAVA)
@@ -885,8 +912,8 @@
 
 BUILD_LIBZIP_REORDER:=
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-    ifneq ($(ARCH), amd64)
-        BUILD_LIBZIP_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(ARCH)
+    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+        BUILD_LIBZIP_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
     endif
 endif
 
@@ -905,17 +932,26 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) \
                         $(LIBZ_INCLUDE) \
 		        -I$(JDK_TOPDIR)/src/share/native/java/io \
-                        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/io,\
+                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io,\
 		CFLAGS_posix:=$(BUILD_LIBZIP_MMAP) -UDEBUG,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libzip/mapfile-vers, \
 		REORDER:=$(BUILD_LIBZIP_REORDER), \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+			 $(call SET_SHARED_LIBRARY_ORIGIN) \
 			 $(EXPORT_ZIP_FUNCS), \
-		LDFLAGS_winapi:=-export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
+		LDFLAGS_windows:=-export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
                                 -export:ZIP_ReadEntry -export:ZIP_GetNextEntry jvm.lib \
                                 $(WIN_JAVA_LIB),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBZ),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libzip))
+		LDFLAGS_SUFFIX_linux:=-ljvm -ljava $(LIBZ),\
+		LDFLAGS_SUFFIX_solaris:=-ljvm -ljava $(LIBZ),\
+		LDFLAGS_SUFFIX_macosx:=$(LIBZ) -ljava -ljvm,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=zip.dll" \
+			  /D "JDK_INTERNAL_NAME=zip" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libzip,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBZIP) : $(BUILD_LIBJAVA)
 
@@ -934,24 +970,24 @@
 			 -DNO_ZLIB -DUNPACK_JNI -DFULL,\
 		CFLAGS_release:=-DPRODUCT,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB)\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_winapi:=-map:$(JDK_OUTPUTDIR)/objs/unpack.map /debug \
+		LDFLAGS_windows:=-map:$(JDK_OUTPUTDIR)/objs/unpack.map /debug \
 				jvm.lib $(WIN_JAVA_LIB),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-		LDFLAGS_SUFFIX_posix:=$(LIBCXX),\
+		LDFLAGS_SUFFIX_posix:=-ljvm $(LIBCXX) -ljava -lc,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libunpack,\
 		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
 		RC_FLAGS:=$(RC_FLAGS)\
 			  /D "JDK_FNAME=unpack.dll" \
 			  /D "JDK_INTERNAL_NAME=unpack" \
-			  /D "JDK_FTYPE=0x2L"))
+			  /D "JDK_FTYPE=0x2L",\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBUNPACK) : $(BUILD_LIBJAVA)
 
 BUILD_LIBRARIES += $(BUILD_LIBUNPACK)
 
-ifeq ($(OPENJDK_TARGET_OS_API),winapi)
+ifeq ($(OPENJDK_TARGET_OS),windows)
     $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.map: $(BUILD_LIBUNPACK)
 	$(ECHO) Copying $(@F)
 	$(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX),%.map,$<) $@
@@ -977,16 +1013,21 @@
 $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH,\
 		LIBRARY:=attach, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/tools/attach,\
+                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tools/attach,\
 		EXCLUDE_FILES:=$(LIBATTACH_EXCLUDE_FILES),\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		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_solaris:=-ldoor,\
-		LDFLAGS_winapi:=psapi.lib advapi32.lib $(WIN_JAVA_LIB) jvm.lib,\
+		LDFLAGS_windows:=psapi.lib advapi32.lib $(WIN_JAVA_LIB) jvm.lib,\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libattach,\
 		DEBUG_SYMBOLS:=true))
@@ -1001,21 +1042,26 @@
 		LIBRARY:=dt_socket,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                 SRC:=$(JDK_TOPDIR)/src/share/transport/socket \
-			$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/transport/socket,\
+			$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) -DUSE_MMAP \
                         -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
                         -I$(JDK_TOPDIR)/src/share/transport/socket \
-		        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/transport/socket \
+		        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket \
                         -I$(JDK_TOPDIR)/src/share/back/export \
                         -I$(JDK_TOPDIR)/src/share/back,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libdt_socket/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB), \
-		LDFLAGS_SUFFIX_linux:=$(LDFLAGS_JDKLIB_SUFFIX) -lpthread,\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+			 $(call SET_SHARED_LIBRARY_ORIGIN), \
+		LDFLAGS_SUFFIX_linux:=-lpthread,\
 		LDFLAGS_SUFFIX_solaris:=-lnsl -lsocket,\
-		LDFLAGS_SUFFIX_winapi:=$(LDFLAGS_JDKLIB_SUFFIX) -export:jdwpTransport_OnLoad ws2_32.lib,\
-		LDFLAGS_SUFFIX:=,\
+		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX) -export:jdwpTransport_OnLoad ws2_32.lib,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=dt_socket.dll" \
+			  /D "JDK_INTERNAL_NAME=dt_socket" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_socket,\
 		DEBUG_SYMBOLS:=true))
 
@@ -1025,55 +1071,66 @@
 
 ##########################################################################################
 
-ifeq ($(OPENJDK_TARGET_OS_API),winapi)
+ifeq ($(OPENJDK_TARGET_OS),windows)
 
   $(eval $(call SetupNativeCompilation,BUILD_LIBDT_SHMEM,\
 		LIBRARY:=dt_shmem,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                 SRC:=$(JDK_TOPDIR)/src/share/native/com/sun/tools/jdi \
 			$(JDK_TOPDIR)/src/share/transport/shmem \
-			$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/transport/shmem,\
+			$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) -DUSE_MMAP\
                         -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
                         -I$(JDK_TOPDIR)/src/share/transport/shmem \
-		        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/transport/shmem \
+		        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem \
                         -I$(JDK_TOPDIR)/src/share/back/export, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB),\
-		LDFLAGS_winapi:=-export:jdwpTransport_OnLoad,\
+		LDFLAGS_windows:=-export:jdwpTransport_OnLoad,\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_shmem))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=dt_shmem.dll" \
+			  /D "JDK_INTERNAL_NAME=dt_shmem" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_shmem,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
   BUILD_LIBRARIES += $(BUILD_LIBDT_SHMEM)
 
 endif # OPENJDK_TARGET_OS
 
 ##########################################################################################
-# JDWP_LOGGING causes log messages to be compiled into the library. These reference the 
-# __FILE__ macro which here expands to the absolute path of the file while the old build 
-# system used a relative path. This causes the binaries to differ in size.
+# JDWP_LOGGING causes log messages to be compiled into the library.
 $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP,\
 		LIBRARY:=jdwp, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/share/back $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/back,\
+                SRC:=$(JDK_TOPDIR)/src/share/back $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) -DJDWP_LOGGING\
 		 -I$(JDK_TOPDIR)/src/share/transport/export \
                  -I$(JDK_TOPDIR)/src/share/back/export \
                  -I$(JDK_TOPDIR)/src/share/npt \
-                 -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/npt \
+                 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
                  -I$(JDK_TOPDIR)/src/share/back \
-                 -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/back \
+                 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back \
 		 -I$(JDK_OUTPUTDIR)/gensrc_jdwp_headers,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjdwp/mapfile-vers, \
-		LDFLAGS:=$(filter-out -ljava,$(LDFLAGS_JDKLIB)), \
-		LDFLAGS_SUFFIX_linux:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL),\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+			 $(call SET_SHARED_LIBRARY_ORIGIN),\
+		LDFLAGS_SUFFIX_linux:=$(LIBDL),\
 		LDFLAGS_SUFFIX_solaris:=$(LIBDL),\
 		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX),\
 		LDFLAGS_SUFFIX:=,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjdwp))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jdwp.dll" \
+			  /D "JDK_INTERNAL_NAME=jdwp" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjdwp,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJDWP) : $(BUILD_LIBJAVA)
 
@@ -1097,19 +1154,24 @@
 $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS,\
 		LIBRARY:=$(LIBJAAS_NAME),\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/com/sun/security/auth/module,\
+                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/security/auth/module,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB),\
 		MAPFILE:=$(LIBJAAS_MAPFILE),\
 		LDFLAGS:=$(filter-out -ljava,$(LDFLAGS_JDKLIB)) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_winapi:=netapi32.lib user32.lib mpr.lib advapi32.lib,\
-		LDFLAGS_SUFFIX_linux:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		LDFLAGS_windows:=netapi32.lib user32.lib mpr.lib advapi32.lib,\
 		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX),\
 		LDFLAGS_SUFFIX:=,\
 		EXCLUDE_FILES:=$(LIBJAAS_EXCLUDE_FILES),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjaas))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS) \
+			  /D "JDK_FNAME=$(LIBJAAS_NAME).dll" \
+			  /D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjaas,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJAAS) : $(BUILD_LIBJAVA)
 
@@ -1121,7 +1183,7 @@
 		LIBRARY:=jsdt,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                 SRC:=$(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace\
-			$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/tracing/dtrace,\
+			$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tracing/dtrace,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB)\
@@ -1129,12 +1191,17 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsdt/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX_linux:=$(LDFLAGS_JDKLIB_SUFFIX)  $(LIBDL),\
-		LDFLAGS_SUFFIX_winapi:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL),\
+		LDFLAGS_SUFFIX_linux:=$(LIBDL),\
+		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL),\
 		LDFLAGS_SUFFIX_macosx:=                         $(LIBDL),\
 		LDFLAGS_SUFFIX:=,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jsdt.dll" \
+			  /D "JDK_INTERNAL_NAME=jsdt" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsdt, \
-                DEBUG_SYMBOLS:= yes))
+                DEBUG_SYMBOLS:=true))
 
 $(BUILD_LIBJSDT) : $(BUILD_LIBJAVA)
 
@@ -1163,14 +1230,20 @@
 			-I$(JDK_TOPDIR)/src/share/native/sun/java2d \
 			-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug,\
 		CFLAGS_solaris:=-xc99=no_lib,\
-		CFLAGS_winapi:=-DCMS_IS_WINDOWS_,\
+		CFLAGS_windows:=-DCMS_IS_WINDOWS_,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/liblcms/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB), \
-		LDFLAGS_solaris:=/usr/lib$(ISA_DIR)/libm.so.2,\
-		LDFLAGS_winapi:=$(WIN_AWT_LIB) $(WIN_JAVA_LIB),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-		LDFLAGS_SUFFIX_posix:=-lawt,\
-		LDFLAGS_SUFFIX_linux:=-lm,\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+                         $(call SET_SHARED_LIBRARY_ORIGIN), \
+		LDFLAGS_solaris:=/usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2,\
+		LDFLAGS_windows:=$(WIN_AWT_LIB) $(WIN_JAVA_LIB),\
+		LDFLAGS_SUFFIX_solaris:=-lawt -ljava -ljvm,\
+		LDFLAGS_SUFFIX_macosx:=$(LIBM) -lawt -ljava -ljvm,\
+		LDFLAGS_SUFFIX_linux:=-lm -lawt -ljava -ljvm,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=lcms.dll" \
+			  /D "JDK_INTERNAL_NAME=lcms" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/liblcms))
 
     BUILD_LIBRARIES += $(BUILD_LIBLCMS)
@@ -1190,8 +1263,8 @@
 
 BUILD_LIBJPEG_REORDER:=
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-    ifneq ($(ARCH), amd64)
-        BUILD_LIBJPEG_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/reorder-$(ARCH)
+    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+        BUILD_LIBJPEG_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
     endif
 endif
 
@@ -1223,11 +1296,16 @@
 		MAPFILE:=$(BUILD_LIBJPEG_MAPFILE), \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_linux:=$(LIBDL),\
-		LDFLAGS_winapi:=$(WIN_JAVA_LIB) jvm.lib,\
+		LDFLAGS_windows:=$(WIN_JAVA_LIB) jvm.lib,\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jpeg.dll" \
+			  /D "JDK_INTERNAL_NAME=jpeg" \
+			  /D "JDK_FTYPE=0x2L",\
 		REORDER:=$(BUILD_LIBJPEG_REORDER),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjpeg))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjpeg,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJPEG) : $(BUILD_LIBJAVA)
 
@@ -1263,11 +1341,11 @@
 			-I$(JDK_TOPDIR)/src/share/native/sun/font \
 			-I$(JDK_TOPDIR)/src/share/native/sun/font/layout \
 			-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
 			-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 			-I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
 			-I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
 			-I$(JDK_TOPDIR)/src/share/native/sun/java2d
 
 # Turn off aliasing with GCC for ExtensionSubtables.cpp
@@ -1279,25 +1357,30 @@
 		LIBRARY:=fontmanager, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                 SRC:=$(JDK_TOPDIR)/src/share/native/sun/font\
-		     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/font,\
+		     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font,\
 		EXCLUDE_FILES:=$(LIBFONTMANAGER_EXCLUDE_FILES) \
 			       AccelGlyphCache.c,\
 		LANG:=C++,\
 		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON),\
 		CXXFLAGS:=$(CXXFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON),\
 		OPTIMIZATION:=$(LIBFONTMANAGER_OPTIMIZATION), \
-		CFLAGS_windows= -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/windows \
+		CFLAGS_windows= -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
 				-DCC_NOEX, \
 		MAPFILE:=$(BUILD_LIBFONTMANAGER_MAPFILE), \
-		LDFLAGS:=$(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) \
+		LDFLAGS:=$(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_windows:=advapi32.lib user32.lib gdi32.lib $(WIN_AWT_LIB) $(WIN_JAVA_LIB),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) \
-				$(BUILD_LIBFONTMANAGER_FONTLIB),\
-		LDFLAGS_SUFFIX_linux:=-lawt $(LIBM) $(LIBCXX),\
-		LDFLAGS_SUFFIX_solaris:=-lawt -lawt_xawt -lc $(LIBM) $(LIBCXX),\
-		LDFLAGS_SUFFIX_macosx:=-lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfontmanager))
+		LDFLAGS_SUFFIX:=$(BUILD_LIBFONTMANAGER_FONTLIB),\
+		LDFLAGS_SUFFIX_linux:=-lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc,\
+		LDFLAGS_SUFFIX_solaris:=-lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm,\
+		LDFLAGS_SUFFIX_macosx:=-lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup -ljava -ljvm,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=fontmanager.dll" \
+			  /D "JDK_INTERNAL_NAME=fontmanager" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfontmanager,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBFONTMANAGER) : $(BUILD_LIBAWT)
 
@@ -1323,10 +1406,10 @@
 		            -I$(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k \
 		            -I$(JDK_TOPDIR)/src/closed/share/native/sun/font \
 		            -I$(JDK_TOPDIR)/src/share/share/native/sun/font \
-		            -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/font \
+		            -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font \
 		            -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
 		            -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
-		            -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d \
+		            -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
 		            -I$(JDK_TOPDIR)/src/share/native/sun/java2d
 
     $(eval $(call SetupNativeCompilation,BUILD_LIBT2K,\
@@ -1343,15 +1426,18 @@
 		CFLAGS_windows=-DCC_NOEX, \
 		CXXFLAGS_windows=-DCC_NOEX, \
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libt2k/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_windows:=user32.lib $(JDK_OUTPUTDIR)/objs/libfontmanager/fontmanager.lib,\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-		LDFLAGS_SUFFIX_macosx:=$(LIBCXX) $(LIBM) -lfontmanager,\
-		LDFLAGS_SUFFIX_linux:=$(LIBCXX) $(LIBM) -lfontmanager,\
-		LDFLAGS_SUFFIX_solaris:=$(LIBCXX) $(LIBM) -lfontmanager -lawt \
-					-lawt_xawt,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libt2k))
+		LDFLAGS_SUFFIX_posix:=$(LIBM) $(LIBCXX) -lfontmanager -ljava -ljvm -lc,\
+		LDFLAGS_SUFFIX_solaris:=-lawt -lawt_xawt,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=t2k.dll" \
+			  /D "JDK_INTERNAL_NAME=t2k" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libt2k,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
     # t2k is linked against fontmanager
     $(BUILD_LIBT2K) : $(BUILD_LIBFONTMANAGER)
@@ -1361,40 +1447,40 @@
 
 ##########################################################################################
 
-#
-# TODO replace with X_FLAGS / X_LIBS
-#   and add them to configure
-#
-OPENWIN_LIB:=$(OPENWIN_HOME)/lib
-
 ifeq ($(OPENJDK_TARGET_OS), windows)
-    ifeq ($(ARCH_DATA_MODEL), 32)
+    ifeq ($(OPENJDK_TARGET_CPU), x86)
         KERNEL32_LIB:=kernel32.lib
     endif
     $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT,\
                 LIBRARY:=jawt, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/windows,\
+                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows,\
 		INCLUDE_FILES:=jawt.cpp,\
 		LANG:=C++,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CXXFLAGS_JDKLIB) \
 			-EHsc -DUNICODE -D_UNICODE \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/windows \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
 			-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d/windows, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB) $(KERNEL32_LIB) \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows, \
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(KERNEL32_LIB) $(LDFLAGS_CXX_JDK) \
 			 advapi32.lib $(WIN_AWT_LIB),\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jawt.dll" \
+			  /D "JDK_INTERNAL_NAME=jawt" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJAWT) : $(BUILD_LIBAWT)
 
 $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
 	$(ECHO) Copying $(@F)
-	$(CP) $< $@
+	$(CP) $(JDK_OUTPUTDIR)/objs/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
 
 BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
 
@@ -1421,7 +1507,7 @@
     $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT,\
                 LIBRARY:=jawt, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt \
+                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
                      $(JDK_TOPDIR)/src/macosx/native/sun/awt,\
 		INCLUDE_FILES:=$(JAWT_FILES),\
 		LANG:=C,\
@@ -1432,10 +1518,11 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjawt/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_solaris:=-L$(OPENWIN_HOME)/sfw/lib$(ISA_DIR) -L$(OPENWIN_LIB)$(ISA_DIR),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) $(JAWT_LIBS),\
-		LDFLAGS_SUFFIX_solaris:=-lXrender,\
-		LDFLAGS_SUFFIX_macosx:=-framework Cocoa, \
+		LDFLAGS_solaris:=-L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR),\
+		LDFLAGS_SUFFIX_linux:=$(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX),\
+		LDFLAGS_SUFFIX_solaris:=$(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender,\
+		LDFLAGS_SUFFIX_macosx:=-Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
+				       -framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt))
 
 ifndef BUILD_HEADLESS_ONLY
@@ -1494,7 +1581,13 @@
 		LDFLAGS:=$(LIBJDBCODBC_LDFLAGS) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN) $(LIBJDBCODBC_LIBS),\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBJDBCODBC_SONAME),\
-		OBJECT_DIR:=$(LIBJDBCODBC_DIR)))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=JdbcOdbc.dll" \
+			  /D "JDK_INTERNAL_NAME=JdbcOdbc" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(LIBJDBCODBC_DIR),\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJDBCODBC) : $(BUILD_LIBJAVA)
 
@@ -1538,11 +1631,11 @@
 
 ##########################################################################################
 
-BUILD_LIBINSTRUMENT_SRC   :=$(JDK_TOPDIR)/src/share/instrument \
-                               $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/io \
-                               $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/instrument
-
-BUILD_LIBINSTRUMENT_FILES :=\
+LIBINSTRUMENT_SRC   :=$(JDK_TOPDIR)/src/share/instrument \
+                      $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
+                      $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument
+
+LIBINSTRUMENT_FILES :=\
 	EncodingSupport.c \
 	EncodingSupport_md.c \
 	FileSystemSupport_md.c \
@@ -1557,50 +1650,54 @@
 	Utilities.c \
 	canonicalize_md.c
 
-BUILD_LIBINSTRUMENT_DIR   :=$(JDK_OUTPUTDIR)/objs/libinstrument
-BUILD_LIBINSTRUMENT_CFLAGS:=-I$(JDK_TOPDIR)/src/share/instrument \
-                               -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/instrument \
-                               -I$(JDK_TOPDIR)/src/share/bin
-
-BUILD_LIBINSTRUMENT_LDFLAGS:=
-BUILD_LIBINSTRUMENT_LDFLAGS_SUFFIX:=
+LIBINSTRUMENT_DIR   :=$(JDK_OUTPUTDIR)/objs/libinstrument
+LIBINSTRUMENT_CFLAGS:=$(CFLAGS_JDKLIB) \
+                      -I$(JDK_TOPDIR)/src/share/instrument \
+                      -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument \
+                      -I$(JDK_TOPDIR)/src/share/bin
+
+LIBINSTRUMENT_LDFLAGS:=
+LIBINSTRUMENT_LDFLAGS_SUFFIX:=
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  BUILD_LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/jli_static.lib $(WIN_JAVA_LIB) \
-				 -export:Agent_OnAttach
-  # equivalent of strcasecmp is stricmp on Windows
-  BUILD_LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
-else ifneq (,$(findstring $(OPENJDK_TARGET_OS), macosx))
-	ifneq ($(ARCH), universal)
-		BUILD_LIBINSTRUMENT_LDFLAGS += -Wl,-all_load
-	endif
-
-	BUILD_LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/libjli_static.a
-	BUILD_LIBINSTRUMENT_LDFLAGS += -liconv
-	BUILD_LIBINSTRUMENT_LDFLAGS += -framework Cocoa -framework Security -framework ApplicationServices
-	BUILD_LIBINSTRUMENT_LDFLAGS += $(LIBZ)
-else
-	BUILD_LIBINSTRUMENT_LDFLAGS += -L $(INSTALL_LIBRARIES_HERE)/jli
-	BUILD_LIBINSTRUMENT_LDFLAGS_SUFFIX += -ljli $(LIBDL)
+    LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/jli_static.lib $(WIN_JAVA_LIB) \
+				 -export:Agent_OnAttach advapi32.lib
+    # Statically link the C runtime so that there are not dependencies on modules 
+    # not on the search patch when invoked from the Windows system directory 
+    # (or elsewhere).
+    LIBINSTRUMENT_CFLAGS := $(filter-out -MD,$(LIBINSTRUMENT_CFLAGS))
+    # equivalent of strcasecmp is stricmp on Windows
+    LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
 endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT,\
 		LIBRARY:=instrument, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-		SRC:=$(BUILD_LIBINSTRUMENT_SRC),\
-		INCLUDE_FILES:=$(BUILD_LIBINSTRUMENT_FILES),\
+		SRC:=$(LIBINSTRUMENT_SRC),\
+		INCLUDE_FILES:=$(LIBINSTRUMENT_FILES),\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
-		CFLAGS:=$(CFLAGS_JDKLIB) \
-                        $(BUILD_LIBINSTRUMENT_CFLAGS),\
+		CFLAGS:=$(LIBINSTRUMENT_CFLAGS),\
 		CFLAGS_debug:=-DJPLIS_LOGGING,\
 		CFLAGS_release:=-DNO_JPLIS_LOGGING,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libinstrument/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN)\
-			 $(call SET_SHARED_LIBRARY_ORIGIN,jli) \
-                         $(BUILD_LIBINSTRUMENT_LDFLAGS),\
-		LDFLAGS_SUFFIX:=$(LIBZ) $(BUILD_LIBINSTRUMENT_LDFLAGS_SUFFIX),\
-		OBJECT_DIR:=$(BUILD_LIBINSTRUMENT_DIR),\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+			 $(call SET_SHARED_LIBRARY_ORIGIN) \
+                         $(LIBINSTRUMENT_LDFLAGS),\
+		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN,/jli),\
+		LDFLAGS_solaris:= $(call SET_SHARED_LIBRARY_ORIGIN,/jli),\
+		LDFLAGS_macosx:=-Xlinker -all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
+				-framework Cocoa -framework Security -framework ApplicationServices,\
+		LDFLAGS_SUFFIX:=$(LIBINSTRUMENT_LDFLAGS_SUFFIX),\
+		LDFLAGS_SUFFIX_macosx:=-liconv $(LIBZ),\
+		LDFLAGS_SUFFIX_solaris:=$(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL),\
+		LDFLAGS_SUFFIX_linux:=$(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=instrument.dll" \
+			  /D "JDK_INTERNAL_NAME=instrument" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(LIBINSTRUMENT_DIR),\
 		DEBUG_SYMBOLS:=true))
 
 ifneq (,$(findstring $(OPENJDK_TARGET_OS), macosx windows))
@@ -1615,8 +1712,8 @@
 ##########################################################################################
 
 BUILD_LIBMANAGEMENT_SRC:=$(JDK_TOPDIR)/src/share/native/sun/management \
-                           $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/management \
-                           $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/com/sun/management
+                           $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/management \
+                           $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/management
 
 BUILD_LIBMANAGEMENT_EXCLUDES:=
 
@@ -1640,6 +1737,12 @@
 	BUILD_LIBMANAGEMENT_EXCLUDES += MacosxOperatingSystem.c
 endif
 
+LIBMANAGEMENT_OPTIMIZATION:=HIGH
+ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
+    ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
+        LIBMANAGEMENT_OPTIMIZATION:=LOW
+    endif
+endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT,\
 		LIBRARY:=management,\
@@ -1647,7 +1750,7 @@
 		SRC:=$(BUILD_LIBMANAGEMENT_SRC),\
 		EXCLUDE_FILES:=$(BUILD_LIBMANAGEMENT_EXCLUDES),\
 		LANG:=C,\
-		OPTIMIZATION:=HIGH, \
+		OPTIMIZATION:=$(LIBMANAGEMENT_OPTIMIZATION), \
 		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBMANAGEMENT_CFLAGS),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libmanagement/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
@@ -1655,6 +1758,11 @@
 		LDFLAGS_windows:=$(WIN_JAVA_LIB) jvm.lib advapi32.lib psapi.lib,\
 		LDFLAGS_solaris:=-lkstat,\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=management.dll" \
+			  /D "JDK_INTERNAL_NAME=management" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmanagement,\
 		DEBUG_SYMBOLS:=true))
 
@@ -1664,10 +1772,10 @@
 
 ##########################################################################################
 
-BUILD_LIBHPROF_SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/hprof $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/demo/jvmti/hprof
+BUILD_LIBHPROF_SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/hprof $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/demo/jvmti/hprof
 BUILD_LIBHPROF_CFLAGS:=-I$(JDK_TOPDIR)/src/share/demo/jvmti/hprof \
                          -I$(JDK_TOPDIR)/src/share/npt \
-                         -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/npt \
+                         -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
                          -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo
 
 BUILD_LIBHPROF_LDFLAGS:=
@@ -1676,6 +1784,13 @@
      BUILD_LIBHPROF_LDFLAGS += -lsocket -lnsl
 endif
 
+LIBHPROF_OPTIMIZATION:=HIGHEST
+ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
+    ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
+        LIBHPROF_OPTIMIZATION:=LOW
+    endif
+endif
+
 ifneq ($(OPENJDK_TARGET_OS),windows)
      BUILD_LIBHPROF_LDFLAGS += $(LIBDL)
 endif
@@ -1685,7 +1800,7 @@
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(BUILD_LIBHPROF_SRC),\
 		LANG:=C,\
-		OPTIMIZATION:=HIGHEST, \
+		OPTIMIZATION:=$(LIBHPROF_OPTIMIZATION), \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
                          $(BUILD_LIBHPROF_CFLAGS),\
 		CFLAGS_debug:=-DHPROF_LOGGING,\
@@ -1694,6 +1809,11 @@
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_windows:=wsock32.lib winmm.lib advapi32.lib,\
 		LDFLAGS_SUFFIX:=$(BUILD_LIBHPROF_LDFLAGS),\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=hprof.dll" \
+			  /D "JDK_INTERNAL_NAME=hprof" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libhprof_jvmti,\
 		DEBUG_SYMBOLS:=true))
 
@@ -1712,7 +1832,11 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjava_crw_demo/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=java_crw_demo.dll" \
+			  /D "JDK_INTERNAL_NAME=java_crw_demo" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava_crw_demo,\
 		DEBUG_SYMBOLS:=true))
 
@@ -1723,17 +1847,22 @@
 $(eval $(call SetupNativeCompilation,BUILD_LIBNPT,\
 		LIBRARY:=npt, \
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-		SRC:=$(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/npt,\
+		SRC:=$(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
                         -I$(JDK_TOPDIR)/src/share/npt \
-                        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/npt,\
+                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnpt/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_macosx:=-liconv,\
 		LDFLAGS_SUFFIX_windows:=-export:nptInitialize -export:nptTerminate,\
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=npt.dll" \
+			  /D "JDK_INTERNAL_NAME=npt" \
+			  /D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnpt,\
 		DEBUG_SYMBOLS:=true))
 
@@ -1742,11 +1871,11 @@
 ##########################################################################################
 
 LIBNET_SRC_DIRS:=$(JDK_TOPDIR)/src/share/native/java/net \
-                   $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/net \
-                   $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/net/dns \
-                   $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/net/www/protocol/http/ntlm \
-                   $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/net/sdp \
-                   $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/net/spi
+                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net \
+                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/dns \
+                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/www/protocol/http/ntlm \
+                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/sdp \
+                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/spi
 
 LIBNET_CFLAGS:=$(foreach dir,$(LIBNET_SRC_DIRS),-I$(dir))
 
@@ -1767,8 +1896,6 @@
 				NTLMAuthSequence.c NetworkInterface_winXP.c
 endif
 
-LIBNET_LDFLAGS_SUFFIX:=
-
 $(eval $(call SetupNativeCompilation,BUILD_LIBNET,\
 		LIBRARY:=net,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
@@ -1781,13 +1908,19 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnet/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBNET_LDFLAGS_SUFFIX),\
-		LDFLAGS_SUFFIX_solaris:=-lnsl -lsocket $(LIBDL) ,\
-		LDFLAGS_SUFFIX_linux:=$(LIBDL) -lpthread ,\
+		LDFLAGS_SUFFIX_macosx:=-ljvm -ljava,\
+		LDFLAGS_SUFFIX_solaris:=-ljvm -ljava -lnsl -lsocket $(LIBDL) ,\
+		LDFLAGS_SUFFIX_linux:=$(LIBDL) -ljvm -lpthread -ljava,\
 		LDFLAGS_SUFFIX_windows:=ws2_32.lib $(JVMLIB) secur32.lib iphlpapi.lib \
 					  delayimp.lib $(WIN_JAVA_LIB) jvm.lib advapi32.lib \
                                           /DELAYLOAD:secur32.dll /DELAYLOAD:iphlpapi.dll, \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnet))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=net.dll" \
+			  /D "JDK_INTERNAL_NAME=net" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnet,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBNET) : $(BUILD_LIBJAVA)
 
@@ -1801,7 +1934,7 @@
 COPY_FILES += $(JDK_OUTPUTDIR)/lib/net.properties
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-$(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template : $(JDK_TOPDIR)/src/${LEGACY_OPENJDK_TARGET_OS_API}/lib/sdp/sdp.conf.template
+$(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template : $(JDK_TOPDIR)/src/${OPENJDK_TARGET_OS_API_DIR}/lib/sdp/sdp.conf.template
 	$(ECHO) Copying $(@F)
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
@@ -1812,15 +1945,15 @@
 ##########################################################################################
 
 BUILD_LIBNIO_SRC:=\
-        $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/nio \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/ch \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/fs
+        $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/nio \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch \
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
 
 BUILD_LIBNIO_CFLAGS:=\
 	-I$(JDK_TOPDIR)/src/share/native/sun/nio/ch \
 	-I$(JDK_TOPDIR)/src/share/native/java/io \
 	-I$(JDK_TOPDIR)/src/share/native/java/net \
-        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/net
+        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net
 
 BUILD_LIBNIO_FILES:=\
         DatagramChannelImpl.c \
@@ -1847,14 +1980,14 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
-	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-linux
+	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
 	BUILD_LIBNIO_FILES += \
 		EPoll.c \
 		EPollArrayWrapper.c \
 		EPollPort.c \
 		InheritedChannel.c \
 		NativeThread.c \
-	        PollArrayWrapper.c \
+		PollArrayWrapper.c \
 		UnixAsynchronousServerSocketChannelImpl.c \
 		UnixAsynchronousSocketChannelImpl.c \
 		GnomeFileTypeDetector.c \
@@ -1865,7 +1998,7 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-bsd
+	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
 	BUILD_LIBNIO_SRC += $(JDK_TOPDIR)/src/macosx/native/sun/nio/ch
 	BUILD_LIBNIO_FILES += \
 		InheritedChannel.c \
@@ -1873,8 +2006,8 @@
 	        PollArrayWrapper.c \
 		UnixAsynchronousServerSocketChannelImpl.c \
 		UnixAsynchronousSocketChannelImpl.c \
-		GnomeFileTypeDetector.c \
 		BsdNativeDispatcher.c \
+		MacOSXNativeDispatcher.c \
 		UnixCopyFile.c \
 		UnixNativeDispatcher.c \
 		KQueue.c \
@@ -1883,7 +2016,7 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-solaris
+	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
 	BUILD_LIBNIO_FILES += \
 		DevPollArrayWrapper.c \
 		InheritedChannel.c \
@@ -1912,17 +2045,22 @@
 		LDFLAGS:=$(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX_linux:=-ljava -lnet -lpthread $(LIBDL),\
-		LDFLAGS_SUFFIX_solaris:=$(LDFLAGS_JDKLIB_SUFFIX) \
-                                        $(JVMLIB) -lsocket -lposix4 $(LIBDL) -lsendfile \
-		                        -ljava -lnet,\
+		LDFLAGS_SUFFIX_solaris:=-ljvm -lsocket -lposix4 $(LIBDL) \
+				        -lsendfile -ljava -lnet -lc,\
 		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX) \
                                         $(WIN_JAVA_LIB) $(JDK_OUTPUTDIR)/objs/libnet/net.lib \
 					advapi32.lib jvm.lib ws2_32.lib\
                                         $(JDK_OUTPUTDIR)/objs/libjava/io_util.obj \
 		                        $(JDK_OUTPUTDIR)/objs/libjava/FileDescriptor_md.obj ,\
-		LDFLAGS_SUFFIX_macosx:=-ljava -lnet -pthread,\
+		LDFLAGS_SUFFIX_macosx:=-ljava -lnet -pthread -framework CoreFoundation,\
 		LDFLAGS_SUFFIX:=,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnio))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=nio.dll" \
+			  /D "JDK_INTERNAL_NAME=nio" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnio,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBNIO)
 
@@ -1942,23 +2080,23 @@
     $(eval $(call SetupNativeCompilation,BUILD_LIBSCTP,\
                 LIBRARY:=sctp,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
-                SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/ch/sctp,\
+                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch/sctp,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB)\
 			-I$(JDK_TOPDIR)/src/share/native/sun/nio/ch \
 			-I$(JDK_TOPDIR)/src/share/native/sun/nio/ch/sctp \
 			-I$(JDK_TOPDIR)/src/share/native/java/net \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/ch \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/java/net,\
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net,\
 		CFLAGS_linux:=$(SCTP_WERROR),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libsctp/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX_linux:=$(LIBDL) -lpthread,\
+		LDFLAGS_SUFFIX_linux:=-lpthread $(LIBDL) -ljava -ljvm,\
 		LDFLAGS_SUFFIX_posix:=-lnio -lnet,\
-		LDFLAGS_SUFFIX_solaris:=-lsocket,\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		LDFLAGS_SUFFIX_solaris:=-lsocket -ljava -ljvm,\
+		LDFLAGS_SUFFIX_macosx:=-ljava -ljvm,\
 		INCLUDE_FILES:=SctpNet.c SctpChannelImpl.c SctpServerChannelImpl.c,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp))
 
@@ -1970,8 +2108,8 @@
 
 ##########################################################################################
 
-BUILD_LIBJLI_SRC_DIRS:=$(JDK_TOPDIR)/src/share/bin $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin
-BUILD_LIBJLI_CFLAGS:=$(foreach dir,$(BUILD_LIBJLI_SRC_DIRS),-I$(dir))
+BUILD_LIBJLI_SRC_DIRS:=$(JDK_TOPDIR)/src/share/bin $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin
+LIBJLI_CFLAGS:=$(CFLAGS_JDKLIB) $(foreach dir,$(BUILD_LIBJLI_SRC_DIRS),-I$(dir))
 
 BUILD_LIBJLI_FILES:=\
 	java.c \
@@ -1983,16 +2121,16 @@
 
 ifeq ($(JVM_VARIANT_ZERO), true)
 	ERGO_FAMILY:=zero
-else # !ZERO_BUILD
-	ifneq (,$(findstring $(ARCH), amd64 x86_64))
+else
+	ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
 		ERGO_FAMILY:=i586
-	else # !X86 FAMILY
-		ERGO_FAMILY:=$(ARCH)
-	endif #ARCH_FAMILY
-endif # ZERO_BUILD
+	else
+		ERGO_FAMILY:=$(OPENJDK_TARGET_CPU_ARCH)
+	endif
+endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-	BUILD_LIBJLI_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/bin
+	LIBJLI_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/bin
 	BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/bin
 	BUILD_LIBJLI_FILES += java_md_common.c java_md_macosx.c
 
@@ -2001,7 +2139,10 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-	BUILD_LIBJLI_FILES += java_md.c
+	BUILD_LIBJLI_FILES += java_md.c \
+			      cmdtoargs.c
+        # Staticically link with c runtime on windows.
+	LIBJLI_CFLAGS:=$(filter-out -MD,$(LIBJLI_CFLAGS))
 else ifneq ($(OPENJDK_TARGET_OS), macosx)
 
 	BUILD_LIBJLI_FILES += java_md_common.c
@@ -2011,36 +2152,23 @@
 
         # if the architecture specific ergo file exists then
         # use it, else use the generic definitions from ergo.c
-	ifneq ($(wildcard $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/$(ERGO_ARCH_FILE)),)
+	ifneq ($(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/$(ERGO_ARCH_FILE)),)
 		BUILD_LIBJLI_FILES += $(ERGO_ARCH_FILE)
 	else # !ERGO_ARCH_FILE
-		BUILD_LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
+		LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
 	endif # ERGO_ARCH_FILE
 endif #WINDOWS
 
-# Names of arch directories
-ifneq ($(OPENJDK_TARGET_OS), macosx)
-	BUILD_LIBJLI_CFLAGS += -DLIBARCHNAME='"$(LIBARCH)"'
-else
-	BUILD_LIBJLI_CFLAGS += -DLIBARCHNAME='"$(ARCH)"'
-endif
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-	ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
-		BUILD_LIBJLI_CFLAGS += -DLIBARCH32NAME='"sparc"'
-		BUILD_LIBJLI_CFLAGS += -DLIBARCH64NAME='"sparcv9"'
-	else
-		BUILD_LIBJLI_CFLAGS += -DLIBARCH32NAME='"i386"'
-		BUILD_LIBJLI_CFLAGS += -DLIBARCH64NAME='"amd64"'
-	endif
-endif # OPENJDK_TARGET_OS
+# Append defines depending on target platform
+LIBJLI_CFLAGS += $(OPENJDK_TARGET_CPU_JLI_CFLAGS)
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-	BUILD_LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
+	LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
 endif
 
 ifneq ($(USE_EXTERNAL_LIBZ),true)
 	BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
-	BUILD_LIBJLI_CFLAGS += $(LIBZ_INCLUDE)
+	LIBJLI_CFLAGS += $(LIBZ_INCLUDE)
 	BUILD_LIBJLI_FILES += \
 		inflate.c \
 		inftrees.c \
@@ -2063,13 +2191,16 @@
 		INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
 		LANG:=C,\
 		OPTIMIZATION:=HIGH, \
-		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBJLI_CFLAGS),\
+		CFLAGS:=$(LIBJLI_CFLAGS),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjli/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=$(LIBZ),\
-		LDFLAGS_SUFFIX_posix:=$(LIBDL) -lc,\
-		LDFLAGS_SUFFIX_linux:=-lpthread,\
+		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN,/..),\
+		LDFLAGS_solaris:=$(call SET_SHARED_LIBRARY_ORIGIN,/..),\
+		LDFLAGS_macosx:=-framework Cocoa -framework Security -framework ApplicationServices,\
+		LDFLAGS_SUFFIX_solaris:=$(LIBZ) $(LIBDL) -lc,\
+		LDFLAGS_SUFFIX_linux:=$(LIBZ) $(LIBDL) -lc -lpthread,\
+		LDFLAGS_SUFFIX_macosx:=$(LIBZ),\
 		LDFLAGS_SUFFIX_windows:=\
 			-export:JLI_Launch \
 			-export:JLI_ManifestIterate \
@@ -2078,11 +2209,20 @@
 			-export:JLI_ReportErrorMessageSys \
 			-export:JLI_ReportMessage \
 			-export:JLI_ReportExceptionDescription \
+			-export:JLI_MemAlloc \
+			-export:JLI_CmdToArgs \
+			-export:JLI_GetStdArgc \
+			-export:JLI_GetStdArgs \
 			advapi32.lib \
 			comctl32.lib \
 			user32.lib,\
-		LDFLAGS_SUFFIX_macosx:=-framework Cocoa -framework Security -framework ApplicationServices, \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS) \
+			  /D "JDK_FNAME=jli.dll" \
+			  /D "JDK_INTERNAL_NAME=jli" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJLI)
 
@@ -2097,7 +2237,7 @@
 		INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
 		LANG:=C,\
 		OPTIMIZATION:=HIGH, \
-		CFLAGS:=$(CFLAGS_JDKLIB) $(STATIC_LIBRARY_FLAGS) $(BUILD_LIBJLI_CFLAGS),\
+		CFLAGS:=$(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS),\
 		ARFLAGS:=$(ARFLAGS),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
 
@@ -2115,7 +2255,7 @@
 		INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
 		LANG:=C,\
 		OPTIMIZATION:=HIGH, \
-		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBJLI_CFLAGS),\
+		CFLAGS:=$(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS),\
 		LDFLAGS:=-nostdlib -r,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
 
@@ -2140,7 +2280,13 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjfr/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjfr))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jfr.dll" \
+			  /D "JDK_INTERNAL_NAME=jfr" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjfr,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJFR)
 
@@ -2180,11 +2326,17 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libkcms/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX_linux:=-lpthread,\
+		LDFLAGS_SUFFIX_linux:=-lc -lpthread,\
 		LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \
 		LDFLAGS_SUFFIX:=-lm $(LDFLAGS_JDKLIB_SUFFIX),\
 		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkcms))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=kcms.dll" \
+			  /D "JDK_INTERNAL_NAME=kcms" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkcms,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBKCMS) : $(BUILD_LIBJAVA)
 
@@ -2196,12 +2348,12 @@
 
 ifndef OPENJDK
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-ifneq ($(ARCH), amd64)
+ifneq ($(OPENJDK_TARGET_CPU), x86_64)
 
 ifeq ($(shell if test "$(OS_VERSION_MAJOR)" -eq 5 -a "$(OS_VERSION_MINOR)" -le 10; then $(ECHO) ok; fi), ok)
 
 SUNWJDGA_MAPFILE:=
-ifneq (,$(findstring $(ARCH),sparc))
+ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
 	SUNWJDGA_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjdga/mapfile-vers
 endif
 
@@ -2213,12 +2365,12 @@
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			-I$(JDK_TOPDIR)/src/share/javavm/export \
-			-I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/javavm/export \
+			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
 			-I$(OPENWIN_HOME)/include, \
 		MAPFILE:=$(SUNWJDGA_MAPFILE), \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN), \
-		LDFLAGS_SUFFIX:=-L$(OPENWIN_LIB)$(ISA_DIR) -R$(OPENWIN_LIB)$(ISA_DIR) -ldga -lX11 $(LIBDL) -lc, \
+		LDFLAGS_SUFFIX:=-L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -ldga -lX11 $(LIBDL) -lc, \
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunwjdga))
 
 BUILD_LIBRARIES += $(BUILD_LIBSUNWJDGA)
@@ -2245,13 +2397,13 @@
 			  $(CUPS_CFLAGS) \
 			  $(X_CFLAGS) \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
-			  -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/java2d \
+			  -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
 			  -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
-			  -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/jdga \
+			  -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga \
                           $(foreach dir,$(LIBAWT_HEADLESS_DIRS),-I$(dir))
 
 LIBAWT_HEADLESS_FILES:=\
@@ -2282,12 +2434,10 @@
         AccelGlyphCache.c \
 	CUPSfuncs.c
 
-LIBAWT_HEADLESS_LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) -lawt -lm
-
 LIBAWT_HEADLESS_REORDER:=
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-	ifneq ($(ARCH), amd64)
-		LIBAWT_HEADLESS_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/reorder-$(ARCH)
+	ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+		LIBAWT_HEADLESS_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
 	endif
 endif
 
@@ -2302,11 +2452,15 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
+		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN,/..),\
+		LDFLAGS_solaris:=$(call SET_SHARED_LIBRARY_ORIGIN,/..) \
+				 -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+				 -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR),\
+		LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_ORIGIN).,\
 		REORDER:=$(LIBAWT_HEADLESS_REORDER), \
-		LDFLAGS_SUFFIX:=$(LIBAWT_HEADLESS_LDFLAGS_SUFFIX),\
-		LDFLAGS_SUFFIX_posix:=$(LIBDL),\
-		LDFLAGS_SUFFIX_macosx:=$(LIBCXX), \
-		LDFLAGS_SUFFIX_solaris:=$(LIBCXX), \
+		LDFLAGS_SUFFIX_linux:=-ljvm -lawt -lm $(LIBDL) -ljava,\
+		LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX), \
+		LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava, \
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless))
 
 $(BUILD_LIBAWT_HEADLESS) : $(BUILD_LIBAWT)
@@ -2324,7 +2478,7 @@
 	$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
 	$(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen \
-        $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/awt/splashscreen
+        $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
 
 LIBSPLASHSCREEN_CFLAGS:=-DSPLASHSCREEN -DPNG_NO_MMX_CODE \
 	$(foreach dir,$(LIBSPLASHSCREEN_DIRS),-I$(dir))
@@ -2458,7 +2612,7 @@
                                   -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
 				  -framework JavaNativeFoundation
 else ifneq ($(OPENJDK_TARGET_OS), windows)
-	LIBSPLASHSCREEN_LDFLAGS_SUFFIX += -L$(OPENWIN_LIB)$(ISA_DIR) -lX11 -lXext $(LIBM) -lpthread
+	LIBSPLASHSCREEN_LDFLAGS_SUFFIX += -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -lX11 -lXext $(LIBM) -lpthread
 else # OPENJDK_TARGET_OS
 	LIBSPLASHSCREEN_LDFLAGS_SUFFIX += kernel32.lib user32.lib gdi32.lib delayimp.lib /DELAYLOAD:user32.dll
 endif # OPENJDK_TARGET_OS
@@ -2474,9 +2628,14 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libsplashscreen/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX_linux:=$(LIBDL), \
 		LDFLAGS_SUFFIX:=$(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsplashscreen))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=splashscreen.dll" \
+			  /D "JDK_INTERNAL_NAME=splashscreen" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsplashscreen,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(LIBSPLASHSCREEN)
 
@@ -2508,11 +2667,17 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			$(LIBDCPR_CFLAGS), \
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libdcpr/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LIBM)\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		LDFLAGS_SUFFIX:=$(LIBM) $(LDFLAGS_JDKLIB_SUFFIX),\
 		LDFLAGS_SUFFIX_posix:=-lm,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdcpr))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=dcpr.dll" \
+			  /D "JDK_INTERNAL_NAME=dcpr" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdcpr,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBDCPR) : $(BUILD_LIBJAVA)
 
@@ -2526,20 +2691,26 @@
 		LIBRARY:=j2pcsc,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
-                     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/smartcardio,\
+                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio,\
 		LANG:=C,\
 		CFLAGS_posix:=-D__sun_jdk,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
                      -I$(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
-                     -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/smartcardio\
-                     -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/smartcardio/MUSCLE,\
+                     -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio\
+                     -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio/MUSCLE,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2pcsc/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX_posix:=$(LIBDL), \
 		LDFLAGS_SUFFIX_windows:=winscard.lib,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pcsc))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=j2pcsc.dll" \
+			  /D "JDK_INTERNAL_NAME=j2pcsc" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pcsc,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
 
@@ -2550,12 +2721,12 @@
 		LIBRARY:=j2gss,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
-                     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/jgss/wrapper,\
+                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
                      -I$(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
-                     -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/jgss/wrapper,\
+                     -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2gss/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
@@ -2571,7 +2742,7 @@
 ifeq ($(OPENJDK_TARGET_OS), windows)
      BUILD_LIBKRB5_NAME:=w2k_lsa_auth
      BUILD_LIBKRB5_FILES:=NativeCreds.c WindowsDirectory.c
-     BUILD_LIBKRB5_SRC:=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/krb5
+     BUILD_LIBKRB5_SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5
      BUILD_LIBKRB5_LIBS:=Secur32.lib netapi32.lib \
 	kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib \
 	advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib \
@@ -2593,11 +2764,17 @@
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/security/krb5 \
-                        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/krb5 ,\
+                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5 ,\
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX:=$(BUILD_LIBKRB5_LIBS) ,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkrb5))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=$(BUILD_LIBKRB5_NAME).dll" \
+			  /D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkrb5,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBKRB5)
 endif
@@ -2610,46 +2787,56 @@
 		LIBRARY:=sunmscapi,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/mscapi \
-		     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/mscapi,\
+		     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi,\
 		INCLUDE_FILES:=security.cpp, \
 		LANG:=C++,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/security/mscapi \
-                        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/mscapi ,\
-		LDFLAGS:=$(LDFLAGS_JDKLIB) \
+                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi ,\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX:=Crypt32.Lib advapi32.lib,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunmscapi))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=sunmscapi.dll" \
+			  /D "JDK_INTERNAL_NAME=sunmscapi" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunmscapi,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
 endif
 
 ##########################################################################################
 
-ifneq ($(OPENJDK_TARGET_OS)-$(ARCH_DATA_MODEL), windows-64)
 $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11,\
 		LIBRARY:=j2pkcs11,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
-                     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/pkcs11 \
+                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
                      $(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
-                     $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/pkcs11/wrapper,\
+                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
-		        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/pkcs11 \
+		        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
 		        -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
-                        -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/security/pkcs11/wrapper,\
+                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2pkcs11/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX_posix:=$(LIBDL), \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pkcs11))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=j2pkcs11.dll" \
+			  /D "JDK_INTERNAL_NAME=j2pkcs11" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pkcs11,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJ2PKCS11)
-endif
 
 ##########################################################################################
 
@@ -2685,11 +2872,18 @@
 		CXXFLAGS:=$(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CXXFLAGS_JDKLIB)) \
                           $(BUILD_LIBSUNEC_FLAGS),\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libsunec/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB) \
-			 $(call SET_SHARED_LIBRARY_ORIGIN),\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK),\
+		LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX:=$(LIBCXX),\
+                LDFLAGS_SUFFIX_linux:=-lc ,\
                 LDFLAGS_SUFFIX_solaris:=-lc ,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunec))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=sunec.dll" \
+			  /D "JDK_INTERNAL_NAME=sunec" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunec,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 BUILD_LIBRARIES += $(BUILD_LIBSUNEC)
 endif
@@ -2698,7 +2892,7 @@
 
 LIBJSOUND_SRC_DIRS:=\
 	$(JDK_TOPDIR)/src/share/native/com/sun/media/sound \
-	$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/com/sun/media/sound
+	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/media/sound
 
 LIBJSOUND_SRC_FILES:=Utilities.c Platform.c
 
@@ -2781,29 +2975,29 @@
 ifeq ($(JVM_VARIANT_ZERO), true)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_ZERO
 else
-  ifeq ($(ARCH), i586)
+  ifeq ($(OPENJDK_TARGET_CPU), x86)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_I586
-  endif # ARCH i586
-
-  ifeq ($(ARCH), sparc)
+  endif
+
+  ifeq ($(OPENJDK_TARGET_CPU), sparc)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARC
-  endif # ARCH sparc
-
-  ifeq ($(ARCH), sparcv9)
+  endif
+
+  ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARCV9
-  endif # ARCH sparcv9
-
-  ifeq ($(ARCH), amd64)
+  endif
+
+  ifeq ($(OPENJDK_TARGET_CPU), x86_64)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_AMD64
-  endif # ARCH amd64
-
-  ifeq ($(ARCH), arm)
+  endif
+
+  ifeq ($(OPENJDK_TARGET_CPU), arm)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_ARM
-  endif # ARCH arm
-
-  ifeq ($(ARCH), ppc)
+  endif
+
+  ifeq ($(OPENJDK_TARGET_CPU), ppc)
 	LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC
-  endif # ARCH ppc
+  endif
 endif
 
 LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
@@ -2815,18 +3009,25 @@
 		INCLUDE_FILES:=$(LIBJSOUND_SRC_FILES),\
 		LANG:=$(LIBJSOUND_LANG),\
 		OPTIMIZATION:=LOW, \
-		CFLAGS:=$(CFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
+		CFLAGS:=$(CFLAGS_JDKLIB) \
+		        $(LIBJSOUND_CFLAGS), \
 		CXXFLAGS:=$(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsound/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
+		LDFLAGS_macosx:=-framework CoreAudio -framework CoreFoundation \
+				-framework CoreServices -framework AudioUnit $(LIBCXX) \
+				-framework CoreMIDI -framework AudioToolbox,\
 		LDFLAGS_windows:=$(WIN_JAVA_LIB) advapi32.lib winmm.lib,\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
+		LDFLAGS_SUFFIX:=-ljava -ljvm,\
 		LDFLAGS_SUFFIX_solaris:=-lc ,\
-		LDFLAGS_SUFFIX_macosx:=-framework CoreAudio -framework CoreFoundation \
-             -framework CoreServices -framework AudioUnit $(LIBCXX) \
-             -framework CoreMIDI -framework AudioToolbox ,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsound))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jsound.dll" \
+			  /D "JDK_INTERNAL_NAME=jsound" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsound,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJSOUND) : $(BUILD_LIBJAVA)
 
@@ -2860,7 +3061,7 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsoundalsa/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) -lasound,\
+		LDFLAGS_SUFFIX:=-lasound -ljava -ljvm,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundalsa))
 
 $(BUILD_LIBJSOUNDALSA) : $(BUILD_LIBJAVA)
@@ -2884,10 +3085,16 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			$(LIBJSOUND_CFLAGS) \
 			-DUSE_DAUDIO=TRUE, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB)\
+		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) dsound.lib winmm.lib user32.lib ole32.lib,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundds))
+		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
+		RC_FLAGS:=$(RC_FLAGS)\
+			  /D "JDK_FNAME=jsoundds.dll" \
+			  /D "JDK_INTERNAL_NAME=jsoundds" \
+			  /D "JDK_FTYPE=0x2L",\
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundds,\
+		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
 
 $(BUILD_LIBJSOUNDDS) : $(BUILD_LIBJAVA)
 
@@ -2909,8 +3116,7 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			-I$(JDK_TOPDIR)/src/closed/solaris/native/com/oracle/security/ucrypto ,\
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2ucrypto/mapfile-vers, \
-		LDFLAGS:=$(LDFLAGS_JDKLIB)\
-			 $(call SET_SHARED_LIBRARY_ORIGIN), \
+		LDFLAGS:=$(LDFLAGS_JDKLIB),\
 		LDFLAGS_SUFFIX:=$(LIBDL),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2ucrypto))
 
@@ -2944,11 +3150,11 @@
                         -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN), \
-		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) \
-    -framework Cocoa \
-    -framework Carbon \
-    -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-    -framework JavaNativeFoundation, \
+		LDFLAGS_SUFFIX:=-framework Cocoa \
+                                -framework Carbon \
+                                -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+                                -framework JavaNativeFoundation \
+                                $(LDFLAGS_JDKLIB_SUFFIX),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libAppleScriptEngine))
 
 $(BUILD_LIBAPPLESCRIPTENGINE) : $(BUILD_LIBJAVA)
@@ -3161,20 +3367,19 @@
                         -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks,\
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN), \
-		LDFLAGS_SUFFIX_macosx:=\
-	-lawt -lmlib_image -losxapp $(LDFLAGS_JDKLIB_SUFFIX) $(LIBM) \
-	-framework Accelerate \
-	-framework ApplicationServices \
-	-framework AudioToolbox \
-	-framework Carbon \
-	-framework Cocoa \
-	-framework Security \
-	-framework ExceptionHandling \
-        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-	-framework JavaNativeFoundation \
-	-framework JavaRuntimeSupport \
-	-framework OpenGL \
-        -framework QuartzCore ,\
+		LDFLAGS_SUFFIX_macosx:=-lawt -lmlib_image -losxapp -ljvm $(LIBM) \
+				       -framework Accelerate \
+				       -framework ApplicationServices \
+				       -framework AudioToolbox \
+				       -framework Carbon \
+				       -framework Cocoa \
+				       -framework Security \
+				       -framework ExceptionHandling \
+				       -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+				       -framework JavaNativeFoundation \
+				       -framework JavaRuntimeSupport \
+				       -framework OpenGL \
+				       -framework QuartzCore -ljava,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_lwawt))
 
 BUILD_LIBRARIES += $(BUILD_LIBAWT_LWAWT)
@@ -3216,16 +3421,16 @@
 			-I$(JDK_TOPDIR)/src/macosx/native/sun/awt \
                         -F/System/Library/Frameworks/JavaVM.framework/Frameworks, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
-			 $(call SET_SHARED_LIBRARY_ORIGIN), \
-		LDFLAGS_SUFFIX_macosx:=\
-    $(LDFLAGS_JDKLIB_SUFFIX) \
-    -lawt -losxapp -lawt_lwawt \
-    -framework Cocoa \
-    -framework Carbon \
-    -framework ApplicationServices \
-    -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-    -framework JavaNativeFoundation \
-    -framework JavaRuntimeSupport, \
+			 $(call SET_SHARED_LIBRARY_ORIGIN) \
+			 -Xlinker -rpath -Xlinker @loader_path,\
+		LDFLAGS_SUFFIX_macosx:=-lawt -losxapp -lawt_lwawt \
+				       -framework Cocoa \
+				       -framework Carbon \
+				       -framework ApplicationServices \
+				       -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+				       -framework JavaNativeFoundation \
+				       -framework JavaRuntimeSupport \
+				       -ljava -ljvm,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxui))
 
 BUILD_LIBRARIES += $(BUILD_LIBOSXUI)
@@ -3244,9 +3449,33 @@
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 
-$(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC,\
+# Ugly hack to mimic behaviour in old build where this is built as an xcode project.
+SET_SHARED_LIBRARY_NAME=-Xlinker -install_name -Xlinker /usr/local/lib/libJObjC.dylib
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC32,\
 		LIBRARY:=JObjC,\
-                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
+                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc32,\
+		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/native \
+                     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/native ,\
+		LANG:=C,\
+		OPTIMIZATION:=LOW, \
+		CFLAGS:=-fpascal-strings \
+                        -fobjc-gc \
+                        -gdwarf-2 \
+                        $(CFLAGS_JDKLIB) \
+                        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+			-m32,\
+		LDFLAGS:=$(LDFLAGS_JDKLIB)\
+			-m32, \
+		LDFLAGS_SUFFIX:=-framework Foundation -framework JavaVM \
+                                  -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+                                  -framework JavaNativeFoundation \
+                                  -lffi, \
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc32))
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC64,\
+		LIBRARY:=JObjC,\
+                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc64,\
 		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/native \
                      $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/native ,\
 		LANG:=C,\
@@ -3266,9 +3495,12 @@
                                   -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                                   -framework JavaNativeFoundation \
                                   -lffi, \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc))
-
-BUILD_LIBRARIES += $(BUILD_LIBJOBJC)
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc64))
+
+$(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX): $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
+	$(LIPO) -create -output $@ $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
+
+BUILD_LIBRARIES += $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX)
 
 endif
 
--- a/makefiles/CopyFiles.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/CopyFiles.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -47,12 +47,12 @@
 
 $(INCLUDEDIR)/%.h: $(JDK_TOPDIR)/src/share/javavm/export/%.h
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
-$(OPENJDK_TARGET_OS_INCLUDE)/%.h: $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/javavm/export/%.h
+$(OPENJDK_TARGET_OS_INCLUDE)/%.h: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export/%.h
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES = $(H_TARGET_FILES)
@@ -64,7 +64,7 @@
 
 $(SERVICETAG_LIBDIR)/jdk_header.png: $(JDK_TOPDIR)/src/share/classes/com/sun/servicetag/resources/jdk_header.png
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 444 $@
 
@@ -79,20 +79,20 @@
 
 $(MGMT_LIBDIR)/management.properties: $(MGMT_LIB_SRC)/management.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 644 $@
 
 # this file has different permissions...don't know why...
 $(MGMT_LIBDIR)/jmxremote.access: $(MGMT_LIB_SRC)/jmxremote.access
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 644 $@
 
 $(MGMT_LIBDIR)/%: $(MGMT_LIB_SRC)/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 444 $@
 
@@ -104,7 +104,7 @@
 
 $(LIBDIR)/logging.properties: $(LOGGING_LIB_SRC)/logging.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/logging.properties
@@ -119,7 +119,7 @@
 
 $(LIBDIR)/%: $(PSFONTPROPFILE_SRC_DIR)/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(PSFONTPROPFILE_TARGET_FILES)
@@ -129,24 +129,24 @@
 # Copy flavormap.properties, cursor.properties and cursors gif files to LIBDIR
 #
 ifneq ($(OPENJDK_TARGET_OS), macosx)
-OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/lib
+OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
 else
 OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/macosx/lib
 endif
 
 $(LIBDIR)/flavormap.properties: $(OPENJDK_TARGET_OS_LIB_SRC)/flavormap.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/flavormap.properties
 
 CURSORS_DEST_DIR = $(LIBDIR)/images/cursors
-CURSORS_OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/lib/images/cursors
+CURSORS_OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib/images/cursors
 
 $(CURSORS_DEST_DIR)/cursors.properties: $(CURSORS_OPENJDK_TARGET_OS_LIB_SRC)/cursors.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(CURSORS_DEST_DIR)/cursors.properties
@@ -161,18 +161,18 @@
 
 $(CURSORS_DEST_DIR)/%: $(CURSORS_LIB_SRC)/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(CURSORS_TARGET_FILES)
 
 ##########################################################################################
 
-CONTENT_TYPES_SRC=$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/lib
+CONTENT_TYPES_SRC=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
 
 $(LIBDIR)/content-types.properties: $(CONTENT_TYPES_SRC)/content-types.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/content-types.properties
@@ -183,7 +183,7 @@
 
 $(LIBDIR)/calendars.properties: $(CALENDARS_SRC)/calendars.properties
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/calendars.properties
@@ -192,11 +192,11 @@
 
 ifeq ($(OPENJDK_TARGET_OS),windows)
 
-TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/lib
+TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
 
 $(LIBDIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/tzmappings
@@ -218,7 +218,7 @@
 
 $(ICCPROFILE_DEST_DIR)%.pf: $(ICCPROFILE_SRC_DIR)%.pf
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 444 $@
 
@@ -248,7 +248,7 @@
         FREETYPE_LIB = $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype)
     else 
         ifeq ($(USING_SYSTEM_FT_LIB), false)
-            FREETYPE_LIB = $(JDK_OUTPUTDIR)/lib/$(LIBARCH)/$(call SHARED_LIBRARY,freetype).6
+            FREETYPE_LIB = $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6
         endif
     endif 
 
@@ -269,7 +269,7 @@
     MSVCRNN_TARGET := $(JDK_OUTPUTDIR)/bin/$(notdir $(MSVCRNN_DLL))
     $(MSVCRNN_TARGET): $(MSVCRNN_DLL)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
     COPY_FILES += $(MSVCRNN_TARGET)
@@ -281,7 +281,7 @@
 
 $(LIBDIR)/jvm.hprof.txt : $(HPROF_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(LIBDIR)/jvm.hprof.txt
@@ -292,26 +292,21 @@
 # How to install jvm.cfg.
 #
 ifeq ($(JVM_VARIANT_ZERO), true)
-JVMCFG_ARCH := zero
+    JVMCFG_ARCH := zero
 else
-    JVMCFG_ARCH := $(ARCH)
+    JVMCFG_ARCH := $(OPENJDK_TARGET_CPU_LEGACY)
 endif
 
 ifeq ($(OPENJDK_TARGET_OS),macosx)
-  ifeq ($(JVMCFG_ARCH),amd64)
-      JVMCFG_ARCH := x86_64
-  endif
   JVMCFG_SRC := $(JDK_TOPDIR)/src/macosx/bin/$(JVMCFG_ARCH)/jvm.cfg
-  JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib
 else
-  JVMCFG_SRC := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/$(JVMCFG_ARCH)/jvm.cfg
-  JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib/$(LIBARCH)
+  JVMCFG_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/$(JVMCFG_ARCH)/jvm.cfg
 endif
-
+JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
 JVMCFG := $(JVMCFG_DIR)/jvm.cfg
 
 
-ifeq ($(ARCH_DATA_MODEL),32)
+ifeq ($(OPENJDK_TARGET_CPU_BITS),32)
     # On 32 bit machines, we can have client and/or server libjvms installed.
     # Since the currently committed jvm.cfg expects clientANDserver, we need 
     # to patch the jvm.cfg when we have built only a client or only a server.
@@ -320,7 +315,7 @@
         # Create a patched jvm.cfg to use -client by default and alias -server to -client.
         $(JVMCFG):
 		$(MKDIR) -p $(@D)
-		$(RM) -f $(JVMCFG)
+		$(RM) $(JVMCFG)
 		$(PRINTF) "-client KNOWN\n">$(JVMCFG)
 		$(PRINTF) "-server IGNORE\n">>$(JVMCFG)
 		$(PRINTF) "-hotspot ALIASED_TO -client\n">>$(JVMCFG)
@@ -334,7 +329,7 @@
 
             $(JVMCFG):
 		$(MKDIR) -p $(@D)
-		$(RM) -f $(JVMCFG)
+		$(RM) $(JVMCFG)
 		$(PRINTF) "-server KNOWN\n">$(JVMCFG)
 		$(PRINTF) "-client IGNORE\n">>$(JVMCFG)
 		$(PRINTF) "-hotspot IGNORE\n">>$(JVMCFG)
@@ -345,7 +340,7 @@
             # Use the default jvm.cfg for this 32 bit setup. 
             $(JVMCFG): $(JVMCFG_SRC)
 	    	$(MKDIR) -p $(@D)
-		$(RM) -f $@
+		$(RM) $@
 		$(CP) $< $@
         endif
     endif
@@ -353,7 +348,7 @@
     # Use the default jvm.cfg for this 64 bit setup.
     $(JVMCFG): $(JVMCFG_SRC)
 		$(MKDIR) -p $(@D)
-		$(RM) -f $@
+		$(RM) $@
 		$(CP) $< $@
 endif
 
@@ -378,7 +373,7 @@
 
 $(PROPS_DST): $(PROPS_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(PROPS_DST)
@@ -390,7 +385,7 @@
 
 $(POLICY_DST): $(POLICY_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(POLICY_DST)
@@ -402,7 +397,7 @@
 
 $(CACERTS_DST): $(CACERTS_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(CACERTS_DST)
@@ -419,14 +414,14 @@
 
 $(BLACKLIST_DST): $(BLACKLIST_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(BLACKLIST_DST)
 
 $(TRUSTEDLIBS_DST): $(TRUSTEDLIBS_SRC)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(TRUSTEDLIBS_DST)
@@ -462,7 +457,11 @@
 	$(RM) $@
 	$(CP) $< $@
 
-COPY_FILES += $(SHARED_FONTS_DST) $(SHARED_FONTS_DST_DIR)/fonts.dir
+COPY_FILES += $(SHARED_FONTS_DST)
+
+ifneq ($(OPENJDK_TARGET_OS), windows)
+    COPY_FILES += $(SHARED_FONTS_DST_DIR)/fonts.dir
+endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
 
@@ -537,21 +536,21 @@
 
 _DGALIBS_amd64 = 	# no amd64 library yet
 
-DGALIBS = $(_DGALIBS_$(ARCH):%=$(JDK_OUTPUTDIR)/lib/$(LIBARCH)/%)
+DGALIBS = $(_DGALIBS_$(OPENJDK_TARGET_CPU_LEGACY):%=$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/%)
 
-$(JDK_OUTPUTDIR)/lib/$(LIBARCH)/libxinerama.so: $(JDK_TOPDIR)/src/closed/solaris/lib/$(ARCH)/libxinerama.so
+$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libxinerama.so: $(JDK_TOPDIR)/src/closed/solaris/lib/$(OPENJDK_TARGET_CPU_LEGACY)/libxinerama.so
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 755 $@
 
-$(JDK_OUTPUTDIR)/lib/$(LIBARCH)/libjdgaSUNW%.so: $(JDK_TOPDIR)/src/closed/solaris/lib/$(ARCH)/libjdgaSUNW%.so
+$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjdgaSUNW%.so: $(JDK_TOPDIR)/src/closed/solaris/lib/$(OPENJDK_TARGET_CPU_LEGACY)/libjdgaSUNW%.so
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 	$(CHMOD) 755 $@
 
-$(JDK_OUTPUTDIR)/lib/$(LIBARCH)/libjdgaSUNWafb.so: $(JDK_OUTPUTDIR)/lib/$(LIBARCH)/libjdgaSUNWffb.so
+$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjdgaSUNWafb.so: $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjdgaSUNWffb.so
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s $< $@
--- a/makefiles/CopyIntoClasses.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/CopyIntoClasses.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -174,11 +174,11 @@
 $(shell $(MKDIR) -p $(JDK_OUTPUTDIR)/classes/META-INF/services)
 # Find all META-INF/services/* files
 ALL_META-INF_DIRS_share:=$(shell $(FIND) $(JDK_TOPDIR)/src/share/classes -type d -a -name META-INF)
-ALL_META-INF_DIRS_targetapi:=$(shell $(FIND) $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes -type d -a -name META-INF)
+ALL_META-INF_DIRS_targetapi:=$(shell $(FIND) $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes -type d -a -name META-INF)
 # Platform specific overrides shared
 ifneq ($(ALL_META-INF_DIRS_targetapi),)
     ALL_META-INF_DIRS:=$(ALL_META-INF_DIRS_targetapi) \
-	$(filter-out %$(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes%,%,$(ALL_META-INF_DIRS_targetapi)),\
+	$(filter-out %$(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes%,%,$(ALL_META-INF_DIRS_targetapi)),\
 		$(ALL_META-INF_DIRS_share))
 else
     ALL_META-INF_DIRS:=$(ALL_META-INF_DIRS_share)
@@ -216,9 +216,9 @@
 	$(shell $(PRINTF) "$(SRC_SERVICES_FILES)\n" | $(SED) -e 's|/[^ ]*/META-INF/services/||g'))
 OUT_SERVICES_FILES_COLON:=$(addsuffix :,$(OUT_SERVICES_FILES))
 # Exception handling for print services with no META-INF directory
-SRC_SERVICES_FILES_PRINT = $(wildcard $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/sun/print/services/*)
+SRC_SERVICES_FILES_PRINT = $(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/print/services/*)
 OUT_SERVICES_FILES_PRINT = $(addprefix $(JDK_OUTPUTDIR)/classes/META-INF/services/,\
-	$(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/sun/print/services/%,%,\
+	$(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/print/services/%,%,\
 		$(SRC_SERVICES_FILES_PRINT)))
 OUT_SERVICES_FILES_PRINT_COLON = $(addsuffix :,$(OUT_SERVICES_FILES_PRINT))
 RULES_SERVICES_PRINT = $(join $(OUT_SERVICES_FILES_PRINT_COLON),$(SRC_SERVICES_FILES_PRINT))
@@ -257,23 +257,10 @@
             javax.sound.midi.spi.SoundbankReader \
             javax.sound.sampled.spi.AudioFileReader \
             javax.sound.sampled.spi.AudioFileWriter \
-            javax.sound.sampled.spi.FormatConversionProvider
+            javax.sound.sampled.spi.FormatConversionProvider \
+            javax.sound.sampled.spi.MixerProvider
 
-COPY_EXTRA += $(foreach F,$(notdir $(JAVAX_SOUND_SRC_FILES)),$(JDK_OUTPUTDIR)/classes/META-INF/services/${F})
-
-ifeq ($(OPENJDK_TARGET_OS)-$(ARCH),windows-ia64)
-	JAVAX_SOUND_SRC_FILES += windows-ia64/javax.sound.sampled.spi.MixerProvider
-	COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/META-INF/services/javax.sound.sampled.spi.MixerProvider
-else ifeq ($(OPENJDK_TARGET_OS),windows)
-	JAVAX_SOUND_SRC_FILES += windows-i586/javax.sound.sampled.spi.MixerProvider
-	COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/META-INF/services/javax.sound.sampled.spi.MixerProvider
-else ifeq ($(OPENJDK_TARGET_OS)-$(ARCH),linux-i586)
-	JAVAX_SOUND_SRC_FILES += linux-i586/javax.sound.sampled.spi.MixerProvider
-	COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/META-INF/services/javax.sound.sampled.spi.MixerProvider
-else
-	JAVAX_SOUND_SRC_FILES += javax.sound.sampled.spi.MixerProvider
-	COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/META-INF/services/javax.sound.sampled.spi.MixerProvider
-endif
+COPY_EXTRA += $(addprefix $(JDK_OUTPUTDIR)/classes/META-INF/services/,$(JAVAX_SOUND_SRC_FILES))
 
 JAVAX_SOUND_RULES := $(foreach F,$(JAVAX_SOUND_SRC_FILES),$(JDK_OUTPUTDIR)/classes/META-INF/services/$(notdir $F):$(JAVAX_SOUND_SRC)/$F)
 
--- a/makefiles/CopySamples.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/CopySamples.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -54,17 +54,17 @@
 
 $(SAMPLE_TARGET_DIR)/dtrace/%: $(SAMPLE_SOLARIS_SOURCE_DIR)/dtrace/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 $(SAMPLE_TARGET_DIR)/webservices/%: $(SAMPLE_CLOSED_SOURCE_DIR)/webservices/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 $(SAMPLE_TARGET_DIR)/%: $(SAMPLE_SOURCE_DIR)/%
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@
+	$(RM) $@
 	$(CP) $< $@
 
 COPY_FILES += $(SAMPLE_TARGET)
--- a/makefiles/CreateJars.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/CreateJars.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -151,10 +151,12 @@
 	sun/security/ec/ECDSASignature\$$$$SHA384.class \
 	sun/security/ec/ECDSASignature\$$$$SHA512.class \
 	sun/security/ec/ECDSASignature.class \
+	sun/security/ec/ECKeyFactory.class \
 	sun/security/ec/ECKeyPairGenerator.class \
 	sun/security/ec/SunEC\$$$$1.class \
 	sun/security/ec/SunEC.class \
 	sun/security/ec/SunECEntries.class \
+	sun/security/mscapi \
 	sun/security/pkcs11 \
 	com/sun/net/ssl/internal/ssl \
 	javax/crypto \
@@ -260,50 +262,64 @@
 
 # Find all files in the classes dir to use as dependencies. This could be more fine granular.
 ALL_FILES_IN_CLASSES := $(shell $(FIND) $(JDK_OUTPUTDIR)/classes -type f \
-			| $(GREP) -v -e '/_the\.*' -e '^_the\.*')
+			| $(GREP) -v -e '/_the\.*' -e '^_the\.*' -e 'javac_state')
 
 RT_JAR_MANIFEST_FILE := $(JDK_OUTPUTDIR)/lib/_the.rt.jar_manifest
 RESOURCE_JAR_MANIFEST_FILE := $(JDK_OUTPUTDIR)/lib/_the.resources.jar_manifest
 
 $(RT_JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" 		\
 	       -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
-	       $(MAINMANIFEST) >> $@
-	$(ECHO) >> $@
-	$(CAT) $(BEANMANIFEST) >> $@
+	       $(MAINMANIFEST) >> $@.tmp
+	$(ECHO) >> $@.tmp
+	$(CAT) $(BEANMANIFEST) >> $@.tmp
+	$(MV) $@.tmp $@
 
 $(RESOURCE_JAR_MANIFEST_FILE): $(MAINMANIFEST)
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" 		\
 	       -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
-	       $(MAINMANIFEST) >> $@
+	       $(MAINMANIFEST) >> $@.tmp
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/_the.jars.exclude: $(MAKEFILE)
 	$(MKDIR) -p $(@D)
-	$(call ListPathsSafely,RT_JAR_EXCLUDES,\n, >> $@)
+	$(RM) $@ $@.tmp
+	$(call ListPathsSafely,RT_JAR_EXCLUDES,\n, >> $@.tmp)
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/classlist : $(JDK_TOPDIR)/make/tools/sharing/classlist.$(OPENJDK_TARGET_OS) \
   $(MAKEFILE)
 	$(MKDIR) -p $(@D)
-	$(RM) -f $@.temp
-	$(TOOL_ADDJSUM) $< $@.temp
-	$(MV) $@.temp $@
+	$(RM) $@ $@.tmp
+	$(TOOL_ADDJSUM) $< $@.tmp
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/_the.jars.contents: $(BUILD_TOOLS) $(JDK_OUTPUTDIR)/lib/_the.jars.exclude \
 					 $(ALL_FILES_IN_CLASSES) $(JDK_OUTPUTDIR)/lib/classlist
 	$(MKDIR) -p $(@D)
-	$(RM) $@.temp
+	$(RM) $@ $@.tmp
 	($(CD) $(JDK_OUTPUTDIR)/classes && \
 	    $(TOOL_JARREORDER) \
-		-o  $@.temp $(JDK_OUTPUTDIR)/lib/classlist $(JDK_OUTPUTDIR)/lib/_the.jars.exclude . )
-	$(MV) $@.temp $@
+		-o  $@.tmp $(JDK_OUTPUTDIR)/lib/classlist $(JDK_OUTPUTDIR)/lib/_the.jars.exclude . )
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/_the.rt.jar.contents: $(JDK_OUTPUTDIR)/lib/_the.jars.contents
-	$(GREP) -e '\.class$$' $(JDK_OUTPUTDIR)/lib/_the.jars.contents > $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
+	$(GREP) -e '\.class$$' $(JDK_OUTPUTDIR)/lib/_the.jars.contents > $@.tmp
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/_the.resources.jar.contents: $(JDK_OUTPUTDIR)/lib/_the.jars.contents
-	$(GREP) -v -e '\.class$$' -e '/_the\.*' -e '^_the\.*' $(JDK_OUTPUTDIR)/lib/_the.jars.contents > $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
+	$(GREP) -v -e '\.class$$' \
+	    -e '/_the\.*' -e '^_the\.*' -e '\\_the\.*' -e 'javac_state' \
+	    $(JDK_OUTPUTDIR)/lib/_the.jars.contents > $@.tmp
+	$(MV) $@.tmp $@
 
 RT_JAR_CREATE_OPTIONS := c0fm
 ifeq ($(COMPRESS_JARS), true)
@@ -312,16 +328,22 @@
 
 $(JDK_OUTPUTDIR)/lib/rt.jar: $(JDK_OUTPUTDIR)/lib/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE)
 	$(ECHO) Creating rt.jar
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(CD) $(JDK_OUTPUTDIR)/classes && \
-	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@ $(RT_JAR_MANIFEST_FILE) \
+	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RT_JAR_MANIFEST_FILE) \
 	        @$(JDK_OUTPUTDIR)/lib/_the.rt.jar.contents
+	$(MV) $@.tmp $@
 
 $(JDK_OUTPUTDIR)/lib/resources.jar: $(JDK_OUTPUTDIR)/lib/_the.resources.jar.contents \
 				    $(RESOURCE_JAR_MANIFEST_FILE)
 	$(ECHO) Creating resources.jar
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(CD) $(JDK_OUTPUTDIR)/classes && \
-	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@ $(RESOURCE_JAR_MANIFEST_FILE) \
+	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RESOURCE_JAR_MANIFEST_FILE) \
 	        @$(JDK_OUTPUTDIR)/lib/_the.resources.jar.contents
+	$(MV) $@.tmp $@
 
 JARS+=$(JDK_OUTPUTDIR)/lib/rt.jar $(JDK_OUTPUTDIR)/lib/resources.jar
 
@@ -385,31 +407,30 @@
 
 ##########################################################################################
 
-ifneq ($(OPENJDK_TARGET_OS)-$(ARCH_DATA_MODEL),windows-64)
-    SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
+SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
 
-    ifndef OPENJDK
+ifndef OPENJDK
 
-        SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
+    SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
 
-        $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
-		@$(ECHO) "\n>>>Installing prebuilt SunPKCS11 provider..."
-		$(RM) $@
-		$(CP) $< $@
+    $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
+	@$(ECHO) "\n>>>Installing prebuilt SunPKCS11 provider..."
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(CP) $< $@
 
-    else
+else
 
-         $(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR,$(SUNPKCS11_JAR_DEPS),\
-		SRCS:=$(JDK_OUTPUTDIR)/classes, \
-		SUFFIXES:=.class,\
-		INCLUDES:=sun/security/pkcs11,\
-		JAR:=$(SUNPKCS11_JAR_DST), \
-		SKIP_METAINF := true))
+    $(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR,$(SUNPKCS11_JAR_DEPS),\
+	SRCS:=$(JDK_OUTPUTDIR)/classes, \
+	SUFFIXES:=.class,\
+	INCLUDES:=sun/security/pkcs11,\
+	JAR:=$(SUNPKCS11_JAR_DST), \
+	SKIP_METAINF := true))
 
-    endif
+endif
 
-    JARS += $(SUNPKCS11_JAR_DST)
-endif
+JARS += $(SUNPKCS11_JAR_DST)
 
 ##########################################################################################
 
@@ -421,6 +442,7 @@
 
 $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
 	@$(ECHO) "\n>>>Installing prebuilt SunEC provider..."
+	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 
@@ -430,12 +452,6 @@
 		SRCS:=$(JDK_OUTPUTDIR)/classes, \
 		SUFFIXES:=.class,\
 		INCLUDES:=sun/security/ec,\
-		EXCLUDE_FILES := sun/security/ec/ECKeyFactory.class \
-			sun/security/ec/ECParameters.class \
-			sun/security/ec/ECPrivateKeyImpl.class \
-			sun/security/ec/ECPublicKeyImpl.class \
-			sun/security/ec/NamedCurve.class \
-			sun/security/ec/ECKeyFactory*,\
 		JAR:=$(SUNEC_JAR_DST), \
 		SKIP_METAINF := true))
 
@@ -465,6 +481,7 @@
 
     $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC)
 	@$(ECHO) "\n>>>Installing prebuilt SunJCE provider..."
+	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 else
@@ -489,6 +506,7 @@
 
 $(JCE_JAR_DST) : $(JCE_JAR_SRC)
 	@$(ECHO) "\n>>>Installing prebuilt jce.jar..."
+	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 
@@ -520,6 +538,7 @@
 
 $(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 
 US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
@@ -552,6 +571,7 @@
 
 $(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 
 $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
@@ -576,6 +596,7 @@
 
 $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC)
 	@$(ECHO) "\n>>>Installing prebuilt SunMSCAPI provider..."
+	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 
@@ -586,9 +607,9 @@
 		SUFFIXES:=.class,\
 		INCLUDES:= sun/security/mscapi,\
 		JAR:=$(SUNMSCAPI_JAR_DST), \
-		MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \
-		EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
-		SKIP_METAINF := true))
+		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf, \
+		EXTRA_MANIFEST_ATTR:=Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
+		SKIP_METAINF:=true))
 endif
 
 JARS += $(SUNMSCAPI_JAR_DST)
@@ -605,6 +626,7 @@
 
 $(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC)
 	@$(ECHO) "\n>>>Installing prebuilt OracleUcrypto provider..."
+	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
 
@@ -711,8 +733,8 @@
 
 ##########################################################################################
 
-include $(JDK_TOPDIR)/makefiles/docs/CORE_PKGS.gmk
-include $(JDK_TOPDIR)/makefiles/docs/NON_CORE_PKGS.gmk
+include javadoc/CORE_PKGS.gmk
+include javadoc/NON_CORE_PKGS.gmk
 
 # The compiler should not issue a "Proprietary" warning when compiling
 # classes in the com.sun.java.swing.plaf packages, since we've always
@@ -740,7 +762,7 @@
                         com.oracle.nio
 
 $(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(JDK_OUTPUTDIR)/lib/rt.jar
-	$(RM) -rf $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
+	$(RM) -r $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
 	$(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
 	$(JAVA) \
 		-Xbootclasspath/a:$(JDK_OUTPUTDIR)/classes \
@@ -808,9 +830,10 @@
 	org/ietf			\
 	org/omg				\
 	org/w3c/dom			\
-	org/xml/sax
+	org/xml/sax			\
+	sunw
 
-SRC_ZIP_SRCS = $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes
+SRC_ZIP_SRCS = $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes
 SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/gensrc
 SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/impsrc
 SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/gendocsrc_rmic
@@ -821,17 +844,19 @@
 # Need to copy launcher src files into desired directory structure
 # before zipping the sources.
 LAUNCHER_SRC_FILES := $(wildcard $(JDK_TOPDIR)/src/share/bin/*) \
-                      $(wildcard $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/java_md*)
+                      $(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/java_md*)
 LAUNCHER_ZIP_SRC := $(patsubst $(JDK_TOPDIR)/src/share/bin/%,$(IMAGES_OUTPUTDIR)/src/launcher/%,\
-		    $(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/%,$(IMAGES_OUTPUTDIR)/src/launcher/%,\
+		    $(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/%,$(IMAGES_OUTPUTDIR)/src/launcher/%,\
 			$(LAUNCHER_SRC_FILES)))
 
 $(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/share/bin/%
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 
-$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/%
+$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/%
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 
 $(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC)
@@ -849,6 +874,10 @@
 
 ##########################################################################################
 
+-include $(CUSTOM_MAKE_DIR)/CreateJars.gmk
+
+##########################################################################################
+
 all: $(JARS)
 
 .PHONY: default all
--- a/makefiles/GendataBreakIterator.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GendataBreakIterator.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -48,10 +48,12 @@
 # two files in that directory and not get anything implicit from
 # surrounding directories which aren't jdk 6 compatible. 
 # Because we are targeting jdk 6, but the surrounding source code is jdk 7. Ugh.
-# These two files should be moved out to a build tool!
+# These two files should be moved out to a build tool! We have to disable
+# sjavac here as well.
 $(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR,\
 		SETUP:=GENERATE_OLDBYTECODE,\
 		SRC:=$(TEXT_SRCDIR),\
+		DISABLE_SJAVAC:=true,\
 		JAVAC_SOURCE_PATH_UGLY_OVERRIDE:=$(TEXT_SRCDIR)/$(TEXT_PKG),\
 		INCLUDES:=$(TEXT_PKG),\
 		INCLUDE_FILES:=$(TEXT_SOURCES),\
@@ -70,23 +72,23 @@
 BIFILES_TH =	$(DATA_PKG_DIR)/th/WordBreakIteratorData_th \
 		$(DATA_PKG_DIR)/th/LineBreakIteratorData_th
 
-$(BIFILES): $(BREAK_ITERATOR_DIR)/_the.bifiles
-$(BREAK_ITERATOR_DIR)/_the.bifiles: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
-$(BREAK_ITERATOR_DIR)/_the.bifiles: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
+$(BIFILES): $(DATA_PKG_DIR)/_the.bifiles
+$(DATA_PKG_DIR)/_the.bifiles: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
+$(DATA_PKG_DIR)/_the.bifiles: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
 	$(ECHO) "Generating BreakIteratorData"
 	$(MKDIR) -p  $(DATA_PKG_DIR)
-	$(RM) -f $(BIFILES)
+	$(RM) $(BIFILES)
 	$(TOOL_GENERATEBREAKITERATORDATA) \
 		-o $(DATA_PKG_DIR) \
 		-spec $(UNICODEDATA)
 	$(TOUCH) $@
 
-$(BIFILES_TH): $(BREAK_ITERATOR_DIR)/_the.bifiles_th
-$(BREAK_ITERATOR_DIR)/_the.bifiles_th: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
-$(BREAK_ITERATOR_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
+$(BIFILES_TH): $(DATA_PKG_DIR)/_the.bifiles_th
+$(DATA_PKG_DIR)/_the.bifiles_th: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
+$(DATA_PKG_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
 	$(ECHO) "Generating BreakIteratorData_th"
 	$(MKDIR) -p  $(DATA_PKG_DIR)/th
-	$(RM) -f $(BIFILES_TH)
+	$(RM) $(BIFILES_TH)
 	$(TOOL_GENERATEBREAKITERATORDATA) \
 		-o $(DATA_PKG_DIR) \
 		-spec $(UNICODEDATA) \
--- a/makefiles/GendataFontConfig.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GendataFontConfig.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -26,53 +26,61 @@
 GENDATA_FONT_CONFIG_DST := $(JDK_OUTPUTDIR)/lib
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-GENDATA_FONT_CONFIG_SRC_DIR    := $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows
-GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
-GENDATA_FONT_CONFIG_SRC_PREFIX := 
+  GENDATA_FONT_CONFIG_SRC_DIR    := $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows
+  GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
+  GENDATA_FONT_CONFIG_SRC_PREFIX := 
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
-GENDATA_FONT_CONFIG_SRC_PREFIX := linux.
-ifdef OPENJDK
-GENDATA_FONT_CONFIG_SRC_DIR   := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/fontconfigs
-GENDATA_FONT_CONFIG_SRC_FILES := \
+  GENDATA_FONT_CONFIG_SRC_PREFIX := linux.
+  ifdef OPENJDK
+    GENDATA_FONT_CONFIG_SRC_DIR   := \
+        $(JDK_TOPDIR)/src/solaris/classes/sun/awt/fontconfigs
+    GENDATA_FONT_CONFIG_SRC_FILES := \
 	fontconfig.properties \
 	fontconfig.SuSE.properties \
 	fontconfig.Ubuntu.properties \
 	fontconfig.Fedora.properties
-else
-GENDATA_FONT_CONFIG_SRC_DIR   := $(JDK_TOPDIR)/src/closed/solaris/classes/sun/awt/fontconfigs
-GENDATA_FONT_CONFIG_SRC_FILES := \
+  else
+    GENDATA_FONT_CONFIG_SRC_DIR   := \
+        $(JDK_TOPDIR)/src/closed/solaris/classes/sun/awt/fontconfigs
+    GENDATA_FONT_CONFIG_SRC_FILES := \
 	fontconfig.properties				\
 	fontconfig.RedHat.5.properties			\
 	fontconfig.RedHat.6.properties			\
 	fontconfig.Turbo.properties			\
 	fontconfig.SuSE.10.properties                   \
 	fontconfig.SuSE.11.properties
-endif
+  endif
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-GENDATA_FONT_CONFIG_SRC_DIR    := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/fontconfigs
-GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
-GENDATA_FONT_CONFIG_SRC_PREFIX := solaris.
+  GENDATA_FONT_CONFIG_SRC_DIR    := \
+      $(JDK_TOPDIR)/src/solaris/classes/sun/awt/fontconfigs
+  GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
+  GENDATA_FONT_CONFIG_SRC_PREFIX := solaris.
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-GENDATA_FONT_CONFIG_SRC_DIR    := $(JDK_TOPDIR)/src/macosx/classes/sun/awt/fontconfigs
-GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
-GENDATA_FONT_CONFIG_SRC_PREFIX := macosx.
-endif # OPENJDK_TARGET_OS
+  GENDATA_FONT_CONFIG_SRC_DIR    := \
+      $(JDK_TOPDIR)/src/macosx/classes/sun/awt/fontconfigs
+  GENDATA_FONT_CONFIG_SRC_FILES  := fontconfig.properties
+  GENDATA_FONT_CONFIG_SRC_PREFIX := macosx.
+endif
 
 ###
 
-$(GENDATA_FONT_CONFIG_DST)/%.src : $(GENDATA_FONT_CONFIG_SRC_DIR)/$(GENDATA_FONT_CONFIG_SRC_PREFIX)%
+$(GENDATA_FONT_CONFIG_DST)/%.src : \
+    $(GENDATA_FONT_CONFIG_SRC_DIR)/$(GENDATA_FONT_CONFIG_SRC_PREFIX)%
+	$(RM) $@
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 	$(CHMOD) 644 $@
 
-$(GENDATA_FONT_CONFIG_DST)/%.bfc : $(GENDATA_FONT_CONFIG_SRC_DIR)/$(GENDATA_FONT_CONFIG_SRC_PREFIX)%.properties
+$(GENDATA_FONT_CONFIG_DST)/%.bfc : \
+    $(GENDATA_FONT_CONFIG_SRC_DIR)/$(GENDATA_FONT_CONFIG_SRC_PREFIX)%.properties
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(TOOL_COMPILEFONTCONFIG) $< $@
 	$(CHMOD) 444 $@
 
@@ -84,3 +92,4 @@
 GENDATA_FONT_CONFIG := $(GENDATA_FONT_CONFIGS) $(GENDATA_BFONT_CONFIGS)
 
 ###
+
--- a/makefiles/GendataTimeZone.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GendataTimeZone.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -46,9 +46,9 @@
 GENDATA_TIMEZONE_MAPFILE:=ZoneInfoMappings
 
 $(GENDATA_TIMEZONE_DST)/$(GENDATA_TIMEZONE_MAPFILE) : $(TZFILES)
-	$(RM) -rf $(GENDATA_TIMEZONE_TMP)
+	$(RM) -r $(GENDATA_TIMEZONE_TMP)
 	$(MKDIR) -p $(GENDATA_TIMEZONE_TMP)
-	$(RM) -rf $(GENDATA_TIMEZONE_DST)
+	$(RM) -r $(GENDATA_TIMEZONE_DST)
 	$(MKDIR) -p $(GENDATA_TIMEZONE_DST)
 	$(TOOL_JAVAZIC) -V "$(GENDATA_TIMEZONE_VERSION)" -d $(GENDATA_TIMEZONE_TMP) $(TZFILES)
 	$(CP) -r $(GENDATA_TIMEZONE_TMP)/* $(GENDATA_TIMEZONE_DST)/
--- a/makefiles/GenerateClasses.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GenerateClasses.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -31,7 +31,7 @@
 
 # To ensure the latest stub generator files are picked up from corba repo
 # when available, we need to run with latest rmic version available. 
-ifeq ($(CROSS_COMPILE_ARCH),)
+ifneq ($(COMPILE_TYPE),cross)
     RMIC := $(UNCYGDRIVE) $(JDK_OUTPUTDIR)/bin/rmic
 endif  
 
--- a/makefiles/GenerateData.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GenerateData.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -67,8 +67,8 @@
 $(GENDATA_CURDATA): $(JDK_TOPDIR)/src/share/classes/java/util/CurrencyData.properties $(BUILD_TOOLS)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-	$(TOOL_GENERATECURRENCYDATA) -o $@.temp < $<
-	$(MV) $@.temp $@
+	$(TOOL_GENERATECURRENCYDATA) -o $@.tmp < $<
+	$(MV) $@.tmp $@
 	$(CHMOD) 444 $@
 
 GENDATA += $(GENDATA_CURDATA)
@@ -77,6 +77,9 @@
 
 $(GENDATA) : $(BUILD_TOOLS)
 
-all: $(GENDATA)
+$(JDK_OUTPUTDIR)/classes/_the.gendata : $(GENDATA)
+	$(TOUCH) $@
+
+all: $(JDK_OUTPUTDIR)/classes/_the.gendata
 
 .PHONY: all
--- a/makefiles/GensrcBuffer.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GensrcBuffer.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -226,7 +226,7 @@
 	endif
 
 $$($1_DST) : $$($1_DEP) $(GENSRC_BUFFER_DST)/_the.dir
-	$(TOOL_SPP) < $$($1_SRC) > $$($1_OUT).temp \
+	$(TOOL_SPP) < $$($1_SRC) > $$($1_OUT).tmp \
 		-K$$($1_type) \
 		-K$$($1_category) \
 		-Dtype=$$($1_type) \
@@ -248,19 +248,19 @@
 		-Da=$$($1_a) \
 		-DA=$$($1_A) \
 		-Kbo$$($1_BO)
-		$(MV) $$($1_OUT).temp $$($1_OUT)
+		$(MV) $$($1_OUT).tmp $$($1_OUT)
 # Do the extra bin thing
 ifeq ($$($1_BIN),1)
-	$(SED) -e '/#BIN/,$$$$d' < $$($1_OUT) > $$($1_DST).temp
+	$(SED) -e '/#BIN/,$$$$d' < $$($1_OUT) > $$($1_DST).tmp
 	$(RM) $$($1_OUT)
-	$$($1_char_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$$($1_short_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$$($1_int_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$$($1_long_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$$($1_float_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$$($1_double_CMD) < $$($1_SRC_BIN) >> $$($1_DST).temp
-	$(PRINTF) "}\n" >> $$($1_DST).temp
-	mv $$($1_DST).temp $$($1_DST)
+	$$($1_char_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$$($1_short_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$$($1_int_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$$($1_long_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$$($1_float_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$$($1_double_CMD) < $$($1_SRC_BIN) >> $$($1_DST).tmp
+	$(PRINTF) "}\n" >> $$($1_DST).tmp
+	mv $$($1_DST).tmp $$($1_DST)
 endif
 
 GENSRC_BUFFER += $$($1_DST)
--- a/makefiles/GensrcCharsetCoder.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GensrcCharsetCoder.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -36,8 +36,8 @@
 
 $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java : $(GENSRC_CHARSETCODER_TEMPLATE)
 	$(MKDIR) -p $(@D)
-	-$(RM) $@.temp
-	$(TOOL_SPP) < $< >$@.temp \
+	-$(RM) $@.tmp
+	$(TOOL_SPP) < $< >$@.tmp \
 		-Kdecoder \
 		-DA='A' \
 		-Da='a' \
@@ -63,7 +63,7 @@
 		-DnotLegal='not legal for this charset' \
 		-Dotypes-per-itype='chars-per-byte' \
 		-DoutSequence='Unicode character'
-	$(MV) $@.temp $@
+	$(MV) $@.tmp $@
 
 GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java
 
@@ -71,8 +71,8 @@
 
 $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java : $(GENSRC_CHARSETCODER_TEMPLATE)
 	$(MKDIR) -p $(@D)
-	-$(RM) $@.temp
-	$(TOOL_SPP) < $< >$@.temp \
+	-$(RM) $@.tmp
+	$(TOOL_SPP) < $< >$@.tmp \
 		-Kencoder \
 		-DA='An' \
 		-Da='an' \
@@ -98,7 +98,7 @@
 		-DnotLegal='not a legal sixteen-bit Unicode sequence' \
 		-Dotypes-per-itype='bytes-per-char' \
 		-DoutSequence='byte sequence in the given charset'
-	$(MV) $@.temp $@
+	$(MV) $@.tmp $@
 
 GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java
 
--- a/makefiles/GensrcIcons.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GensrcIcons.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -29,7 +29,7 @@
 GENSRC_ICONS_DST := $(GENSRC_ICONS_TMP)/sun/awt/X11
 
 ifdef OPENJDK
-	ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)
+	ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)
 else
 	ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/solaris
 endif
@@ -41,7 +41,7 @@
     $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png
 
 
-ICONPATH := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/sun/awt/X11
+ICONPATH := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/awt/X11
 
 GENSRC_ICONS_SRC += \
    $(ICONPATH)/security-icon-bw16.png \
@@ -85,10 +85,7 @@
 	$(ECHO) "package sun.awt.X11;" > $$@.tmp
 	$(ECHO) "public class $$($1_NAME32) {" >> $$@.tmp
 	$(ECHO) "public static int[] $$($1_SHORTNAME) = { " >> $$@.tmp
-# TODO FIX FIX FIX
-ifneq ($(OPENJDK_TARGET_OS),macosx)
 	$(CAT) $$< | $(TOOL_TOBIN) >> $$@.tmp
-endif
 	$(ECHO) "}; }" >> $$@.tmp
 	$(MV) $$@.tmp $$@
 
@@ -99,10 +96,7 @@
 	$(ECHO) "package sun.awt.X11;" > $$@.tmp
 	$(ECHO) "public class $$($1_NAME64) {" >> $$@.tmp
 	$(ECHO) "public static long[] $$($1_SHORTNAME) = { " >> $$@.tmp
-# TODO FIX FIX FIX
-ifneq ($(OPENJDK_TARGET_OS),macosx)
 	$(CAT) $$< | $(TOOL_TOBIN) >> $$@.tmp
-endif
 	$(ECHO) "}; }" >> $$@.tmp
 	$(MV) $$@.tmp $$@
 
--- a/makefiles/GensrcJDWP.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GensrcJDWP.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -31,8 +31,17 @@
 $(JDK_OUTPUTDIR)/gensrc_jdwp/com/sun/tools/jdi/JDWP.java : $(JDK_TOPDIR)/makefiles/jpda/jdwp/jdwp.spec
 	$(MKDIR) -p $(@D)
 	$(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_jdwp_headers
+	$(RM) $@ $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h
 	$(ECHO) Creating JDWP.java and JDWPCommands.h from jdwp.spec
 	$(TOOL_JDWPGEN) $< -jdi $@ -include $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h
 
+$(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html : $(JDK_TOPDIR)/makefiles/jpda/jdwp/jdwp.spec
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(ECHO) Creating $(@F) from jdwp.spec
+	$(TOOL_JDWPGEN) $< -doc $@
+
 GENSRC_JDWP:=	$(JDK_OUTPUTDIR)/gensrc_jdwp/com/sun/tools/jdi/JDWP.java \
-		$(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h
+		$(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h \
+		$(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html
+
--- a/makefiles/GensrcJObjC.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GensrcJObjC.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -38,43 +38,71 @@
 #
 $(eval $(call SetupJavaCompilation,BUILD_JOBJC_PRIMITIVE_CODER,\
 		SETUP:=GENERATE_OLDBYTECODE,\
+		DISABLE_SJAVAC:=true,\
 		INCLUDES:=core/java \
                           com/apple,\
-                HEADERS :=$(JOBJC_DST)/jni_headers/core ,\
+                HEADERS:=$(JOBJC_DST)/jni_headers/core ,\
 		SRC:=$(JOBJC_SRC)/src \
                      $(JOBJC_SRC)/src/generator/java, \
 		BIN:=$(JOBJC_TMP)/bin))
 
-GENSRC_JOBJC += $(JOBJC_TMP)/bin/_the.batch
+GENSRC_JOBJC += $(BUILD_JOBJC_PRIMITIVE_CODER)
 
 #
-# Generate bridge support
+# Generate bridge support for select frameworks
 #
 BRIDGESUPPORT := $(addprefix $(JOBJC_TMP)/bridge/,$(addsuffix Full.bridgesupport,$(JOBJC_FRAMEWORKS)))
 
-$(JOBJC_TMP)/bridge/%Full.bridgesupport : $(FRAMEWORKS_DIR)/%.framework/Headers/*.h
-	$(MKDIR) -p $(@D)
-	if [ -f $(FRAMEWORKS_DIR)/$*.framework/Resources/BridgeSupport/$(@F) ]; then \
-		cp $(FRAMEWORKS_DIR)/$*.framework/Resources/BridgeSupport/$(@F) $@ ;\
-	else \
-		$(GBM) -F complete --framework $* -o $@ ; \
-	fi
+#
+# Define macro for rules to create bridge support
+#    Not sure why, but if the system has this framework bridge support,
+#    we appear to copy that, otherwise we run GBM which can be very slow.
+#
+define CreateBridgeSupport # Framework
+$(RM) $@ $@.tmp
+$(MKDIR) -p $(@D)
+if [ -f $(FRAMEWORKS_DIR)/$1.framework/Resources/BridgeSupport/$(@F) ]; then \
+    $(CP) $(FRAMEWORKS_DIR)/$1.framework/Resources/BridgeSupport/$(@F) $@.tmp ;\
+else \
+    $(GBM) -F complete --framework $1 -o $@.tmp ; \
+fi
+$(MV) $@.tmp $@
+endef
 
 #
-# Find Xbootclasspath
+# Currently 3 frameworks, avoid pattern rule due to the names being conflicting
 #
-$(JOBJC_TMP)/_the.generator_bootclasspath : $(JOBJC_TMP)/bin/_the.batch
+$(JOBJC_TMP)/bridge/FoundationFull.bridgesupport : \
+		$(wildcard $(FRAMEWORKS_DIR)/Foundation.framework/Headers/*.h)
+	$(call CreateBridgeSupport,Foundation)
+$(JOBJC_TMP)/bridge/CoreFoundationFull.bridgesupport : \
+		$(wildcard $(FRAMEWORKS_DIR)/CoreFoundation.framework/Headers/*.h)
+	$(call CreateBridgeSupport,CoreFoundation)
+$(JOBJC_TMP)/bridge/AppKitFull.bridgesupport : \
+		$(wildcard $(FRAMEWORKS_DIR)/AppKit.framework/Headers/*.h)
+	$(call CreateBridgeSupport,AppKit)
+
+#
+# Find Xbootclasspath, for some reason, this involves firing up Java just
+#     so we can get the boot classpath, so we can remove anything in that
+#     classpath that ends with "JObjC.jar", and emit the new bootclasspath.
+#
+$(JOBJC_TMP)/_the.generator_bootclasspath : $(BUILD_JOBJC_PRIMITIVE_CODER)
+	$(RM) $@
 	$(JAVA) -cp $(JOBJC_TMP)/bin com.apple.internal.jobjc.generator.BootClassPathMinus JObjC.jar > $@.tmp
 	$(MV) $@.tmp $@
 
-
 #
 # Run generator
+#    Now we use bootclasspath to run java again, with the bridge support to
+#    generate more source.
+#    Note the use of the | (order-only) on the BRIDGESUPPORT, should serialize
+#    them just in case GBM run in parallel has issues.
 #
-TOOL_JOBJC := $(JAVA) -cp $(JOBJC_TMP)/bin -ea com.apple.internal.jobjc.generator.Generator
-
-$(JOBJC_TMP)/_the.generator : $(JOBJC_TMP)/bin/_the.batch $(JOBJC_TMP)/_the.generator_bootclasspath $(BRIDGESUPPORT)
+$(JOBJC_TMP)/_the.generator : $(JOBJC_TMP)/_the.generator_bootclasspath | $(BRIDGESUPPORT)
+	$(RM) $@
 	$(JAVA) -d64 -Xbootclasspath:`$(CAT) $(JOBJC_TMP)/_the.generator_bootclasspath` -cp $(JOBJC_TMP)/bin -ea com.apple.internal.jobjc.generator.Generator dst=$(JOBJC_DST) frameworks=$(JOBJC_TMP)/bridge
 	$(TOUCH) $@
 
 GENSRC_JOBJC += $(JOBJC_TMP)/_the.generator
+
--- a/makefiles/GensrcMisc.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GensrcMisc.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -31,12 +31,14 @@
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/misc/Version.java: \
 	$(JDK_TOPDIR)/src/share/classes/sun/misc/Version.java.template
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(ECHO) Generating sun/misc/Version.java
 	$(SED) -e 's/@@launcher_name@@/$(LAUNCHER_NAME)/g' \
 	       -e 's/@@java_version@@/$(RELEASE)/g' \
 	       -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \
 	       -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \
-            $< > $@
+            $< > $@.tmp
+	$(MV) $@.tmp $@
 
 GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc_misc/sun/misc/Version.java
 
@@ -46,8 +48,10 @@
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/tools/jconsole/Version.java: \
                 $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/Version.java.template
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$(ECHO) Generating sun/tools/jconsole/Version.java
-	$(SED) -e 's/@@jconsole_version@@/$(FULL_VERSION)/g' $< > $@
+	$(SED) -e 's/@@jconsole_version@@/$(FULL_VERSION)/g' $< > $@.tmp
+	$(MV) $@.tmp $@
 
 GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc_misc/sun/tools/jconsole/Version.java
 
@@ -80,12 +84,14 @@
 
     $(JDK_OUTPUTDIR)/gensrc_c/libjdbcodbc/dummyodbc1.c : 
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(ECHO) Creating $@
 	$(PRINTF) "void dummyOdbc(void){}\n" > $@
 	$(ECHO) Created $@
 
     $(JDK_OUTPUTDIR)/gensrc_c/libjdbcodbc/dummyodbc2.c : 
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(ECHO) Creating $@
 	$(PRINTF) "void dummyOdbc(void){}\n" > $@
 	$(ECHO) Created $@
@@ -110,21 +116,27 @@
 		SRC:=$(GENSRC_SOR_SRC),\
 		INCLUDE_FILES:=$(GENSRC_SOR_SRC_FILE),\
 		LANG:=C,\
-		CC:=$(HOST_CC),\
-		LDEXE:=$(HOST_LD),\
+		CC:=$(BUILD_CC),\
+		LDEXE:=$(BUILD_LD),\
 		OBJECT_DIR:=$(GENSRC_SOR_BIN),\
 		OUTPUT_DIR:=$(GENSRC_SOR_BIN),\
                 PROGRAM:=genSocketOptionRegistry))
 
-ifneq ($(JAVASE_EMBEDDED), true)
+ifneq ($(wildcard $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java),)
+  HAS_SOCKET_OPTION_REGISTRY:=true
+endif
+
+ifneq ($(HAS_SOCKET_OTION_REGISTRY),true)
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/ch/SocketOptionRegistry.java : $(BUILD_GENSRC_SOR_EXE)
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/makefiles/scripts/addNotices.sh "$(SOR_COPYRIGHT_YEARS)" > $@.tmp
 	$(BUILD_GENSRC_SOR_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
 else
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/ch/SocketOptionRegistry.java : $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 endif
 
@@ -134,7 +146,7 @@
 
 GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/fs/UnixConstants.java
 
-GENSRC_UC_SRC := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/fs
+GENSRC_UC_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
 GENSRC_UC_SRC_FILE := genUnixConstants.c
 GENSRC_UC_BIN := $(JDK_OUTPUTDIR)/gensrc_misc/genUnixConstants
 
@@ -145,21 +157,27 @@
 		SRC:=$(GENSRC_UC_SRC),\
 		INCLUDE_FILES:=$(GENSRC_UC_SRC_FILE),\
 		LANG:=C,\
-		CC:=$(HOST_CC),\
-		LDEXE:=$(HOST_CC),\
+		CC:=$(BUILD_CC),\
+		LDEXE:=$(BUILD_CC),\
 		OBJECT_DIR:=$(GENSRC_UC_BIN),\
                 OUTPUT_DIR:=$(GENSRC_UC_BIN),\
 		PROGRAM:=genUnixConstants))
 
-ifneq ($(JAVASE_EMBEDDED), true)
+ifneq ($(wildcard $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java),)
+  HAS_UNIX_CONSTANTS:=true
+endif
+
+ifneq ($(HAS_UNIX_CONSTANTS),true)
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/fs/UnixConstants.java : $(BUILD_GENSRC_UC_EXE)
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/makefiles/scripts/addNotices.sh "$(UC_COPYRIGHT_YEARS)" > $@.tmp
 	$(BUILD_GENSRC_UC_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
 else
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/fs/UnixConstants.java : $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
 endif
 
@@ -171,7 +189,7 @@
 
 GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/fs/SolarisConstants.java
 
-GENSRC_SOL_SRC := $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/sun/nio/fs
+GENSRC_SOL_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
 GENSRC_SOL_SRC_FILE := genSolarisConstants.c
 GENSRC_SOL_BIN := $(JDK_OUTPUTDIR)/gensrc_misc/genSolarisConstants
 
@@ -182,14 +200,15 @@
 		SRC:=$(GENSRC_SOL_SRC),\
 		INCLUDE_FILES:=$(GENSRC_SOL_SRC_FILE),\
 		LANG:=C,\
-		CC:=$(HOST_CC),\
-		LDEXE:=$(HOST_CC),\
+		CC:=$(BUILD_CC),\
+		LDEXE:=$(BUILD_CC),\
 		OBJECT_DIR:=$(GENSRC_SOL_BIN),\
 		OUTPUT_DIR:=$(GENSRC_SOL_BIN),\
 		PROGRAM:=genSolarisConstants))
 
 $(JDK_OUTPUTDIR)/gensrc_misc/sun/nio/fs/SolarisConstants.java : $(BUILD_GENSRC_SOL_EXE)
 	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/makefiles/scripts/addNotices.sh "$(SOL_COPYRIGHT_YEARS)" > $@.tmp
 	$(BUILD_GENSRC_SOL_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
--- a/makefiles/GensrcProperties.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GensrcProperties.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -46,8 +46,9 @@
 
   # Strip away prefix and suffix,
   # leaving for example: sun/util/resources/CurrencyNames_sv
-  $1_PROPPATHS:=$$(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/%.properties,%,\
-                $$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties,%,$2))
+  $1_PROPPATHS:=$$(patsubst $(JDK_TOPDIR)/src/windows/classes/%.properties,%,\
+		$$(patsubst $(JDK_TOPDIR)/src/macosx/classes/%.properties,%,\
+                $$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties,%,$2)))
 
   # Apply optional name transformation, example: hz_TW -> hz_HK
   $(if $4,$1_PROPPATHS:=$$(patsubst $4,$5,$$($1_PROPPATHS)))
@@ -75,7 +76,7 @@
 
   # Strip away prefix and suffix,
   # leaving for example: sun/util/resources/CurrencyNames_sv
-  $1_PROPPATHS:=$$(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/%.properties,%,\
+  $1_PROPPATHS:=$$(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/%.properties,%,\
                 $$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties,%,$2))
 
   # Apply optional name transformation, example: hz_TW -> hz_HK
@@ -113,6 +114,13 @@
 
 # Some packages have properties that need to be converted to java source files.
 
+#com/apple/laf/resources
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+    $(eval $(call add_properties_to_compile,COM_APPLE_LAF,\
+	$(shell find $(JDK_TOPDIR)/src/macosx/classes/com/apple/laf/resources -name "*.properties"),\
+		ListResourceBundle))
+endif
+
 #com/sun/accessibility/internal/resources
 $(eval $(call add_properties_to_compile,COM_SUN_ACCESSIBILITY,\
 	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources -name "*.properties"),\
@@ -210,6 +218,16 @@
 $(eval $(call add_properties_to_compile,SUN_AWT_HK,\
 	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/awt/resources -name "*.properties"),\
 		ListResourceBundle,%zh_TW,%zh_HK))
+#sun/awt/windows/
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    $(eval $(call add_properties_to_compile,SUN_AWT,\
+	$(shell find $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows -name "awtLocalization*.properties"),\
+		ListResourceBundle))
+    $(eval $(call add_properties_to_compile,SUN_AWT_HK,\
+	$(shell find $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows -name "awtLocalization*.properties"),\
+		ListResourceBundle,%zh_TW,%zh_HK))
+endif
+
 #sun/launcher/resources
 $(eval $(call add_properties_to_compile,SUN_LAUNCHER,\
 	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources -name "*.properties"),\
@@ -286,7 +304,7 @@
 
 # Now setup the rule for the generation of the resource bundles.
 $(JDK_OUTPUTDIR)/gensrc_properties/_the.compiled_properties : $(ALL_COMPILED_PROPSOURCES) $(BUILD_TOOLS)
-	$(RM) -rf $(JDK_OUTPUTDIR)/gensrc_properties/*
+	$(RM) -r $(JDK_OUTPUTDIR)/gensrc_properties/*
 #	Generate all output directories in advance since the build tool does not do that...
 	$(MKDIR) -p $(sort $(dir $(ALL_COMPILED_PROPJAVAS)))
 	$(ECHO) Compiling $(words $(ALL_COMPILED_PROPSOURCES)) properties into resource bundles
@@ -297,7 +315,7 @@
 # Now setup the rule for the generation of the cleaned properties.
 # FIXME: We currently don't handle removed properties incrementally. 
 $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties : $(ALL_CLEANED_PROPSOURCES) $(BUILD_TOOLS)
-	$(RM) -f $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline
+	$(RM) $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline
 #	Generate all output directories in advance since the build tool does not do that...
 	$(MKDIR) -p $(sort $(dir $(ALL_CLEANED_PROPOUTPUT)))
 	$(ECHO) Copying and cleaning $(words $(ALL_CLEANED_PROPSOURCES)) properties 
--- a/makefiles/GensrcX11Wrappers.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/GensrcX11Wrappers.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -23,36 +23,33 @@
 # questions.
 #
 
+
+# This file is responsible for extracting the x11 native struct offsets to
+# the xawt Java library. This is done by compiling and running a native
+# binary, which dumps output to a text file. The offsets differ on 32 and 64
+# bit systems, so care must be taken here.
+
+# Note: Some of the more complex logic here is most likely not needed anymore.
+
 GENSRC_X11WRAPPERS :=
 GENSRC_X11WRAPPERS_TMP := $(JDK_OUTPUTDIR)/gensrc_x11wrappers
 
 GENSRC_SIZER_SRC := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator
 
-GENSRC_SIZES :=
+# Normal case is to generate version according to target bits
+GENSRC_SIZES := sizes.$(OPENJDK_TARGET_CPU_BITS)
 
-ifeq ($(OPENJDK_TARGET_OS)-$(LIBARCH), solaris-i386)
+ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
+ifneq ($(OPENJDK_TARGET_OS), linux)
+# On all 64-bit systems except Linux, generate both 32 and 64 bit versions
 GENSRC_SIZES := sizes.32 sizes.64
-else ifeq ($(OPENJDK_TARGET_OS), solaris)
-isalist:=$(shell isainfo)
-ifneq (,$(findstring sparcv9, $(isalist)))
-# On sparcv9 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL.
+endif
+else
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-x86)
+# As a special case, solaris on x86 (32-bit) also generates the 64-bit version
 GENSRC_SIZES := sizes.32 sizes.64
-else
-ifneq (,$(findstring amd64, $(isalist)))
-# On amd64 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL.
-GENSRC_SIZES := sizes.32 sizes.64
-else # !sparcv9 : includes (32-bit) sparc, i586
-GENSRC_SIZES := sizes.32
-endif # amd64
-endif # sparcv9
-else # !solaris
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-GENSRC_SIZES := sizes.32 sizes.64
-else # !macosx
-GENSRC_SIZES := sizes.$(ARCH_DATA_MODEL)
-endif # !macosx
-endif # solaris
-
+endif
+endif
 
 ##########################################################################################
 
@@ -62,40 +59,44 @@
 	$(TOOL_WRAPPERGENERATOR) $(@D) $< "sizer" $*
 
 $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.exe : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.c
-	(cd $(@D) && $(HOST_CC) -m$* -o $@ $< \
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
+	(cd $(@D) && $(BUILD_CC) -m$* -o $@.tmp $< \
               -I$(JDK_OUTPUTDIR)/include \
               -I$(JDK_TOPDIR)/src/share/javavm/export \
-              -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/javavm/export \
+              -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
               -I$(JDK_TOPDIR)//src/share/native/common \
-              -I$(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/native/common \
+              -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
               -I$(JDK_TOPDIR)/src/solaris/native/sun/awt \
 	      -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 	      -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils -lc)
+	$(MV) $@.tmp $@
 
-ifeq ($(OPENJDK_TARGET_OS)-$(LIBARCH), solaris-i386)
-
-$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.32 : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.32.exe
+# Run the generated sizer binary to create the sizes text file
+$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.% : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.exe
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
 	$< > $@.tmp
 	$(MV) $@.tmp $@
 
-$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 : $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes/sun/awt/X11/generator/sizes.64-$(OPENJDK_TARGET_OS)-$(LIBARCH)
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-x86)
+  # On solaris-x86 we also need to create the 64-bit version, but we can't run a 64-bit binary
+  # As a workaround, copy this from a pre-generated file.
+$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 : $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386
 	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(CP) $< $@
-else
-
-$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.% : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.exe
-	$< > $@.tmp
-	$(MV) $@.tmp $@
-
 endif
 
 $(GENSRC_X11WRAPPERS_TMP)/classes/_the.classes : $(foreach S,$(GENSRC_SIZES),$(GENSRC_X11WRAPPERS_TMP)/sizer/$(S))
+	$(RM) $@
 	$(MKDIR) -p $(@D)/sun/awt/X11
 	$(RM) $(@D)/sun/awt/X11/*
 	$(TOOL_WRAPPERGENERATOR) $(@D)/sun/awt/X11 $(GENSRC_SIZER_SRC)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes
-ifeq ($(OPENJDK_TARGET_OS)-$(LIBARCH), solaris-amd64)
-	$(ECHO) COMPARING $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 and $(GENSRC_SIZER_SRC)/sizes.64-$(OPENJDK_TARGET_OS)-i386
-	$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 $(GENSRC_SIZER_SRC)/sizes.64-$(OPENJDK_TARGET_OS)-i386
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-x86_64)
+  # On solaris-x86_64, as a safety measure, compare the generated file with the checked-in version 
+	$(ECHO) COMPARING $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 and $(GENSRC_SIZER_SRC)/sizes.64-solaris-i386
+	$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 $(GENSRC_SIZER_SRC)/sizes.64-solaris-i386
 endif
 	$(TOUCH) $@
 
--- a/makefiles/Images.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/Images.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -32,11 +32,21 @@
 
 include Tools.gmk
 
-images: jre-image jdk-image
+# Note: This double-colon rule is intentional, to support
+# custom make file integration.
+images:: jre-image jdk-image
+
+overlay-images: jre-overlay-image jdk-overlay-image
+
+
+-include $(CUSTOM_MAKE_DIR)/Images.gmk
+
 
 ifeq ($(OPENJDK_TARGET_OS),solaris)
+# On Solaris, if the target is a symlink and exists, cp won't overwrite.
 define install-file
 	$(MKDIR) -p $(@D)
+	$(RM) '$@'
 	$(CP) -f -r -P '$<' '$(@D)'
 endef
 else ifeq ($(OPENJDK_TARGET_OS),macosx)
@@ -51,11 +61,34 @@
 endef
 endif
 
+# Processing license files from source area to image area
+# These will be modified to have the platform specific EOL chars.
+define process-doc-file
+	$(ECHO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(SED) 's/$$//g' $< > $@
+	$(CHMOD) 444 $@
+endef
+
+
+JDK_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2sdk-image
+JRE_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2re-image
+
+JDK_OVERLAY_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2sdk-overlay-image
+JRE_OVERLAY_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2re-overlay-image
+
 ################################################################################
 #
 # JRE and JDK build rules
 #
 ################################################################################
+#
+# Variable prefixes explained:
+# JRE_ refers to files in the j2re-image.
+# JDK_ refers to files in the j2sdk-image outside of the jre subdir.
+# JDKJRE_ refers to files in the j2sdk-image inside the jre subdir.
+#
 
 ################################################################################
 # /bin dir
@@ -72,6 +105,19 @@
 	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(install-file)
 
+# Overaly image targets
+$(JRE_OVERLAY_IMAGE_DIR)/bin/%: $(JDK_OUTPUTDIR)/bin/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+$(JDK_OVERLAY_IMAGE_DIR)/bin/%: $(JDK_OUTPUTDIR)/bin/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+$(JDK_OVERLAY_IMAGE_DIR)/jre/bin/%: $(JDK_OUTPUTDIR)/bin/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
 NOT_JRE_BIN_FILES := \
 	appletviewer$(EXE_SUFFIX) \
 	extcheck$(EXE_SUFFIX) \
@@ -107,26 +153,54 @@
 
 WINDOWS_JDK_BIN_FILES = \
 	$(EXE_SUFFIX) \
-	$(LIB_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
-	$(MSVCRNN_DLL)
+	$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
+	$(notdir $(MSVCRNN_DLL))
+
+WINDOWS_JDKJRE_BIN_FILES := \
+	$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
+	$(SALIB_NAME)
 
 # Find all files in bin dir
 ALL_BIN_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f)
 
-# For unknown reason the debuginfo files for binaries are not put into images
+# For unknown reason the debuginfo files for executables are not put into images
 # e.g filter them out
-ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
+ifneq ($(OPENJDK_TARGET_OS),windows)
+    ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
+else
+# On windows, the libraries are in the bin dir, only filter out debuginfo files
+# for executables. "java" is both a library and executable.
+    ALL_BIN_EXEC_FILES := $(filter-out java.exe,$(notdir $(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name "*.exe")))
+    ALL_BIN_DEBUG_FILTER := $(addprefix %,$(patsubst %.exe,%.debuginfo,$(ALL_BIN_EXEC_FILES)) \
+					   $(patsubst %.exe,%.diz,$(ALL_BIN_EXEC_FILES))) %.pdb
+    ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER),$(ALL_BIN_LIST))
+endif
 
 ifeq ($(OPENJDK_TARGET_OS),windows)
     JDK_BIN_LIST := $(filter $(addprefix %,$(WINDOWS_JDK_BIN_FILES)), $(ALL_BIN_LIST))
 else
     JDK_BIN_LIST := $(ALL_BIN_LIST)
 endif
-JRE_BIN_LIST := $(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES)), $(ALL_BIN_LIST))
+JDKJRE_BIN_LIST := $(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES)), $(ALL_BIN_LIST))
+JRE_BIN_LIST := $(filter-out $(addprefix %,$(WINDOWS_JDKJRE_BIN_FILES)), $(JDKJRE_BIN_LIST))
 
-JRE_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JRE_IMAGE_DIR)/%, $(JRE_BIN_LIST))
-JDK_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/%, $(JDK_BIN_LIST))
-JDKJRE_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/jre/%, $(JRE_BIN_LIST))
+ifneq ($(OPENJDK_TARGET_CPU_ISADIR),)
+    OVERLAY_FILTER := $(JDK_OUTPUTDIR)/bin$(OPENJDK_TARGET_CPU_ISADIR)%
+endif
+
+JRE_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JRE_IMAGE_DIR)/%, \
+			$(filter-out $(OVERLAY_FILTER),$(JRE_BIN_LIST)))
+JDK_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/%, \
+			$(filter-out $(OVERLAY_FILTER),$(JDK_BIN_LIST)))
+JDKJRE_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/jre/%, \
+			$(filter-out $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)))
+
+JRE_OVERLAY_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JRE_OVERLAY_IMAGE_DIR)/%, \
+				$(filter $(OVERLAY_FILTER),$(JRE_BIN_LIST)))
+JDK_OVERLAY_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_OVERLAY_IMAGE_DIR)/%, \
+				$(filter $(OVERLAY_FILTER),$(JDK_BIN_LIST)))
+JDKJRE_OVERLAY_BIN_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_OVERLAY_IMAGE_DIR)/jre/%, \
+				$(filter $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)))
 
 ################################################################################
 # /lib dir
@@ -143,9 +217,24 @@
 	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(install-file)
 
-JDKJRE_LIB_FILES := \
-	$(LIB_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
+# Overlay image targets
+$(JRE_OVERLAY_IMAGE_DIR)/lib/%: $(JDK_OUTPUTDIR)/lib/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+$(JDK_OVERLAY_IMAGE_DIR)/lib/%: $(JDK_OUTPUTDIR)/lib/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+$(JDK_OVERLAY_IMAGE_DIR)/jre/lib/%: $(JDK_OUTPUTDIR)/lib/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+ifneq ($(OPENJDK_TARGET_OS), macosx)
+    JDKJRE_LIB_FILES := \
+	$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
 	$(SALIB_NAME)
+endif
 
 NOT_JRE_LIB_FILES := \
 	tools.jar \
@@ -156,12 +245,16 @@
 	ir.idl \
 	ct.sym
 
+ifeq ($(OPENJDK_TARGET_OS), windows)
+    NOT_JRE_LIB_FILES += jawt.lib jvm.lib
+endif
+
 JDK_LIB_FILES := $(NOT_JRE_LIB_FILES)
 ifeq ($(OPENJDK_TARGET_OS), linux)
     JDK_LIB_FILES += jexec
 endif
 
-ALL_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) ! -name "_the*")
+ALL_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) )
 JRE_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),$(ALL_LIB_LIST))
 JDKJRE_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES)),$(ALL_LIB_LIST))
 JDK_LIB_LIST := $(filter $(addprefix %,$(JDK_LIB_FILES)),$(ALL_LIB_LIST))
@@ -170,6 +263,13 @@
 JDK_LIB_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/%,$(JDK_LIB_LIST))
 JDKJRE_LIB_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/%,$(JDK_IMAGE_DIR)/jre/%,$(JDKJRE_LIB_LIST))
 
+JRE_OVERLAY_LIB_TARGETS := $(subst $(JRE_IMAGE_DIR),$(JRE_OVERLAY_IMAGE_DIR),\
+				$(filter $(JRE_IMAGE_DIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JRE_LIB_TARGETS)))
+JDK_OVERLAY_LIB_TARGETS := $(subst $(JDK_IMAGE_DIR),$(JDK_OVERLAY_IMAGE_DIR),\
+				$(filter $(JDK_IMAGE_DIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JDK_LIB_TARGETS)))
+JDKJRE_OVERLAY_LIB_TARGETS := $(subst $(JDK_IMAGE_DIR),$(JDK_OVERLAY_IMAGE_DIR),\
+				$(filter $(JDK_IMAGE_DIR)/jre/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JDKJRE_LIB_TARGETS)))
+
 # CTE plugin security change require new empty directory lib/applet
 $(JRE_IMAGE_DIR)/lib/applet: 
 	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
@@ -179,19 +279,20 @@
 	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(MKDIR) -p $@
 
+# In the old build, JObjC.jar is not part of the meta-index
 $(JRE_IMAGE_DIR)/lib/meta-index: $(JRE_LIB_TARGETS)
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
+	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index `$(LS) *.jar | $(SED) 's/JObjC\.jar//g'`
 
 $(JDK_IMAGE_DIR)/jre/lib/meta-index: $(JDKJRE_LIB_TARGETS)
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
+	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index `$(LS) *.jar | $(SED) 's/JObjC\.jar//g'`
 
 $(JRE_IMAGE_DIR)/lib/ext/meta-index: $(JRE_LIB_TARGETS)
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
 
-$(JDK_IMAGE_DIR)/jre/lib/ext/meta-index: $(JRE_LIB_TARGETS)
+$(JDK_IMAGE_DIR)/jre/lib/ext/meta-index: $(JDKJRE_LIB_TARGETS)
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
 
@@ -378,12 +479,12 @@
 # /demo dir
 
 ifndef NO_DEMOS
-# FIXME: newdemo/applets/GraphLayout/GraphPanel$2.class is sometimes not copied.
+# FIXME: demo/applets/GraphLayout/GraphPanel$2.class is sometimes not copied.
 
 #   The db demo contains an empty dir that needs to be copied. The other 
 #   directories will always trigger the rule for recompile since 
 #   _the.list_of_packages files are touched.
-    $(JDK_IMAGE_DIR)/demo/%: $(JDK_OUTPUTDIR)/newdemo/%
+    $(JDK_IMAGE_DIR)/demo/%: $(JDK_OUTPUTDIR)/demo/%
 	if [ ! -d "$@" ]; then \
 	  $(ECHO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
 	  $(MKDIR) -p $(@D); \
@@ -391,8 +492,25 @@
 	fi
 
 #   Find all files including directories
-    JDK_DEMO_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/newdemo/%,$(JDK_IMAGE_DIR)/demo/%,\
-			$(shell $(FIND) $(JDK_OUTPUTDIR)/newdemo ! -name "_the.*"))
+    JDK_DEMO_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/demo/%,$(JDK_IMAGE_DIR)/demo/%,\
+			$(shell $(FIND) $(JDK_OUTPUTDIR)/demo ! \( -name "_the*" -o -name "javac_state" \) ))
+
+
+
+    # Param 1 is source file
+    define CreateOverlayDemoRule
+        $1_TARGET:=$$(subst $(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR),\
+			$$(dir $1)$(OPENJDK_TARGET_CPU_ISADIR)/$$(notdir $1))
+        $$($1_TARGET): $1
+		$(ECHO) Copying '$$(patsubst $(OUTPUT_ROOT)/%,%,$$@)'
+		$(MKDIR) -p $$(@D)
+		$(RM) $$@
+		$(CP) -f '$$<' '$$@'
+
+        JDK_OVERLAY_DEMO_TARGETS += $$($1_TARGET)
+    endef
+    JDK_OVERLAY_DEMO_SOURCES := $(shell $(FIND) $(JDK_OUTPUTDIR)/demo -name "*$(SHARED_LIBRARY_SUFFIX)")
+    $(foreach lib,$(JDK_OVERLAY_DEMO_SOURCES),$(eval $(call CreateOverlayDemoRule,$(lib))))
 
 endif
 
@@ -471,50 +589,47 @@
 JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/,$(JDK_DOC_FILES))
 
 $(JRE_IMAGE_DIR)/%: $(JRE_DOC_LOCATION)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JDK_IMAGE_DIR)/jre/%: $(JRE_DOC_LOCATION)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JRE_IMAGE_DIR)/README.txt: $(JRE_DOC_LOCATION)/README
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(CP) $< $@
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JDK_IMAGE_DIR)/jre/README.txt: $(JRE_DOC_LOCATION)/README
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(CP) $< $@
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JDK_IMAGE_DIR)/%: $(JDK_DOC_LOCATION)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JDK_IMAGE_DIR)/demo/%: $(JDK_DOC_LOCATION)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 $(JDK_IMAGE_DIR)/sample/%: $(JDK_DOC_LOCATION)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-	$(CHMOD) 444 $(@)
+	$(process-doc-file)
 
 JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
 JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release
 
+JRE_OVERLAY_INFO_FILE := $(JRE_OVERLAY_IMAGE_DIR)/release
+JDK_OVERLAY_INFO_FILE := $(JDK_OVERLAY_IMAGE_DIR)/release
+
 # Common way to emit a line into the release or info file
 define info-file-item # name value
 $(PRINTF) '%s="%s"\n' $1 $2 >> $@
 endef
 
+define create-info-file
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
+	$(call info-file-item, "OS_NAME",      "$(REQUIRED_OS_NAME)")
+	$(call info-file-item, "OS_VERSION",   "$(REQUIRED_OS_VERSION)")
+	$(call info-file-item, "OS_ARCH",      "$(OPENJDK_TARGET_CPU_LEGACY)")
+	$(call info-file-item, "SOURCE",       "$(ALL_SOURCE_TIPS)")
+endef
+
 ALL_SOURCE_TIPS = $(shell \
   if [ -f $(OUTPUT_ROOT)/source_tips ] ; then \
     $(CAT) $(OUTPUT_ROOT)/source_tips ; \
@@ -522,23 +637,19 @@
 
 $(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
-	$(call info-file-item, "OS_NAME",      "$(REQUIRED_OS_NAME)")
-	$(call info-file-item, "OS_VERSION",   "$(REQUIRED_OS_VERSION)")
-	$(call info-file-item, "OS_ARCH",      "$(ARCH)")
-	$(call info-file-item, "SOURCE",       "$(ALL_SOURCE_TIPS)")
+	$(call create-info-file)
 
 $(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
 	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
-	$(call info-file-item, "OS_NAME",      "$(REQUIRED_OS_NAME)")
-	$(call info-file-item, "OS_VERSION",   "$(REQUIRED_OS_VERSION)")
-	$(call info-file-item, "OS_ARCH",      "$(ARCH)")
-	$(call info-file-item, "SOURCE",       "$(ALL_SOURCE_TIPS)")
+	$(call create-info-file)
+
+$(JRE_OVERLAY_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
+	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call create-info-file)
+
+$(JDK_OVERLAY_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
+	$(ECHO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call create-info-file)
 
 $(JDK_IMAGE_DIR)/src.zip: $(IMAGES_OUTPUTDIR)/src.zip
 	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
@@ -549,51 +660,75 @@
 
 ifneq ($(POST_STRIP_CMD),)
     ifeq ($(OPENJDK_TARGET_OS), windows)
-        EXEC_LIST:=$(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*.exe \
+        EXEC_LIST_BIN:=$(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*.exe \
 		-o -name \*.dll | $(EGREP) -v -i "$(MSVCRNN_DLL)")
     else
         # Find all executables in JDK_OUTPUTDIR since they exist when this makefile is parsed
-        EXEC_LIST:=$(shell $(FIND) $(JDK_OUTPUTDIR)/lib -type f -name \*$(SHARED_LIBRARY_SUFFIX) && \
-		$(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX)` \
+        EXEC_LIST_BIN:=$(shell $(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX)` \
 		| $(EGREP) 'ELF' | $(CUT) -d':' -f1)
+        # On mac, the old build searches for static libraries for stripping instead of shared.
+        # Not clear if it's intentional.
+	ifneq ($(OPENJDK_TARGET_OS), macosx)
+            EXEC_LIST_LIB:=$(shell $(FIND) $(JDK_OUTPUTDIR)/lib -type f -name \*$(SHARED_LIBRARY_SUFFIX))
+	endif
     endif
+
+    # Filter out the overlay specific bin files
+    EXEC_LIST:=$(filter-out $(OVERLAY_FILTER),$(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
+    EXEC_LIST_OVERLAY:=$(filter $(OVERLAY_FILTER),$(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
+
     # Filter out non JRE files and convert to unique touch files to depend on
-    JRE_EXEC_TOUCH_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped,\
-			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST)))
+    JRE_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped,\
+			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
+				 $(EXEC_LIST)))
 
-    JDK_JRE_EXEC_TOUCH_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
+    JDKJRE_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
                         $(IMAGES_OUTPUTDIR)/_strip_jdk/jre/%.stripped, \
 			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST)))
 
-    JDK_BIN_EXEC_TOUCH_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, \
+    JDK_BIN_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
                           $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped, \
                           $(filter-out $(JDK_OUTPUTDIR)/lib/%, $(EXEC_LIST)))
 
-    # Setup a rule for stripping files based on touch files
-    $(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped: $(JRE_IMAGE_DIR)/%
+    # Do the same for overlay image
+    JRE_OVERLAY_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre_overlay/%.stripped,\
+			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
+				 $(EXEC_LIST_OVERLAY)))
+
+    JDKJRE_OVERLAY_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
+                        $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/jre/%.stripped, \
+			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST_OVERLAY)))
+
+    JDK_OVERLAY_BIN_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
+                          $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/%.stripped, \
+                          $(filter-out $(JDK_OUTPUTDIR)/lib/%, $(EXEC_LIST_OVERLAY)))
+
+    define mcs-file
+	$(if $(POST_MCS_CMD),$(POST_MCS_CMD) $<)
+    endef
+
+    define strip-file
 	$(ECHO) Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<)
 	$(CHMOD) u+w $<
 	$(POST_STRIP_CMD) $<
+	$(call mcs-file)
 	$(CHMOD) go-w $<
 	$(MKDIR) -p $(@D)
 	$(TOUCH) $@
-
-    $(IMAGES_OUTPUTDIR)/_strip_jdk/bin/%.stripped: $(JDK_IMAGE_DIR)/bin/%
-	$(ECHO) Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<)
-	$(CHMOD) u+w $<
-	$(POST_STRIP_CMD) $<
-	$(CHMOD) go-w $<
-	$(MKDIR) -p $(@D)
-	$(TOUCH) $@
+    endef
 
     # Setup a rule for stripping files based on touch files
-    $(IMAGES_OUTPUTDIR)/_strip_jdk/jre/%.stripped: $(JDK_IMAGE_DIR)/jre/%
-	$(ECHO) Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<)
-	$(CHMOD) u+w $<
-	$(POST_STRIP_CMD) $<
-	$(CHMOD) go-w $<
-	$(MKDIR) -p $(@D)
-	$(TOUCH) $@
+    $(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped: $(JRE_IMAGE_DIR)/%
+	$(call strip-file)
+
+    $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped: $(JDK_IMAGE_DIR)/%
+	$(call strip-file)
+
+    $(IMAGES_OUTPUTDIR)/_strip_jre_overlay/%.stripped: $(JRE_OVERLAY_IMAGE_DIR)/%
+	$(call strip-file)
+
+    $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/%.stripped: $(JDK_OVERLAY_IMAGE_DIR)/%
+	$(call strip-file)
 
 endif
 
@@ -602,7 +737,7 @@
 
 jre-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) $(JRE_IMAGE_DIR)/lib/applet \
 	$(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
-	$(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_EXEC_TOUCH_LIST)
+	$(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_STRIP_LIST)
 
 jdk-image: $(JDK_BIN_TARGETS) $(JDKJRE_BIN_TARGETS) \
 	$(JDK_LIB_TARGETS) $(JDKJRE_LIB_TARGETS) \
@@ -612,9 +747,17 @@
 	$(JDK_MAN_PAGE_LIST) $(JDK_SAMPLE_TARGETS) \
 	$(JDK_DB_TARGETS) $(JDK_INCLUDE_TARGETS) \
 	$(JDKJRE_DOC_TARGETS) $(JDK_DOC_TARGETS) \
-	$(JDK_INFO_FILE) $(JDK_JRE_EXEC_TOUCH_LIST) $(JDK_BIN_EXEC_TOUCH_LIST) \
+	$(JDK_INFO_FILE) $(JDKJRE_STRIP_LIST) $(JDK_BIN_STRIP_LIST) \
         $(JDK_IMAGE_DIR)/src.zip
 
+jre-overlay-image: $(JRE_OVERLAY_BIN_TARGETS) $(JRE_OVERLAY_LIB_TARGETS) \
+	 $(JRE_OVERLAY_INFO_FILE) $(JRE_OVERLAY_STRIP_LIST)
+
+jdk-overlay-image: $(JDK_OVERLAY_BIN_TARGETS) $(JDKJRE_OVERLAY_BIN_TARGETS) \
+	$(JDK_OVERLAY_LIB_TARGETS) $(JDKJRE_OVERLAY_LIB_TARGETS) \
+	$(JDK_OVERLAY_DEMO_TARGETS) $(JDK_OVERLAY_INFO_FILE) \
+	$(JDKJRE_OVERLAY_STRIP_LIST) $(JDK_OVERLAY_BIN_STRIP_LIST) 
+
 ################################################################################
 
 .PHONY: default images jre-image jdk-image
--- a/makefiles/Import.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/Import.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -41,12 +41,8 @@
 
 # Put the libraries here. Different locations for different target apis.
 ifeq ($(OPENJDK_TARGET_OS_API),posix)
-    ifneq ($(OPENJDK_TARGET_OS),macosx)
-        INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib/$(LIBARCH)
-    else
-        INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib
-    endif
-    HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/lib/$(LIBARCH)
+    INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+    HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)
 else
     INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/bin
     HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/bin
@@ -65,6 +61,7 @@
 $(JDK_OUTPUTDIR)/classes/_the.$1.classes.imported : $$($1_DIST)/lib/classes.jar $$($1_CLASSES_DEP)
 	$(ECHO) Importing $1 classes.jar
 	$(MKDIR) -p $$(@D)
+	$(RM) $$@ $$@.tmp
 	($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
 	$(MV) $$@.tmp $$@
 endef
@@ -76,6 +73,7 @@
 $(JDK_OUTPUTDIR)/impsrc/_the.$1.src.imported : $$($1_DIST)/lib/src.zip $$($1_SOURCES_DEP)
 	$(ECHO) Importing $1 src.zip
 	$(MKDIR) -p $$(@D)
+	$(RM) $$@ $$@.tmp
 	($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
 	$(MV) $$@.tmp $$@
 endef
@@ -87,6 +85,7 @@
 $(JDK_OUTPUTDIR)/_the.$1.binaries.imported : $$($1_DIST)/lib/bin.zip $$($1_BINARIES_DEP)
 	$(ECHO) Importing $1 bin.zip
 	$(MKDIR) -p $$(@D)
+	$(RM) $$@ $$@.tmp
 	($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
 	$(MV) $$@.tmp $$@
 endef
@@ -103,23 +102,26 @@
 
 ifeq ($(OPENJDK_TARGET_OS),solaris)
 define do-install-file
-	$(MKDIR) -p $$(@D)
+	$(MKDIR) -p '$$(@D)'
+	$(RM) '$$@'
 	$(CP) -r -P '$$<' '$$(@D)'
 endef
 else ifeq ($(OPENJDK_TARGET_OS),macosx)
 define do-install-file
-	$(MKDIR) -p $$(@D)
+	$(MKDIR) -p '$$(@D)'
+	$(RM) '$$@'
 	$(CP) -pRP '$$<' '$$@'
 endef
 else
 define do-install-file
-	$(MKDIR) -p $$(@D)
+	$(MKDIR) -p '$$(@D)'
+	$(RM) '$$@'
 	$(CP) -P '$$<' '$$@'
 endef
 endif
 
 define CopyDir
-        $1_SRC_FILES := $(shell $(FIND) $2 -type f)
+        $1_SRC_FILES := $(shell $(FIND) $2 -type f -a ! -name "wb.jar")
         $1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
         IMPORT_TARGET_FILES += $$($1_DST_FILES)
 $3/% : $2/%
@@ -136,8 +138,8 @@
 $(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE)))
 $(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib))
 
-JSIG_DEBUGINFO := $(wildcard $(HOTSPOT_DIST)/jre/lib/$(LIBARCH)/libjsig.debuginfo) \
-                  $(wildcard $(HOTSPOT_DIST)/jre/lib/$(LIBARCH)/libjsig.diz)
+JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
+                  $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
 
 ifneq ($(OPENJDK_TARGET_OS), windows)
     ifeq ($(JVM_VARIANT_SERVER), true)
@@ -155,64 +157,75 @@
 endif
 
 $(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 $(INSTALL_LIBRARIES_HERE)/server/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 $(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 ifeq (REALLY_WEIRD,1)
 	$(LN) -s ../$(@F) $@
 else
 #
 # TODO: Check if this is what they really want...a zip containing a symlink
 #
-	$(RM) -f $(basename $@).debuginfo
+	$(RM) $@.tmp $(basename $@).debuginfo
 	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
-	$(ZIP) -q -y $@ $(basename $@).debuginfo
-	$(RM) -f $(basename $@).debuginfo
+	$(ZIP) -q -y $@.tmp $(basename $@).debuginfo
+	$(RM) $(basename $@).debuginfo
+	$(MV) $@.tmp $@
 endif
 
 $(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 $(INSTALL_LIBRARIES_HERE)/client/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 $(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
-	$(RM) -f $@
+	$(MKDIR) -p $(@D)
+	$(RM) $@
 ifeq (REALLY_WEIRD,1)
 	$(LN) -s ../$(@F) $@
 else
 #
 # TODO: Check if this is what they really want...a zip containing a symlink
 #
-	$(RM) -f $(basename $@).debuginfo
+	$(RM) $@.tmp $(basename $@).debuginfo
 	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
-	$(ZIP) -q -y $@ $(basename $@).debuginfo
-	$(RM) -f $(basename $@).debuginfo
+	$(ZIP) -q -y $@.tmp $(basename $@).debuginfo
+	$(RM) $(basename $@).debuginfo
+	$(MV) $@.tmp $@
 endif
 
 #######
 
 ifeq ($(OPENJDK_TARGET_OS),solaris)
 define install-file
-	$(MKDIR) -p $(@D)
+	$(MKDIR) -p '$(@D)'
+	$(RM) '$@'
 	$(CP) -r -P '$<' '$(@D)'
 endef
 else ifeq ($(OPENJDK_TARGET_OS),macosx)
 define install-file
-	$(MKDIR) -p $(@D)
+	$(MKDIR) -p '$(@D)'
+	$(RM) '$@'
 	$(CP) -pRP '$<' '$@'
 endef
 else
 define install-file
-	$(MKDIR) -p $(@D)
+	$(MKDIR) -p '$(@D)'
+	$(RM) '$@'
 	$(CP) -P '$<' '$@'
 endef
 endif
--- a/makefiles/Makefile	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/Makefile	Fri Sep 28 10:54:12 2012 -0700
@@ -26,6 +26,11 @@
 # This must be the first rule
 default: all
 
+# Inclusion of this pseudo-target will cause make to execute this file
+# serially, regardless of -j. Recursively called makefiles will not be
+# affected, however. This is required for correct dependency management.
+.NOTPARALLEL:
+
 include $(SPEC)
 include MakeBase.gmk
 include JavaCompilation.gmk
@@ -37,39 +42,72 @@
 # Setup the build tools.
 include Tools.gmk
 
-all: $(BUILD_TOOLS)
+import: $(BUILD_TOOLS) import-only
+import-only:
 #       Import (corba jaxp jaxws langtools hotspot)
 	+$(MAKE) -f Import.gmk
-#
+
+gensrc: import gensrc-only
+gensrc-only:
 	+$(MAKE) -f GenerateJavaSources.gmk
 #       Ok, now gensrc is fully populated.
+
+gendata: gensrc gendata-only
+gendata-only:
 	+$(MAKE) -f GenerateData.gmk
+
+classes: gendata classes-only
+classes-only:
 	+$(MAKE) -f CompileJavaClasses.gmk
 #       The classes are now built and
 #       any javah files have now been generated.
+
+libs: classes libs-only
+libs-only:
 	+$(MAKE) -f CompileNativeLibraries.gmk
+
+launchers: libs launchers-only
+launchers-only:
 #       Finally compile the launchers.
 	+$(MAKE) -f CompileLaunchers.gmk
+
+genclasses: launchers genclasses-only
+genclasses-only:
 #	Generate classes that have other sources. Needs
 #       to execute launchers.
 	+$(MAKE) -f GenerateClasses.gmk
+
+demos: genclasses demos-only
+demos-only:
 #       Now we have a complete jdk, which you can run.
 #       It is not yet wrapped up as an installed image.
 #       The demos are compiled against this jdk.
 ifndef NO_DEMOS
 	+$(MAKE) -f CompileDemos.gmk
 endif
+
+samples: demos samples-only
+samples-only:
 #	Now copy the sample sources into the jdk.
 ifndef NO_SAMPLES
 	+$(MAKE) -f CopySamples.gmk
 endif
 
+# The all target builds the JDK, but not the images
+all: import gensrc gendata classes libs launchers genclasses demos samples
+
+.PHONY: all images install overlay-images import-only gensrc-only gendata-only classes-only 
+.PHONY: libs-only launchers-only genclasses-only demos-only samples-only
+
 # Create the final jdk and jre images, to be wrapped up
 # into packages, or installed.
 images:
 	+$(MAKE) -f CreateJars.gmk
 	+$(MAKE) -f Images.gmk 
 
+overlay-images:
+	+$(MAKE) -f CompileLaunchers.gmk OVERLAY_IMAGES=true
+	+$(MAKE) -f Images.gmk overlay-images
 
 BINARIES:=$(shell if test -d $(IMAGES_OUTPUTDIR)/j2sdk-image/bin; then cd $(IMAGES_OUTPUTDIR)/j2sdk-image/bin && $(LS) ; fi)
 INSTALLDIR:=openjdk-$(RELEASE)
@@ -84,5 +122,3 @@
 	$(CP) -rp $(IMAGES_OUTPUTDIR)/j2sdk-image/* $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
 	$(RM) $(addprefix $(INSTALL_PREFIX)/bin/,$(BINARIES))
 	$(foreach b,$(BINARIES),$(LN) -s $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)/bin/$b $(INSTALL_PREFIX)/bin/$b &&) true
-
-.PHONY: all install images
--- a/makefiles/Setup.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/Setup.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -36,10 +36,8 @@
      JVM:=$(JAVA),\
      JAVAC:=$(JAVAC_JARS),\
      FLAGS:=-source 7 -target 7 -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS),\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
 # The generate new bytecode javac setup uses the new compiler to compile for the
 # new jdk. This new bytecode might only be possible to run using the new jvm.
@@ -47,11 +45,9 @@
      JVM:=$(JAVA),\
      JAVAC:=$(JAVAC_JARS),\
      JAVAH:=$(JAVAH_JARS),\
-     FLAGS:=-bootclasspath "$(JDK_OUTPUTDIR)/classes" -Xprefer:source -XDignore.symbol.file=true $(DISABLE_WARNINGS),\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
+     FLAGS:=-bootclasspath $(JDK_OUTPUTDIR)/classes -source 7 -target 7 -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS),\
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
 # After the jdk is built, we want to build demos using only the recently
 # generated jdk classes and nothing else, no jdk source, etc etc.
@@ -60,19 +56,6 @@
 $(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE,\
      JVM:=$(JAVA),\
      JAVAC:=$(JAVAC_JARS),\
-     FLAGS:= -Xbootclasspath:$(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS),\
-     SERVER_DIR:=$(JAVAC_SERVERS),\
-     SERVER_JVM:=$(SERVER_JAVA),\
-     MODE:=$(JAVAC_USE_MODE),\
-     USE_DEPS:=$(JAVAC_USE_DEPS)))
-
-# A temporary solution to work around the fact that Matrix3D.java
-# exists in several applets. The javacserver does not like to be
-# fed the same class twice. Thus we compile one applet outside of the
-# javacserver.
-$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE_NOSERV,\
-     JVM:=$(JAVA),\
-     JAVAC:=$(JAVAC_JARS),\
-     FLAGS:= -Xbootclasspath:$(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS),\
-     MODE:=SINGLE_THREADED_BATCH,\
-     USE_DEPS:=FALSE))
+     FLAGS:=-bootclasspath $(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS),\
+     SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
+     SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
--- a/makefiles/Tools.gmk	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/Tools.gmk	Fri Sep 28 10:54:12 2012 -0700
@@ -134,8 +134,8 @@
 $(eval $(call SetupNativeCompilation,ADD_GNU_DEBUGLINK,\
 		SRC:=$(JDK_TOPDIR)/make/tools/add_gnu_debuglink,\
 		LANG:=C,\
-		CC:=$(HOST_CC),\
-		LDEXE:=$(HOST_LD),\
+		CC:=$(BUILD_CC),\
+		LDEXE:=$(BUILD_LD),\
 		LDFLAGS:=-lelf,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/add_gnu_debuglink,\
 		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/btbin,\
@@ -144,8 +144,8 @@
 $(eval $(call SetupNativeCompilation,FIX_EMPTY_SEC_HDR_FLAGS,\
 		SRC:=$(JDK_TOPDIR)/make/tools/fix_empty_sec_hdr_flags,\
 		LANG:=C,\
-		CC:=$(HOST_CC),\
-		LDEXE:=$(HOST_LD),\
+		CC:=$(BUILD_CC),\
+		LDEXE:=$(BUILD_LD),\
 		LDFLAGS:=-lelf,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags,\
 		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/btbin,\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/mapfiles/launchers/mapfile-x86	Fri Sep 28 10:54:12 2012 -0700
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 2004, 2011, 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.
+#
+#
+# Specify what global symbols we export.  Note that we're not really
+# interested in declaring a version, simply scoping the file is sufficient.
+#
+
+SUNWprivate_1.1 {
+	global:
+		main;		# Provides basic adb symbol offsets
+		environ;	# Public symbols and required by Java run time
+		_environ;
+		__environ_lock;
+		___Argv;	# The following are private, but as they are
+		_start;		# exported from ctr1/crtn, the clever hacker
+		_init;		# might know about them.  However note, that
+		_fini;		# their use is strictly not supported.
+		_lib_version;
+#		_mcount;
+		__fsr;
+		__fsr_init_value;
+		__longdouble_used;
+
+	local:
+		*;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/mapfiles/launchers/mapfile-x86_64	Fri Sep 28 10:54:12 2012 -0700
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2004, 2011, 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.
+#
+#
+# Specify what global symbols we export.  Note that we're not really
+# interested in declaring a version, simply scoping the file is sufficient.
+#
+
+SUNWprivate_1.1 {
+	global:
+		main;		# Provides basic adb symbol offsets
+		environ;	# Public symbols and required by Java run time
+		_environ;
+		__environ_lock;
+
+	local:
+		*;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/mapfiles/libawt_headless/reorder-x86	Fri Sep 28 10:54:12 2012 -0700
@@ -0,0 +1,1 @@
+# Temporary file for headless
--- a/makefiles/mapfiles/libjava/mapfile-vers	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/mapfiles/libjava/mapfile-vers	Fri Sep 28 10:54:12 2012 -0700
@@ -285,6 +285,8 @@
 #		Java_sun_misc_VM_unsuspendSomeThreads;		threads.c
 #		Java_sun_misc_VM_unsuspendThreads;		threads.c
 
+		Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPattern;
+
 	# Outcalls from libjvm done using dlsym().
 
 		VerifyClassCodes;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/mapfiles/libjava/reorder-x86	Fri Sep 28 10:54:12 2012 -0700
@@ -0,0 +1,109 @@
+data = R0x2000;
+text = LOAD ?RXO;
+# Test Null
+text: .text%_init;
+text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
+text: .text%JNI_OnLoad;
+text: .text%Canonicalize;
+text: .text%canonicalize;
+text: .text%collapse: OUTPUTDIR/canonicalize_md.o;
+text: .text%Java_java_lang_Object_registerNatives;
+text: .text%Java_java_lang_System_registerNatives;
+text: .text%Java_java_lang_Thread_registerNatives;
+text: .text%Java_java_security_AccessController_getStackAccessControlContext;
+text: .text%Java_java_security_AccessController_getInheritedAccessControlContext;
+text: .text%Java_java_lang_ClassLoader_registerNatives;
+text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2;
+text: .text%Java_java_lang_Class_registerNatives;
+text: .text%Java_java_lang_Class_getPrimitiveClass;
+text: .text%Java_java_lang_System_initProperties;
+text: .text%GetJavaProperties;
+text: .text%uname: OUTPUTDIR/java_props_md.o;
+text: .text%mapLookup: OUTPUTDIR/java_props_md.o;
+text: .text%setPathEnvironment: OUTPUTDIR/java_props_md.o;
+text: .text%JNU_NewStringPlatform;
+text: .text%JNU_CallStaticMethodByName;
+text: .text%NewStringPlatform;
+text: .text%Java_java_io_FileInputStream_initIDs;
+text: .text%Java_java_io_FileDescriptor_initIDs;
+text: .text%Java_java_io_FileOutputStream_initIDs;
+text: .text%Java_java_lang_System_setIn0;
+text: .text%Java_sun_reflect_Reflection_getCallerClass;
+text: .text%Java_java_lang_Class_forName0;
+text: .text%Java_java_lang_String_intern;
+text: .text%Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
+text: .text%Java_java_lang_Throwable_fillInStackTrace;
+text: .text%Java_java_lang_System_setOut0;
+text: .text%Java_java_lang_System_setErr0;
+text: .text%Java_java_lang_Compiler_registerNatives;
+text: .text%Java_java_io_FileSystem_getFileSystem;
+text: .text%JNU_NewObjectByName;
+text: .text%Java_java_io_UnixFileSystem_initIDs;
+text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
+text: .text%Java_java_io_UnixFileSystem_list;
+text: .text%JNU_GetStringPlatformChars;
+text: .text%JNU_ReleaseStringPlatformChars;
+text: .text%JNU_ClassString;
+text: .text%JNU_CopyObjectArray;
+text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
+text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
+text: .text%Java_java_lang_System_mapLibraryName;
+text: .text%cpchars: OUTPUTDIR/System.o;
+text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
+text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_find;
+text: .text%Java_java_lang_Float_floatToIntBits;
+text: .text%Java_java_lang_Double_doubleToLongBits;
+text: .text%Java_java_io_FileInputStream_open;
+text: .text%fileOpen;
+text: .text%Java_java_io_UnixFileSystem_getLength;
+text: .text%Java_java_io_FileInputStream_readBytes;
+text: .text%readBytes;
+text: .text%Java_java_io_FileInputStream_close0;
+text: .text%Java_java_lang_Object_getClass;
+text: .text%Java_java_lang_ClassLoader_defineClass0;
+text: .text%VerifyClassCodes;
+# Test Exit
+text: .text%Java_java_lang_Shutdown_halt;
+# Test Hello
+text: .text%Java_java_io_FileOutputStream_writeBytes;
+text: .text%writeBytes;
+# Test Sleep
+# Test IntToString
+# Test LoadToolkit
+text: .text%Java_java_util_ResourceBundle_getClassContext;
+text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
+text: .text%JNU_GetEnv;
+text: .text%Java_java_io_UnixFileSystem_checkAccess;
+text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
+text: .text%Java_java_lang_ref_Finalizer_invokeFinalizeMethod;
+text: .text%Java_java_io_FileInputStream_available;
+text: .text%Java_java_lang_reflect_Array_newArray;
+text: .text%Java_java_lang_Throwable_getStackTraceDepth;
+text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_System_identityHashCode;
+text: .text%Java_sun_misc_Signal_findSignal;
+text: .text%Java_sun_misc_Signal_handle0;
+text: .text%JNU_NotifyAll;
+# Test LoadFrame
+text: .text%JNU_CallMethodByName;
+text: .text%JNU_CallMethodByNameV;
+text: .text%Java_java_util_logging_FileHandler_lockFile;
+text: .text%Java_java_io_FileOutputStream_open;
+text: .text%Java_java_io_UnixFileSystem_createDirectory;
+text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
+text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
+text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
+text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
+text: .text%Java_java_io_FileOutputStream_close0;
+text: .text%Java_java_util_logging_FileHandler_unlockFile;
+# Test LoadJFrame
+text: .text%Java_java_lang_Class_isAssignableFrom;
+text: .text%Java_java_lang_Class_isInstance;
+# Test JHello
+# SwingSet
+text: .text%Java_java_util_TimeZone_getSystemTimeZoneID;
+text: .text%findJavaTZ_md;
+text: .text%Java_java_lang_StrictMath_log;
--- a/makefiles/mapfiles/libjli/mapfile-vers	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/mapfiles/libjli/mapfile-vers	Fri Sep 28 10:54:12 2012 -0700
@@ -34,6 +34,8 @@
 		JLI_ReportErrorMessageSys;
 		JLI_ReportMessage;
 		JLI_ReportExceptionDescription;
+		JLI_GetStdArgs;
+		JLI_GetStdArgc;
 	local:
 		*;
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/mapfiles/libjpeg/reorder-x86	Fri Sep 28 10:54:12 2012 -0700
@@ -0,0 +1,119 @@
+data = R0x2000;
+text = LOAD ?RXO;
+# Test Null
+# Test Exit
+# Test Hello
+# Test Sleep
+# Test IntToString
+# Test LoadToolkit
+# Test LoadFrame
+# Test LoadJFrame
+# Test JHello
+# SwingSet
+text: .text%JNI_OnLoad;
+text: .text%Java_sun_awt_image_JPEGImageDecoder_initIDs;
+text: .text%Java_sun_awt_image_JPEGImageDecoder_readImage;
+text: .text%jStdError;
+text: .text%jCreaDecompress;
+text: .text%jIMemMgr;
+text: .text%jMemInit;
+text: .text%jGetSmall;
+text: .text%jIMReader;
+text: .text%alloc_small: OUTPUTDIR/jmemmgr.o;
+text: .text%reset_marker_reader: OUTPUTDIR/jdmarker.o;
+text: .text%jIInCtlr;
+# text: .text%GET_ARRAYS: OUTPUTDIR/jpegdecoder.o;
+text: .text%jReadHeader;
+text: .text%jConsumeInput;
+text: .text%reset_input_controller: OUTPUTDIR/jdinput.o;
+text: .text%reset_error_mgr: OUTPUTDIR/jerror.o;
+text: .text%sun_jpeg_init_source;
+text: .text%consume_markers: OUTPUTDIR/jdinput.o;
+text: .text%read_markers: OUTPUTDIR/jdmarker.o;
+# text: .text%first_marker: OUTPUTDIR/jdmarker.o;
+text: .text%sun_jpeg_fill_input_buffer;
+# text: .text%RELEASE_ARRAYS: OUTPUTDIR/jpegdecoder.o;
+# text: .text%get_soi: OUTPUTDIR/jdmarker.o;
+text: .text%emit_message: OUTPUTDIR/jerror.o;
+# text: .text%next_marker: OUTPUTDIR/jdmarker.o;
+text: .text%get_interesting_appn: OUTPUTDIR/jdmarker.o;
+# text: .text%examine_app0: OUTPUTDIR/jdmarker.o;
+text: .text%skip_variable: OUTPUTDIR/jdmarker.o;
+text: .text%sun_jpeg_skip_input_data;
+# text: .text%examine_app14: OUTPUTDIR/jdmarker.o;
+text: .text%get_dqt: OUTPUTDIR/jdmarker.o;
+text: .text%jAlcQTable;
+text: .text%get_sof: OUTPUTDIR/jdmarker.o;
+# text: .text%get_dri: OUTPUTDIR/jdmarker.o;
+text: .text%get_dht: OUTPUTDIR/jdmarker.o;
+text: .text%jAlcHTable;
+text: .text%get_sos: OUTPUTDIR/jdmarker.o;
+# text: .text%initial_setup: OUTPUTDIR/jdinput.o;
+text: .text%jDivRound;
+# text: .text%default_decompress_parms: OUTPUTDIR/jdapimin.o;
+text: .text%jHasMultScn;
+text: .text%jStrtDecompress;
+text: .text%jIDMaster;
+# text: .text%master_selection: OUTPUTDIR/jdmaster.o;
+text: .text%jCalcDimensions;
+# text: .text%use_merged_upsample: OUTPUTDIR/jdmaster.o;
+# text: .text%prepare_range_limit_table: OUTPUTDIR/jdmaster.o;
+text: .text%jIDColor;
+# text: .text%build_ycc_rgb_table: OUTPUTDIR/jdcolor.o;
+text: .text%jIUpsampler;
+text: .text%jRound;
+text: .text%alloc_sarray: OUTPUTDIR/jmemmgr.o;
+text: .text%alloc_large: OUTPUTDIR/jmemmgr.o;
+text: .text%jGetLarge;
+text: .text%jIDPostC;
+text: .text%jIIDCT;
+text: .text%jIHDecoder;
+text: .text%jIDCoefC;
+text: .text%jIDMainC;
+# text: .text%alloc_funny_pointers: OUTPUTDIR/jdmainct.o;
+text: .text%realize_virt_arrays: OUTPUTDIR/jmemmgr.o;
+text: .text%start_input_pass: OUTPUTDIR/jdinput.o;
+# text: .text%per_scan_setup: OUTPUTDIR/jdinput.o;
+# text: .text%latch_quant_tables: OUTPUTDIR/jdinput.o;
+text: .text%start_pass_huff_decoder: OUTPUTDIR/jdhuff.o;
+text: .text%jMkDDerived;
+text: .text%start_input_pass: OUTPUTDIR/jdcoefct.o;
+# text: .text%start_iMCU_row: OUTPUTDIR/jdcoefct.o;
+# text: .text%output_pass_setup: OUTPUTDIR/jdapistd.o;
+text: .text%prepare_for_output_pass: OUTPUTDIR/jdmaster.o;
+text: .text%start_pass: OUTPUTDIR/jddctmgr.o;
+text: .text%start_output_pass: OUTPUTDIR/jdcoefct.o;
+text: .text%start_pass_dcolor: OUTPUTDIR/jdcolor.o;
+text: .text%start_pass_upsample: OUTPUTDIR/jdsample.o;
+text: .text%start_pass_dpost: OUTPUTDIR/jdpostct.o;
+text: .text%start_pass_main: OUTPUTDIR/jdmainct.o;
+# text: .text%make_funny_pointers: OUTPUTDIR/jdmainct.o;
+text: .text%jReadScanlines;
+text: .text%process_data_context_main: OUTPUTDIR/jdmainct.o;
+text: .text%decompress_onepass: OUTPUTDIR/jdcoefct.o;
+text: .text%jZeroFar;
+text: .text%decode_mcu: OUTPUTDIR/jdhuff.o;
+text: .text%jFilBitBuf;
+text: .text%jHufDecode;
+text: .text%jRDislow;
+text: .text%sep_upsample: OUTPUTDIR/jdsample.o;
+text: .text%fullsize_upsample: OUTPUTDIR/jdsample.o;
+text: .text%h2v2_fancy_upsample: OUTPUTDIR/jdsample.o;
+text: .text%ycc_rgb_convert: OUTPUTDIR/jdcolor.o;
+# text: .text%set_wraparound_pointers: OUTPUTDIR/jdmainct.o;
+# text: .text%process_restart: OUTPUTDIR/jdhuff.o;
+text: .text%read_restart_marker: OUTPUTDIR/jdmarker.o;
+text: .text%finish_input_pass: OUTPUTDIR/jdinput.o;
+# text: .text%set_bottom_pointers: OUTPUTDIR/jdmainct.o;
+text: .text%jFinDecompress;
+text: .text%finish_output_pass: OUTPUTDIR/jdmaster.o;
+text: .text%sun_jpeg_term_source;
+text: .text%jAbort;
+text: .text%free_pool: OUTPUTDIR/jmemmgr.o;
+text: .text%jFreeLarge;
+text: .text%jFreeSmall;
+text: .text%jDestDecompress;
+text: .text%jDestroy;
+text: .text%self_destruct: OUTPUTDIR/jmemmgr.o;
+text: .text%jMemTerm;
+text: .text%process_data_simple_main: OUTPUTDIR/jdmainct.o;
--- a/makefiles/mapfiles/libnio/mapfile-linux	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/mapfiles/libnio/mapfile-linux	Fri Sep 28 10:54:12 2012 -0700
@@ -143,6 +143,7 @@
 		Java_sun_nio_fs_LinuxNativeDispatcher_fsetxattr0;
 		Java_sun_nio_fs_LinuxNativeDispatcher_fremovexattr0;
 		Java_sun_nio_fs_LinuxNativeDispatcher_setmntent0;
+                Java_sun_nio_fs_LinuxNativeDispatcher_getmntent;
 		Java_sun_nio_fs_LinuxNativeDispatcher_endmntent;
 		Java_sun_nio_fs_UnixNativeDispatcher_init;
 		Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
@@ -189,7 +190,6 @@
 		Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
 		Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
 		Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
-		Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
 		Java_sun_nio_fs_UnixCopyFile_transfer;
 		handleSocketError;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/mapfiles/libnio/mapfile-macosx	Fri Sep 28 10:54:12 2012 -0700
@@ -0,0 +1,174 @@
+#
+# Copyright (c) 2001, 2011, 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.
+#
+
+SUNWprivate_1.1 {
+	global:
+                Java_java_nio_MappedByteBuffer_force0;
+                Java_java_nio_MappedByteBuffer_isLoaded0;
+                Java_java_nio_MappedByteBuffer_load0;
+                Java_sun_nio_ch_DatagramChannelImpl_disconnect0;
+                Java_sun_nio_ch_DatagramChannelImpl_initIDs;
+                Java_sun_nio_ch_DatagramChannelImpl_receive0;
+                Java_sun_nio_ch_DatagramChannelImpl_send0;
+                Java_sun_nio_ch_DatagramDispatcher_read0;
+                Java_sun_nio_ch_DatagramDispatcher_readv0;
+                Java_sun_nio_ch_DatagramDispatcher_write0;
+                Java_sun_nio_ch_DatagramDispatcher_writev0;
+                Java_sun_nio_ch_FileChannelImpl_close0;
+                Java_sun_nio_ch_FileChannelImpl_initIDs;
+                Java_sun_nio_ch_FileChannelImpl_map0;
+                Java_sun_nio_ch_FileChannelImpl_position0;
+                Java_sun_nio_ch_FileChannelImpl_transferTo0;
+                Java_sun_nio_ch_FileChannelImpl_unmap0;
+                Java_sun_nio_ch_FileDispatcherImpl_close0;
+                Java_sun_nio_ch_FileDispatcherImpl_closeIntFD;
+		Java_sun_nio_ch_FileDispatcherImpl_force0;
+                Java_sun_nio_ch_FileDispatcherImpl_init;
+		Java_sun_nio_ch_FileDispatcherImpl_lock0;
+                Java_sun_nio_ch_FileDispatcherImpl_preClose0;
+                Java_sun_nio_ch_FileDispatcherImpl_pread0;
+                Java_sun_nio_ch_FileDispatcherImpl_pwrite0;
+                Java_sun_nio_ch_FileDispatcherImpl_read0;
+                Java_sun_nio_ch_FileDispatcherImpl_readv0;
+		Java_sun_nio_ch_FileDispatcherImpl_release0;
+		Java_sun_nio_ch_FileDispatcherImpl_size0;
+		Java_sun_nio_ch_FileDispatcherImpl_truncate0;
+                Java_sun_nio_ch_FileDispatcherImpl_write0;
+                Java_sun_nio_ch_FileDispatcherImpl_writev0;
+                Java_sun_nio_ch_FileKey_init;
+                Java_sun_nio_ch_FileKey_initIDs;
+		Java_sun_nio_ch_InheritedChannel_close0;
+		Java_sun_nio_ch_InheritedChannel_dup;
+		Java_sun_nio_ch_InheritedChannel_dup2;
+		Java_sun_nio_ch_InheritedChannel_open0;
+		Java_sun_nio_ch_InheritedChannel_peerAddress0;
+		Java_sun_nio_ch_InheritedChannel_peerPort0;
+		Java_sun_nio_ch_InheritedChannel_soType0;
+                Java_sun_nio_ch_IOUtil_configureBlocking;
+                Java_sun_nio_ch_IOUtil_drain;
+                Java_sun_nio_ch_IOUtil_fdVal;
+                Java_sun_nio_ch_IOUtil_initIDs;
+                Java_sun_nio_ch_IOUtil_makePipe;
+                Java_sun_nio_ch_IOUtil_randomBytes;
+                Java_sun_nio_ch_IOUtil_setfdVal;
+		Java_sun_nio_ch_KQueue_kqueue;
+		Java_sun_nio_ch_KQueue_keventRegister;
+		Java_sun_nio_ch_KQueue_keventPoll;
+		Java_sun_nio_ch_KQueue_keventSize;
+		Java_sun_nio_ch_KQueue_identOffset;
+		Java_sun_nio_ch_KQueue_filterOffset;
+		Java_sun_nio_ch_KQueue_flagsOffset;
+		Java_sun_nio_ch_KQueuePort_socketpair;
+		Java_sun_nio_ch_KQueuePort_interrupt;
+		Java_sun_nio_ch_KQueuePort_drain1;
+		Java_sun_nio_ch_KQueuePort_close0;
+		Java_sun_nio_ch_NativeThread_current;
+		Java_sun_nio_ch_NativeThread_init;
+		Java_sun_nio_ch_NativeThread_signal;
+		Java_sun_nio_ch_Net_canIPv6SocketJoinIPv4Group0;
+		Java_sun_nio_ch_Net_canJoin6WithIPv4Group0;
+		Java_sun_nio_ch_Net_socket0;
+		Java_sun_nio_ch_Net_bind0;
+		Java_sun_nio_ch_Net_connect0;
+		Java_sun_nio_ch_Net_listen;
+		Java_sun_nio_ch_Net_localPort;
+		Java_sun_nio_ch_Net_localInetAddress;
+		Java_sun_nio_ch_Net_getIntOption0;
+		Java_sun_nio_ch_Net_setIntOption0;
+                Java_sun_nio_ch_Net_initIDs;
+		Java_sun_nio_ch_Net_isIPv6Available0;
+		Java_sun_nio_ch_Net_joinOrDrop4;
+		Java_sun_nio_ch_Net_blockOrUnblock4;
+		Java_sun_nio_ch_Net_joinOrDrop6;
+		Java_sun_nio_ch_Net_blockOrUnblock6;
+		Java_sun_nio_ch_Net_setInterface4;
+		Java_sun_nio_ch_Net_getInterface4;
+		Java_sun_nio_ch_Net_setInterface6;
+		Java_sun_nio_ch_Net_getInterface6;
+		Java_sun_nio_ch_Net_shutdown;
+                Java_sun_nio_ch_PollArrayWrapper_interrupt;
+                Java_sun_nio_ch_PollArrayWrapper_poll0;
+                Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
+                Java_sun_nio_ch_ServerSocketChannelImpl_initIDs;
+                Java_sun_nio_ch_SocketChannelImpl_checkConnect;
+		Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData;
+		Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
+		Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
+		Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
+		Java_sun_nio_fs_BsdNativeDispatcher_initIDs;
+		Java_sun_nio_fs_BsdNativeDispatcher_getfsstat;
+		Java_sun_nio_fs_BsdNativeDispatcher_fsstatEntry;
+		Java_sun_nio_fs_BsdNativeDispatcher_endfsstat;
+		Java_sun_nio_fs_UnixNativeDispatcher_init;
+		Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
+		Java_sun_nio_fs_UnixNativeDispatcher_strerror;
+		Java_sun_nio_fs_UnixNativeDispatcher_dup;
+		Java_sun_nio_fs_UnixNativeDispatcher_access0;
+		Java_sun_nio_fs_UnixNativeDispatcher_stat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_lstat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fstat;
+		Java_sun_nio_fs_UnixNativeDispatcher_fstatat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_chmod0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fchmod;
+		Java_sun_nio_fs_UnixNativeDispatcher_chown0;
+		Java_sun_nio_fs_UnixNativeDispatcher_lchown0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fchown;
+		Java_sun_nio_fs_UnixNativeDispatcher_utimes0;
+		Java_sun_nio_fs_UnixNativeDispatcher_futimes;
+		Java_sun_nio_fs_UnixNativeDispatcher_open0;
+		Java_sun_nio_fs_UnixNativeDispatcher_openat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_close;
+		Java_sun_nio_fs_UnixNativeDispatcher_read;
+		Java_sun_nio_fs_UnixNativeDispatcher_write;
+		Java_sun_nio_fs_UnixNativeDispatcher_fopen0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fclose;
+		Java_sun_nio_fs_UnixNativeDispatcher_opendir0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fdopendir;
+		Java_sun_nio_fs_UnixNativeDispatcher_readdir;
+		Java_sun_nio_fs_UnixNativeDispatcher_closedir;
+		Java_sun_nio_fs_UnixNativeDispatcher_link0;
+		Java_sun_nio_fs_UnixNativeDispatcher_unlink0;
+		Java_sun_nio_fs_UnixNativeDispatcher_unlinkat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_rename0;
+		Java_sun_nio_fs_UnixNativeDispatcher_renameat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_mkdir0;
+		Java_sun_nio_fs_UnixNativeDispatcher_rmdir0;
+		Java_sun_nio_fs_UnixNativeDispatcher_symlink0;
+		Java_sun_nio_fs_UnixNativeDispatcher_readlink0;
+		Java_sun_nio_fs_UnixNativeDispatcher_realpath0;
+		Java_sun_nio_fs_UnixNativeDispatcher_statvfs0;
+		Java_sun_nio_fs_UnixNativeDispatcher_pathconf0;
+		Java_sun_nio_fs_UnixNativeDispatcher_fpathconf;
+		Java_sun_nio_fs_UnixNativeDispatcher_mknod0;
+		Java_sun_nio_fs_UnixNativeDispatcher_getpwuid;
+		Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
+		Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
+		Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
+		Java_sun_nio_fs_UnixCopyFile_transfer;
+		handleSocketError;
+
+	local:
+		*;
+};
--- a/makefiles/mapfiles/libnio/mapfile-solaris	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/mapfiles/libnio/mapfile-solaris	Fri Sep 28 10:54:12 2012 -0700
@@ -169,10 +169,10 @@
 		Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
 		Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
 		Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
-		Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
 		Java_sun_nio_fs_UnixCopyFile_transfer;
 		Java_sun_nio_fs_SolarisNativeDispatcher_init;
 		Java_sun_nio_fs_SolarisNativeDispatcher_facl;
+		Java_sun_nio_fs_SolarisNativeDispatcher_getextmntent;
 		Java_sun_nio_fs_SolarisWatchService_init;
 		Java_sun_nio_fs_SolarisWatchService_portCreate;
 		Java_sun_nio_fs_SolarisWatchService_portAssociate;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/mapfiles/libnio/reorder-x86	Fri Sep 28 10:54:12 2012 -0700
@@ -0,0 +1,17 @@
+data = R0x2000;
+text = LOAD ?RXO;
+# Test Null
+# Test Exit
+# Test Hello
+# Test Sleep
+# Test IntToString
+# Test LoadToolkit
+text: .text%Java_sun_nio_ch_FileChannelImpl_initIDs;
+text: .text%Java_sun_nio_ch_FileDispatcher_initIDs;
+text: .text%Java_sun_nio_ch_IOUtil_initIDs;
+text: .text%Java_sun_nio_ch_FileDispatcher_read0;
+text: .text%convertReturnVal;
+# Test LoadFrame
+# Test LoadJFrame
+# Test JHello
+# SwingSet
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/mapfiles/libverify/reorder-x86	Fri Sep 28 10:54:12 2012 -0700
@@ -0,0 +1,40 @@
+data = R0x2000;
+text = LOAD ?RXO;
+# Test Null
+text: .text%VerifyFixClassname;
+text: .text%VerifyClassname;
+text: .text%skip_over_fieldname: OUTPUTDIR/check_format.o;
+text: .text%skip_over_field_signature: OUTPUTDIR/check_format.o;
+text: .text%VerifyClass;
+text: .text%make_class_info_from_name: OUTPUTDIR/check_code.o;
+text: .text%class_name_to_ID: OUTPUTDIR/check_code.o;
+text: .text%make_class_info: OUTPUTDIR/check_code.o;
+text: .text%free_block: OUTPUTDIR/check_code.o;
+text: .text%verify_method: OUTPUTDIR/check_code.o;
+text: .text%verify_opcode_operands: OUTPUTDIR/check_code.o;
+text: .text%initialize_dataflow: OUTPUTDIR/check_code.o;
+text: .text%signature_to_fieldtype: OUTPUTDIR/check_code.o;
+text: .text%check_register_values: OUTPUTDIR/check_code.o;
+text: .text%pop_stack: OUTPUTDIR/check_code.o;
+text: .text%update_registers: OUTPUTDIR/check_code.o;
+text: .text%push_stack: OUTPUTDIR/check_code.o;
+text: .text%merge_into_successors: OUTPUTDIR/check_code.o;
+text: .text%cp_index_to_class_fullinfo: OUTPUTDIR/check_code.o;
+text: .text%set_protected: OUTPUTDIR/check_code.o;
+text: .text%merge_into_one_successor: OUTPUTDIR/check_code.o;
+text: .text%merge_registers: OUTPUTDIR/check_code.o;
+# Test Exit
+# Test Hello
+text: .text%merge_fullinfo_types: OUTPUTDIR/check_code.o;
+text: .text%isAssignableTo: OUTPUTDIR/check_code.o;
+# Test Sleep
+text: .text%isLegalTarget: OUTPUTDIR/check_code.o;
+text: .text%verify_constant_pool_type: OUTPUTDIR/check_code.o;
+# Test IntToString
+# Test LoadToolkit
+# Test LoadFrame
+# Test LoadJFrame
+# Test JHello
+# SwingSet
+text: .text%copy_stack: OUTPUTDIR/check_code.o;
+text: .text%ntohl: OUTPUTDIR/check_code.o;
--- a/makefiles/mapfiles/libzip/mapfile-vers	Fri Sep 28 14:54:04 2012 +0400
+++ b/makefiles/mapfiles/libzip/mapfile-vers	Fri Sep 28 10:54:12 2012 -0700
@@ -37,16 +37,12 @@
 		Java_java_util_zip_Deflater_deflateBytes;
 		Java_java_util_zip_Deflater_end;
 		Java_java_util_zip_Deflater_getAdler;
-		Java_java_util_zip_Deflater_getBytesRead;
-		Java_java_util_zip_Deflater_getBytesWritten;
 		Java_java_util_zip_Deflater_init;
 		Java_java_util_zip_Deflater_initIDs;
 		Java_java_util_zip_Deflater_reset;
 		Java_java_util_zip_Deflater_setDictionary;
 		Java_java_util_zip_Inflater_end;
 		Java_java_util_zip_Inflater_getAdler;
-		Java_java_util_zip_Inflater_getBytesRead;
-		Java_java_util_zip_Inflater_getBytesWritten;
 		Java_java_util_zip_Inflater_inflateBytes;
 		Java_java_util_zip_Inflater_init;
 		Java_java_util_zip_Inflater_initIDs;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/mapfiles/libzip/reorder-x86	Fri Sep 28 10:54:12 2012 -0700
@@ -0,0 +1,49 @@
+data = R0x2000;
+text = LOAD ?RXO;
+# Test Null
+text: .text%ZIP_Open;
+text: .text%ZIP_Open_Generic;
+text: .text%InitializeZip;
+text: .text%allocZip;
+text: .text%readCEN: OUTPUTDIR/zip_util.o;
+text: .text%findEND: OUTPUTDIR/zip_util.o;
+text: .text%hash: OUTPUTDIR/zip_util.o;
+text: .text%isMetaName: OUTPUTDIR/zip_util.o;
+text: .text%addMetaName: OUTPUTDIR/zip_util.o;
+text: .text%ZIP_FindEntry;
+text: .text%ZIP_GetEntry;
+text: .text%ZIP_Lock;
+text: .text%readLOC: OUTPUTDIR/zip_util.o;
+text: .text%ZIP_Unlock;
+text: .text%ZIP_FreeEntry;
+text: .text%Java_java_util_zip_ZipFile_initIDs;
+text: .text%Java_java_util_zip_ZipFile_open;
+text: .text%Java_java_util_zip_ZipFile_getTotal;
+text: .text%Java_java_util_zip_ZipFile_getEntry;
+text: .text%Java_java_util_zip_ZipFile_freeEntry;
+text: .text%Java_java_util_zip_ZipFile_getEntryTime;
+text: .text%Java_java_util_zip_ZipFile_getEntryCrc;
+text: .text%Java_java_util_zip_ZipFile_getEntryCSize;
+text: .text%Java_java_util_zip_ZipFile_getEntrySize;
+text: .text%Java_java_util_zip_ZipFile_getEntryFlag;
+text: .text%Java_java_util_zip_ZipFile_getEntryMethod;
+text: .text%Java_java_util_zip_ZipFile_getEntryBytes;
+text: .text%Java_java_util_zip_Inflater_initIDs;
+text: .text%Java_java_util_zip_Inflater_init;
+text: .text%inflateInit2_;
+text: .text%zcalloc;
+text: .text%inflateReset;
+text: .text%Java_java_util_zip_Inflater_inflateBytes;
+text: .text%inflate;
+text: .text%Java_java_util_zip_ZipFile_read;
+text: .text%ZIP_Read;
+text: .text%huft_build: OUTPUTDIR/inftrees.o;
+text: .text%zcfree;
+text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
+text: .text%ZIP_ReadEntry;
+text: .text%InflateFully;
+text: .text%inflateEnd;
+text: .text%Java_java_util_zip_Inflater_reset;
+text: .text%Java_java_util_zip_ZipFile_close;
+text: .text%ZIP_Close;
+text: .text%Java_java_util_zip_Inflater_end;
--- a/src/macosx/classes/sun/font/CFontManager.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/macosx/classes/sun/font/CFontManager.java	Fri Sep 28 10:54:12 2012 -0700
@@ -37,6 +37,7 @@
 import javax.swing.plaf.FontUIResource;
 
 import sun.awt.FontConfiguration;
+import sun.awt.HeadlessToolkit;
 import sun.lwawt.macosx.*;
 
 public class CFontManager extends SunFontManager {
@@ -342,9 +343,14 @@
     @Override
     public String getFontPath(boolean noType1Fonts) {
         // In the case of the Cocoa toolkit, since we go through NSFont, we dont need to register /Library/Fonts
-        if (Toolkit.getDefaultToolkit() instanceof LWCToolkit) {
+        Toolkit tk = Toolkit.getDefaultToolkit();
+        if (tk instanceof HeadlessToolkit) {
+            tk = ((HeadlessToolkit)tk).getUnderlyingToolkit();
+        }
+        if (tk instanceof LWCToolkit) {
             return "";
         }
+
         // X11 case
         return "/Library/Fonts";
     }
--- a/src/macosx/native/sun/awt/CTextPipe.m	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/macosx/native/sun/awt/CTextPipe.m	Fri Sep 28 10:54:12 2012 -0700
@@ -239,9 +239,22 @@
     CGContextSetTextMatrix(cgRef, CGAffineTransformIdentity); // resets the damage from CoreText
 
     NSString *string = [NSString stringWithCharacters:chars length:length];
+    /*
+       The calls below were used previously but for unknown reason did not 
+       render using the right font (see bug 7183516) when attribString is not 
+       initialized with font dictionary attributes.  It seems that "options" 
+       in CTTypesetterCreateWithAttributedStringAndOptions which contains the 
+       font dictionary is ignored.
+
     NSAttributedString *attribString = [[NSAttributedString alloc] initWithString:string];
 
     CTTypesetterRef typeSetterRef = CTTypesetterCreateWithAttributedStringAndOptions((CFAttributedStringRef) attribString, (CFDictionaryRef) ctsDictionaryFor(nsFont, JRSFontStyleUsesFractionalMetrics(strike->fStyle)));
+    */
+    NSAttributedString *attribString = [[NSAttributedString alloc]
+        initWithString:string
+        attributes:ctsDictionaryFor(nsFont, JRSFontStyleUsesFractionalMetrics(strike->fStyle))];
+    
+    CTTypesetterRef typeSetterRef = CTTypesetterCreateWithAttributedString((CFAttributedStringRef) attribString);
 
     CFRange range = {0, length};
     CTLineRef lineRef = CTTypesetterCreateLine(typeSetterRef, range);
--- a/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	Fri Sep 28 10:54:12 2012 -0700
@@ -883,7 +883,7 @@
             avHiBits &= (1L<<attrIndexLimit[i])-1;
             int nextLoBit = 0;
             Map<Attribute.Layout, int[]> defMap = allLayouts.get(i);
-            @SuppressWarnings({ "unchecked", "rawtypes" })
+            @SuppressWarnings({"unchecked", "rawtypes"})
             Map.Entry<Attribute.Layout, int[]>[] layoutsAndCounts =
                     new Map.Entry[defMap.size()];
             defMap.entrySet().toArray(layoutsAndCounts);
--- a/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Fri Sep 28 10:54:12 2012 -0700
@@ -32,14 +32,15 @@
 
 import com.sun.jmx.remote.util.EnvHelp;
 
-import java.beans.ConstructorProperties;
 import java.io.InvalidObjectException;
+import java.lang.annotation.Annotation;
 import java.lang.annotation.ElementType;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Array;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.ParameterizedType;
@@ -1129,14 +1130,56 @@
         to getters.  */
     private static final class CompositeBuilderViaConstructor
             extends CompositeBuilder {
+        static class AnnotationHelper {
+            private static Class<? extends Annotation> constructorPropertiesClass;
+            private static Method valueMethod;
+            static {
+                findConstructorPropertiesClass();
+            }
+
+            @SuppressWarnings("unchecked")
+            private static void findConstructorPropertiesClass() {
+                try {
+                    constructorPropertiesClass = (Class<? extends Annotation>)
+                        Class.forName("java.beans.ConstructorProperties", false,
+                                      DefaultMXBeanMappingFactory.class.getClassLoader());
+                    valueMethod = constructorPropertiesClass.getMethod("value");
+                } catch (ClassNotFoundException cnf) {
+                    // java.beans not present
+                } catch (NoSuchMethodException e) {
+                    // should not reach here
+                    throw new InternalError(e);
+                }
+            }
+
+            static boolean isAvailable() {
+                return constructorPropertiesClass != null;
+            }
+
+            static String[] getPropertyNames(Constructor<?> constr) {
+                if (!isAvailable())
+                    return null;
+
+                Annotation a = constr.getAnnotation(constructorPropertiesClass);
+                if (a == null) return null;
+
+                try {
+                    return (String[]) valueMethod.invoke(a);
+                } catch (InvocationTargetException e) {
+                    throw new InternalError(e);
+                } catch (IllegalAccessException e) {
+                    throw new InternalError(e);
+                }
+            }
+        }
 
         CompositeBuilderViaConstructor(Class<?> targetClass, String[] itemNames) {
             super(targetClass, itemNames);
         }
 
         String applicable(Method[] getters) throws InvalidObjectException {
-
-            final Class<ConstructorProperties> propertyNamesClass = ConstructorProperties.class;
+            if (!AnnotationHelper.isAvailable())
+                return "@ConstructorProperties annotation not available";
 
             Class<?> targetClass = getTargetClass();
             Constructor<?>[] constrs = targetClass.getConstructors();
@@ -1145,7 +1188,7 @@
             List<Constructor<?>> annotatedConstrList = newList();
             for (Constructor<?> constr : constrs) {
                 if (Modifier.isPublic(constr.getModifiers())
-                        && constr.getAnnotation(propertyNamesClass) != null)
+                        && AnnotationHelper.getPropertyNames(constr) != null)
                     annotatedConstrList.add(constr);
             }
 
@@ -1174,8 +1217,7 @@
             // so we can test unambiguity.
             Set<BitSet> getterIndexSets = newSet();
             for (Constructor<?> constr : annotatedConstrList) {
-                String[] propertyNames =
-                    constr.getAnnotation(propertyNamesClass).value();
+                String[] propertyNames = AnnotationHelper.getPropertyNames(constr);
 
                 Type[] paramTypes = constr.getGenericParameterTypes();
                 if (paramTypes.length != propertyNames.length) {
--- a/src/share/classes/com/sun/management/VMOption.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/com/sun/management/VMOption.java	Fri Sep 28 10:54:12 2012 -0700
@@ -178,7 +178,7 @@
         return "VM option: " + getName() +
                " value: " + value + " " +
                " origin: " + origin + " " +
-               (writeable ? "(read-only)" : "(read-write)");
+               (writeable ? "(read-write)" : "(read-only)");
     }
 
     /**
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java	Fri Sep 28 10:54:12 2012 -0700
@@ -153,8 +153,8 @@
                         break;
                 }
             }
-                        for (Node el=config.getFirstChild();el!=null;el=el.getNextSibling()) {
-                if (!(el instanceof Element)) {
+            for (Node el=config.getFirstChild();el!=null;el=el.getNextSibling()) {
+                if (el.getNodeType() != Node.ELEMENT_NODE) {
                         continue;
                 }
                 String tag=el.getLocalName();
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java	Fri Sep 28 10:54:12 2012 -0700
@@ -205,7 +205,7 @@
         try {
          NameSpaceSymbTable ns=new NameSpaceSymbTable();
          int nodeLevel=NODE_BEFORE_DOCUMENT_ELEMENT;
-         if (rootNode instanceof Element) {
+         if (rootNode != null && rootNode.getNodeType() == Node.ELEMENT_NODE) {
                 //Fills the nssymbtable with the definitions of the parent of the root subnode
                 getParentNameSpaces((Element)rootNode,ns);
                 nodeLevel=NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT;
@@ -335,7 +335,7 @@
                                 return;
                         sibling=parentNode.getNextSibling();
                         parentNode=parentNode.getParentNode();
-                        if (!(parentNode instanceof Element)) {
+                        if (parentNode !=null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
                                 documentLevel=NODE_AFTER_DOCUMENT_ELEMENT;
                                 parentNode=null;
                         }
@@ -391,7 +391,7 @@
                 return;
         boolean currentNodeIsVisible = false;
         NameSpaceSymbTable ns=new  NameSpaceSymbTable();
-        if (currentNode instanceof Element)
+        if (currentNode != null && currentNode.getNodeType() == Node.ELEMENT_NODE)
                 getParentNameSpaces((Element)currentNode,ns);
         Node sibling=null;
         Node parentNode=null;
@@ -512,7 +512,7 @@
                                 return;
                         sibling=parentNode.getNextSibling();
                         parentNode=parentNode.getParentNode();
-                        if (!(parentNode instanceof Element)) {
+                        if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
                                 parentNode=null;
                                 documentLevel=NODE_AFTER_DOCUMENT_ELEMENT;
                         }
@@ -594,18 +594,14 @@
         final void getParentNameSpaces(Element el,NameSpaceSymbTable ns)  {
                 List<Element> parents=new ArrayList<Element>(10);
                 Node n1=el.getParentNode();
-                if (!(n1 instanceof Element)) {
+                if (n1 == null || n1.getNodeType() != Node.ELEMENT_NODE) {
                         return;
                 }
                 //Obtain all the parents of the elemnt
-                Element parent=(Element) n1;
-                while (parent!=null) {
-                        parents.add(parent);
-                        Node n=parent.getParentNode();
-                        if (!(n instanceof Element )) {
-                                break;
-                        }
-                        parent=(Element)n;
+                Node parent = n1;
+                while (parent!=null && parent.getNodeType() == Node.ELEMENT_NODE) {
+                        parents.add((Element)parent);
+                        parent = parent.getParentNode();
                 }
                 //Visit them in reverse order.
                 ListIterator<Element> it=parents.listIterator(parents.size());
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1445,7 +1445,7 @@
                 // The de-serialiser returns a fragment whose children we need to
                 // take on.
 
-                if (sourceParent instanceof Document) {
+                if (sourceParent != null && sourceParent.getNodeType() == Node.DOCUMENT_NODE) {
 
                     // If this is a content decryption, this may have problems
 
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java	Fri Sep 28 10:54:12 2012 -0700
@@ -283,7 +283,7 @@
            Element e=null;
            while (it.hasNext()) {
                    Node currentNode=it.next();
-                   if (currentNode instanceof Element) {
+                   if (currentNode != null && currentNode.getNodeType() == Node.ELEMENT_NODE) {
                            e=(Element)currentNode;
                            break;
                    }
@@ -292,14 +292,14 @@
            List<Element> parents=new ArrayList<Element>(10);
 
                 //Obtain all the parents of the elemnt
-                do {
+                while (e != null) {
                         parents.add(e);
                         Node n=e.getParentNode();
-                        if (!(n instanceof Element )) {
+                        if (n == null || n.getNodeType() != Node.ELEMENT_NODE) {
                                 break;
                         }
                         e=(Element)n;
-                } while (e!=null);
+                }
                 //Visit them in reverse order.
                 ListIterator<Element> it2=parents.listIterator(parents.size()-1);
                 Element ele=null;
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java	Fri Sep 28 10:54:12 2012 -0700
@@ -225,7 +225,7 @@
         } while (sibling==null  && parentNode!=null) {
                         sibling=parentNode.getNextSibling();
                         parentNode=parentNode.getParentNode();
-                        if (!(parentNode instanceof Element)) {
+                        if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
                                 parentNode=null;
                         }
                 }
--- a/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, 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
@@ -31,7 +31,6 @@
 import java.io.*;
 import java.math.*;
 import java.util.*;
-import java.beans.*;
 
 import javax.sql.rowset.*;
 
@@ -83,12 +82,6 @@
      */
     private ResultSetMetaData resMD;
 
-    /**
-     * The property that helps to fire the property changed event when certain
-     * properties are changed in the <code>JdbcRowSet</code> object. This property
-     * is being added to satisfy Rave requirements.
-     */
-    private PropertyChangeSupport propertyChangeSupport;
 
     /**
      * The Vector holding the Match Columns
@@ -145,7 +138,6 @@
             throw new RuntimeException(ioe);
         }
 
-        propertyChangeSupport = new PropertyChangeSupport(this);
 
         initParams();
 
@@ -268,7 +260,6 @@
             throw new RuntimeException(ioe);
         }
 
-        propertyChangeSupport = new PropertyChangeSupport(this);
 
         initParams();
         // set the defaults
@@ -343,7 +334,6 @@
             throw new RuntimeException(ioe);
         }
 
-        propertyChangeSupport = new PropertyChangeSupport(this);
 
         initParams();
 
@@ -360,10 +350,6 @@
         setMaxRows(0);
         setMaxFieldSize(0);
 
-        // to ensure connection to a db call connect now
-        // and associate a conn with "this" object
-        // in this case.
-        conn = connect();
         setParams();
 
         setReadOnly(true);
@@ -435,7 +421,6 @@
             throw new RuntimeException(ioe);
         }
 
-        propertyChangeSupport = new PropertyChangeSupport(this);
 
         initParams();
 
@@ -620,12 +605,7 @@
 
     }
 
-    // An alternate solution is required instead of having the
-    // connect method as protected.
-    // This is a work around to assist Rave Team
-    // :ah
-
-    protected Connection connect() throws SQLException {
+    private Connection connect() throws SQLException {
 
         // Get a JDBC connection.
 
@@ -4056,9 +4036,7 @@
       // Added as per Rave requirements
 
       if( conn.getHoldability() != HOLD_CURSORS_OVER_COMMIT) {
-         ResultSet oldVal = rs;
          rs = null;
-         // propertyChangeSupport.firePropertyChange("ResultSet",oldVal,rs);
       }
     }
 
@@ -4119,9 +4097,7 @@
         // Makes the result ste handle null after rollback
         // Added as per Rave requirements
 
-        ResultSet oldVal = rs;
         rs = null;
-        // propertyChangeSupport.firePropertyChange("ResultSet", oldVal,rs);
     }
 
 
@@ -4247,12 +4223,6 @@
        rs = resultSet;
     }
 
-
-    // Over riding the setCommand from BaseRowSet for
-    // firing the propertyChangeSupport Event for
-    // Rave requirements when this property's value
-    // changes.
-
     /**
      * Sets this <code>JdbcRowSet</code> object's <code>command</code> property to
      * the given <code>String</code> object and clears the parameters, if any,
@@ -4277,28 +4247,19 @@
      * @see #getCommand
      */
     public void setCommand(String command) throws SQLException {
-       String oldVal;
 
        if (getCommand() != null) {
           if(!getCommand().equals(command)) {
-             oldVal = getCommand();
              super.setCommand(command);
              ps = null;
              rs = null;
-             propertyChangeSupport.firePropertyChange("command", oldVal,command);
           }
        }
        else {
           super.setCommand(command);
-          propertyChangeSupport.firePropertyChange("command", null,command);
        }
     }
 
-    // Over riding the setDataSourceName from BaseRowSet for
-    // firing the propertyChangeSupport Event for
-    // Rave requirements when this property's values
-    // changes.
-
     /**
      * Sets the <code>dataSourceName</code> property for this <code>JdbcRowSet</code>
      * object to the given logical name and sets this <code>JdbcRowSet</code> object's
@@ -4329,28 +4290,20 @@
      * @see #getDataSourceName
      */
     public void setDataSourceName(String dsName) throws SQLException{
-       String oldVal;
 
        if(getDataSourceName() != null) {
           if(!getDataSourceName().equals(dsName)) {
-             oldVal = getDataSourceName();
              super.setDataSourceName(dsName);
              conn = null;
              ps = null;
              rs = null;
-             propertyChangeSupport.firePropertyChange("dataSourceName",oldVal,dsName);
           }
        }
        else {
           super.setDataSourceName(dsName);
-          propertyChangeSupport.firePropertyChange("dataSourceName",null,dsName);
        }
     }
 
-    // Over riding the setUrl from BaseRowSet for
-    // firing the propertyChangeSupport Event for
-    // Rave requirements when this property's values
-    // changes.
 
     /**
      * Sets the Url property for this <code>JdbcRowSet</code> object
@@ -4394,29 +4347,20 @@
      */
 
     public void setUrl(String url) throws SQLException {
-       String oldVal;
 
        if(getUrl() != null) {
           if(!getUrl().equals(url)) {
-             oldVal = getUrl();
              super.setUrl(url);
              conn = null;
              ps = null;
              rs = null;
-             propertyChangeSupport.firePropertyChange("url", oldVal, url);
           }
        }
        else {
           super.setUrl(url);
-          propertyChangeSupport.firePropertyChange("url", null, url);
        }
     }
 
-    // Over riding the setUsername from BaseRowSet for
-    // firing the propertyChangeSupport Event for
-    // Rave requirements when this property's values
-    // changes.
-
      /**
      * Sets the username property for this <code>JdbcRowSet</code> object
      * to the given user name. Because it
@@ -4438,29 +4382,20 @@
      * @see #getUsername
      */
     public void setUsername(String uname) {
-       String oldVal;
 
        if( getUsername() != null) {
           if(!getUsername().equals(uname)) {
-             oldVal = getUsername();
              super.setUsername(uname);
              conn = null;
              ps = null;
              rs = null;
-             propertyChangeSupport.firePropertyChange("username",oldVal,uname);
           }
        }
        else{
           super.setUsername(uname);
-          propertyChangeSupport.firePropertyChange("username",null,uname);
        }
     }
 
-    // Over riding the setPassword from BaseRowSet for
-    // firing the propertyChangeSupport Event for
-    // Rave requirements when this property's values
-    // changes.
-
      /**
      * Sets the password property for this <code>JdbcRowSet</code> object
      * to the given <code>String</code> object. Because it
@@ -4481,21 +4416,17 @@
      *     that must be supplied to the database to create a connection
      */
     public void setPassword(String password) {
-       String oldVal;
 
        if ( getPassword() != null) {
           if(!getPassword().equals(password)) {
-             oldVal = getPassword();
              super.setPassword(password);
              conn = null;
              ps = null;
              rs = null;
-             propertyChangeSupport.firePropertyChange("password",oldVal,password);
           }
        }
        else{
           super.setPassword(password);
-          propertyChangeSupport.firePropertyChange("password",null,password);
        }
     }
 
@@ -4528,7 +4459,6 @@
 
        if(oldVal != type) {
            super.setType(type);
-           propertyChangeSupport.firePropertyChange("type",oldVal,type);
        }
 
     }
@@ -4561,78 +4491,6 @@
 
        if(oldVal != concur) {
            super.setConcurrency(concur);
-           propertyChangeSupport.firePropertyChange("concurrency",oldVal,concur);
-       }
-
-    }
-
-    /**
-     * Sets the transaction isolation property for this JDBC <code>RowSet</code> object to the given
-     * constant. The DBMS will use this transaction isolation level for
-     * transactions if it can.
-     * <p>
-     * For <code>RowSet</code> implementations such as
-     * the <code>CachedRowSet</code> that operate in a disconnected environment,
-     * the <code>SyncProvider</code> object being used
-     * offers complementary locking and data integrity options. The
-     * options described below are pertinent only to connected <code>RowSet</code>
-     * objects (<code>JdbcRowSet</code> objects).
-     *
-     * @param transIso one of the following constants, listed in ascending order:
-     *              <code>Connection.TRANSACTION_NONE</code>,
-     *              <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
-     *              <code>Connection.TRANSACTION_READ_COMMITTED</code>,
-     *              <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
-     *              <code>Connection.TRANSACTION_SERIALIZABLE</code>
-     * @throws SQLException if the given parameter is not one of the Connection
-     *          constants
-     * @see javax.sql.rowset.spi.SyncFactory
-     * @see javax.sql.rowset.spi.SyncProvider
-     * @see #getTransactionIsolation
-     */
-    public void setTransactionIsolation(int transIso) throws SQLException {
-
-       int oldVal;
-
-       try {
-          oldVal = getTransactionIsolation();
-        }catch(NullPointerException ex) {
-           oldVal = 0;
-        }
-
-       if(oldVal != transIso) {
-           super.setTransactionIsolation(transIso);
-           propertyChangeSupport.firePropertyChange("transactionIsolation",oldVal,transIso);
-       }
-
-    }
-
-    /**
-     * Sets the maximum number of rows that this <code>RowSet</code> object may contain to
-     * the given number. If this limit is exceeded, the excess rows are
-     * silently dropped.
-     *
-     * @param mRows an <code>int</code> indicating the current maximum number
-     *     of rows; zero means that there is no limit
-     * @throws SQLException if an error occurs internally setting the
-     *     maximum limit on the number of rows that a JDBC <code>RowSet</code> object
-     *     can contain; or if <i>max</i> is less than <code>0</code>; or
-     *     if <i>max</i> is less than the <code>fetchSize</code> of the
-     *     <code>RowSet</code>
-     */
-    public void setMaxRows(int mRows) throws SQLException {
-
-       int oldVal;
-
-       try {
-          oldVal = getMaxRows();
-        }catch(NullPointerException ex) {
-           oldVal = 0;
-        }
-
-       if(oldVal != mRows) {
-           super.setMaxRows(mRows);
-           propertyChangeSupport.firePropertyChange("maxRows",oldVal,mRows);
        }
 
     }
--- a/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java	Fri Sep 28 10:54:12 2012 -0700
@@ -52,7 +52,9 @@
  * This can be used by a JAAS application to instantiate a
  * CallbackHandler
  * @see javax.security.auth.callback
+ * @deprecated This class will be removed in a future release.
  */
+@Deprecated
 public class DialogCallbackHandler implements CallbackHandler {
 
     /* -- Fields -- */
--- a/src/share/classes/java/io/FilePermission.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/io/FilePermission.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -31,10 +31,6 @@
 import java.util.ArrayList;
 import java.util.Vector;
 import java.util.Collections;
-import java.io.ObjectStreamField;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
 import sun.security.util.SecurityConstants;
 
 /**
@@ -424,7 +420,7 @@
     /**
      * Converts an actions String to an actions mask.
      *
-     * @param action the action string.
+     * @param actions the action string.
      * @return the actions mask.
      */
     private static int getMask(String actions) {
@@ -435,7 +431,9 @@
         if (actions == null) {
             return mask;
         }
-        // Check against use of constants (used heavily within the JDK)
+
+        // Use object identity comparison against known-interned strings for
+        // performance benefit (these values are used heavily within the JDK).
         if (actions == SecurityConstants.FILE_READ_ACTION) {
             return READ;
         } else if (actions == SecurityConstants.FILE_WRITE_ACTION) {
@@ -531,7 +529,7 @@
                 switch(a[i-matchlen]) {
                 case ',':
                     seencomma = true;
-                    /*FALLTHROUGH*/
+                    break;
                 case ' ': case '\r': case '\n':
                 case '\f': case '\t':
                     break;
@@ -798,7 +796,7 @@
      * @return an enumeration of all the FilePermission objects.
      */
 
-    public Enumeration elements() {
+    public Enumeration<Permission> elements() {
         // Convert Iterator into Enumeration
         synchronized (this) {
             return Collections.enumeration(perms);
@@ -843,7 +841,6 @@
     /*
      * Reads in a Vector of FilePermissions and saves them in the perms field.
      */
-    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException,
     ClassNotFoundException {
         // Don't call defaultReadObject()
@@ -852,6 +849,7 @@
         ObjectInputStream.GetField gfields = in.readFields();
 
         // Get the one we want
+        @SuppressWarnings("unchecked")
         Vector<Permission> permissions = (Vector<Permission>)gfields.get("permissions", null);
         perms = new ArrayList<>(permissions.size());
         perms.addAll(permissions);
--- a/src/share/classes/java/lang/AbstractStringBuilder.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/lang/AbstractStringBuilder.java	Fri Sep 28 10:54:12 2012 -0700
@@ -96,6 +96,8 @@
      * </ul>
      * If the {@code minimumCapacity} argument is nonpositive, this
      * method takes no action and simply returns.
+     * Note that subsequent operations on this object can reduce the
+     * actual capacity below that requested here.
      *
      * @param   minimumCapacity   the minimum desired capacity.
      */
--- a/src/share/classes/java/lang/management/LockInfo.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/lang/management/LockInfo.java	Fri Sep 28 10:54:12 2012 -0700
@@ -27,7 +27,7 @@
 
 import javax.management.openmbean.CompositeData;
 import java.util.concurrent.locks.*;
-import java.beans.ConstructorProperties;
+import sun.management.LockInfoCompositeData;
 
 /**
  * Information about a <em>lock</em>.  A lock can be a built-in object monitor,
@@ -44,8 +44,7 @@
  *
  * <h4><a name="MappedType">MXBean Mapping</a></h4>
  * <tt>LockInfo</tt> is mapped to a {@link CompositeData CompositeData}
- * as specified in the <a href="../../../javax/management/MXBean.html#mapping-rules">
- * type mapping rules</a> of {@linkplain javax.management.MXBean MXBeans}.
+ * as specified in the {@link #from from} method.
  *
  * @see java.util.concurrent.locks.AbstractOwnableSynchronizer
  * @see java.util.concurrent.locks.Condition
@@ -66,7 +65,6 @@
      * @param identityHashCode the {@link System#identityHashCode
      *                         identity hash code} of the lock object.
      */
-    @ConstructorProperties({"className", "identityHashCode"})
     public LockInfo(String className, int identityHashCode) {
         if (className == null) {
             throw new NullPointerException("Parameter className cannot be null");
@@ -103,6 +101,50 @@
     }
 
     /**
+     * Returns a {@code LockInfo} object represented by the
+     * given {@code CompositeData}.
+     * The given {@code CompositeData} must contain the following attributes:
+     * <blockquote>
+     * <table border>
+     * <tr>
+     *   <th align=left>Attribute Name</th>
+     *   <th align=left>Type</th>
+     * </tr>
+     * <tr>
+     *   <td>className</td>
+     *   <td><tt>java.lang.String</tt></td>
+     * </tr>
+     * <tr>
+     *   <td>identityHashCode</td>
+     *   <td><tt>java.lang.Integer</tt></td>
+     * </tr>
+     * </table>
+     * </blockquote>
+     *
+     * @param cd {@code CompositeData} representing a {@code LockInfo}
+     *
+     * @throws IllegalArgumentException if {@code cd} does not
+     *   represent a {@code LockInfo} with the attributes described
+     *   above.
+     * @return a {@code LockInfo} object represented
+     *         by {@code cd} if {@code cd} is not {@code null};
+     *         {@code null} otherwise.
+     *
+     * @since 1.8
+     */
+    public static LockInfo from(CompositeData cd) {
+        if (cd == null) {
+            return null;
+        }
+
+        if (cd instanceof LockInfoCompositeData) {
+            return ((LockInfoCompositeData) cd).getLockInfo();
+        } else {
+            return LockInfoCompositeData.toLockInfo(cd);
+        }
+    }
+
+    /**
      * Returns a string representation of a lock.  The returned
      * string representation consists of the name of the class of the
      * lock object, the at-sign character `@', and the unsigned
--- a/src/share/classes/java/lang/management/ThreadInfo.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/lang/management/ThreadInfo.java	Fri Sep 28 10:54:12 2012 -0700
@@ -696,9 +696,7 @@
      *   <td>lockInfo</td>
      *   <td><tt>javax.management.openmbean.CompositeData</tt>
      *       - the mapped type for {@link LockInfo} as specified in the
-     *       <a href="../../../javax/management/MXBean.html#mapping-rules">
-     *       type mapping rules</a> of
-     *       {@linkplain javax.management.MXBean MXBeans}.
+     *         {@link LockInfo#from} method.
      *       <p>
      *       If <tt>cd</tt> does not contain this attribute,
      *       the <tt>LockInfo</tt> object will be constructed from
@@ -766,10 +764,7 @@
      *   <td>lockedSynchronizers</td>
      *   <td><tt>javax.management.openmbean.CompositeData[]</tt>
      *       whose element type is the mapped type for
-     *       {@link LockInfo} as specified in the
-     *       <a href="../../../javax/management/MXBean.html#mapping-rules">
-     *       type mapping rules</a> of
-     *       {@linkplain javax.management.MXBean MXBeans}.
+     *       {@link LockInfo} as specified in the {@link LockInfo#from} method.
      *       <p>
      *       If <tt>cd</tt> does not contain this attribute,
      *       this attribute will be set to an empty array. </td>
@@ -830,7 +825,6 @@
      * @since 1.6
      */
     public LockInfo[] getLockedSynchronizers() {
-       // represents an <a href="LockInfo.html#OwnableSynchronizer">
         return lockedSynchronizers;
     }
 
--- a/src/share/classes/java/lang/reflect/Constructor.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/lang/reflect/Constructor.java	Fri Sep 28 10:54:12 2012 -0700
@@ -182,7 +182,7 @@
      * @since 1.5
      */
     @Override
-    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @SuppressWarnings({"rawtypes", "unchecked"})
     public TypeVariable<Constructor<T>>[] getTypeParameters() {
       if (getSignature() != null) {
         return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
--- a/src/share/classes/java/lang/reflect/Method.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/lang/reflect/Method.java	Fri Sep 28 10:54:12 2012 -0700
@@ -194,7 +194,7 @@
      * @since 1.5
      */
     @Override
-    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @SuppressWarnings({"rawtypes", "unchecked"})
     public TypeVariable<Method>[] getTypeParameters() {
         if (getGenericSignature() != null)
             return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
--- a/src/share/classes/java/net/SocketPermission.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/net/SocketPermission.java	Fri Sep 28 10:54:12 2012 -0700
@@ -467,7 +467,6 @@
      * @param action the action string
      * @return the action mask
      */
-    @SuppressWarnings("fallthrough")
     private static int getMask(String action) {
 
         if (action == null) {
@@ -480,7 +479,8 @@
 
         int mask = NONE;
 
-        // Check against use of constants (used heavily within the JDK)
+        // Use object identity comparison against known-interned strings for
+        // performance benefit (these values are used heavily within the JDK).
         if (action == SecurityConstants.SOCKET_RESOLVE_ACTION) {
             return RESOLVE;
         } else if (action == SecurityConstants.SOCKET_CONNECT_ACTION) {
@@ -568,7 +568,7 @@
                 switch(a[i-matchlen]) {
                 case ',':
                     seencomma = true;
-                    /*FALLTHROUGH*/
+                    break;
                 case ' ': case '\r': case '\n':
                 case '\f': case '\t':
                     break;
--- a/src/share/classes/java/nio/channels/AsynchronousFileChannel.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/nio/channels/AsynchronousFileChannel.java	Fri Sep 28 10:54:12 2012 -0700
@@ -248,7 +248,7 @@
         return provider.newAsynchronousFileChannel(file, options, executor, attrs);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
+    @SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction
     private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
 
     /**
--- a/src/share/classes/java/nio/channels/FileChannel.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/nio/channels/FileChannel.java	Fri Sep 28 10:54:12 2012 -0700
@@ -287,7 +287,7 @@
         return provider.newFileChannel(path, options, attrs);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
+    @SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction
     private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
 
     /**
--- a/src/share/classes/java/util/ArrayDeque.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/ArrayDeque.java	Fri Sep 28 10:54:12 2012 -0700
@@ -121,6 +121,7 @@
      *
      * @param numElements  the number of elements to hold
      */
+    @SuppressWarnings("unchecked")
     private void allocateElements(int numElements) {
         int initialCapacity = MIN_INITIAL_CAPACITY;
         // Find the best power of two to hold elements.
@@ -152,10 +153,11 @@
         int newCapacity = n << 1;
         if (newCapacity < 0)
             throw new IllegalStateException("Sorry, deque too big");
-        Object[] a = new Object[newCapacity];
+        @SuppressWarnings("unchecked")
+        E[] a = (E[]) new Object[newCapacity];
         System.arraycopy(elements, p, a, 0, r);
         System.arraycopy(elements, 0, a, r, p);
-        elements = (E[])a;
+        elements = a;
         head = 0;
         tail = n;
     }
@@ -182,6 +184,7 @@
      * Constructs an empty array deque with an initial capacity
      * sufficient to hold 16 elements.
      */
+    @SuppressWarnings("unchecked")
     public ArrayDeque() {
         elements = (E[]) new Object[16];
     }
@@ -793,6 +796,7 @@
      *         this deque
      * @throws NullPointerException if the specified array is null
      */
+    @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] a) {
         int size = size();
         if (a.length < size)
--- a/src/share/classes/java/util/Arrays.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/Arrays.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -560,7 +560,7 @@
      * off is the offset to generate corresponding low, high in src
      * To be removed in a future release.
      */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private static void mergeSort(Object[] src,
                                   Object[] dest,
                                   int low,
@@ -747,7 +747,7 @@
      * off is the offset into src corresponding to low in dest
      * To be removed in a future release.
      */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @SuppressWarnings({"rawtypes", "unchecked"})
     private static void mergeSort(Object[] src,
                                   Object[] dest,
                                   int low, int high, int off,
@@ -2832,6 +2832,7 @@
      * @return a list view of the specified array
      */
     @SafeVarargs
+    @SuppressWarnings("varargs")
     public static <T> List<T> asList(T... a) {
         return new ArrayList<>(a);
     }
--- a/src/share/classes/java/util/Collections.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/Collections.java	Fri Sep 28 10:54:12 2012 -0700
@@ -213,7 +213,7 @@
      * @throws IllegalArgumentException (optional) if the comparator is
      *         found to violate the {@link Comparator} contract
      */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @SuppressWarnings({"unchecked", "rawtypes"})
     public static <T> void sort(List<T> list, Comparator<? super T> c) {
         Object[] a = list.toArray();
         Arrays.sort(a, (Comparator)c);
@@ -418,7 +418,7 @@
      * @throws UnsupportedOperationException if the specified list or
      *         its list-iterator does not support the <tt>set</tt> operation.
      */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @SuppressWarnings({"rawtypes", "unchecked"})
     public static void reverse(List<?> list) {
         int size = list.size();
         if (size < REVERSE_THRESHOLD || list instanceof RandomAccess) {
@@ -497,7 +497,7 @@
      * @throws UnsupportedOperationException if the specified list or its
      *         list-iterator does not support the <tt>set</tt> operation.
      */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @SuppressWarnings({"rawtypes", "unchecked"})
     public static void shuffle(List<?> list, Random rnd) {
         int size = list.size();
         if (size < SHUFFLE_THRESHOLD || list instanceof RandomAccess) {
@@ -535,7 +535,7 @@
      *         || j &lt; 0 || j &gt;= list.size()).
      * @since 1.4
      */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @SuppressWarnings({"rawtypes", "unchecked"})
     public static void swap(List<?> list, int i, int j) {
         // instead of using a raw type here, it's possible to capture
         // the wildcard but it will require a call to a supplementary
@@ -669,7 +669,7 @@
      * @throws NoSuchElementException if the collection is empty.
      * @see Comparable
      */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @SuppressWarnings({"unchecked", "rawtypes"})
     public static <T> T min(Collection<? extends T> coll, Comparator<? super T> comp) {
         if (comp==null)
             return (T)min((Collection) coll);
@@ -740,7 +740,7 @@
      * @throws NoSuchElementException if the collection is empty.
      * @see Comparable
      */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @SuppressWarnings({"unchecked", "rawtypes"})
     public static <T> T max(Collection<? extends T> coll, Comparator<? super T> comp) {
         if (comp==null)
             return (T)max((Collection) coll);
@@ -1403,7 +1403,7 @@
             extends UnmodifiableSet<Map.Entry<K,V>> {
             private static final long serialVersionUID = 7854390611657943733L;
 
-            @SuppressWarnings({ "unchecked", "rawtypes" })
+            @SuppressWarnings({"unchecked", "rawtypes"})
             UnmodifiableEntrySet(Set<? extends Map.Entry<? extends K, ? extends V>> s) {
                 // Need to cast to raw in order to work around a limitation in the type system
                 super((Set)s);
@@ -3172,7 +3172,7 @@
      *
      * @see #emptySet()
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("rawtypes")
     public static final Set EMPTY_SET = new EmptySet<>();
 
     /**
@@ -3271,10 +3271,13 @@
             return new EmptySortedSet<>();
         }
 
-        public Comparator comparator() {
+        @Override
+        public Comparator<? super E> comparator() {
             return null;
         }
 
+        @Override
+        @SuppressWarnings("unchecked")
         public SortedSet<E> subSet(Object fromElement, Object toElement) {
             Objects.requireNonNull(fromElement);
             Objects.requireNonNull(toElement);
@@ -3294,6 +3297,7 @@
             return emptySortedSet();
         }
 
+        @Override
         public SortedSet<E> headSet(Object toElement) {
             Objects.requireNonNull(toElement);
 
@@ -3304,6 +3308,7 @@
             return emptySortedSet();
         }
 
+        @Override
         public SortedSet<E> tailSet(Object fromElement) {
             Objects.requireNonNull(fromElement);
 
@@ -3314,10 +3319,12 @@
             return emptySortedSet();
         }
 
+        @Override
         public E first() {
             throw new NoSuchElementException();
         }
 
+        @Override
         public E last() {
             throw new NoSuchElementException();
         }
@@ -3328,7 +3335,7 @@
      *
      * @see #emptyList()
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("rawtypes")
     public static final List EMPTY_LIST = new EmptyList<>();
 
     /**
@@ -3402,7 +3409,7 @@
      * @see #emptyMap()
      * @since 1.3
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("rawtypes")
     public static final Map EMPTY_MAP = new EmptyMap<>();
 
     /**
@@ -3685,6 +3692,7 @@
             return a;
         }
 
+        @SuppressWarnings("unchecked")
         public <T> T[] toArray(T[] a) {
             final int n = this.n;
             if (a.length < n) {
@@ -3731,6 +3739,7 @@
      *         the <tt>Comparable</tt> interface.
      * @see Comparable
      */
+    @SuppressWarnings("unchecked")
     public static <T> Comparator<T> reverseOrder() {
         return (Comparator<T>) ReverseComparator.REVERSE_ORDER;
     }
--- a/src/share/classes/java/util/ComparableTimSort.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/ComparableTimSort.java	Fri Sep 28 10:54:12 2012 -0700
@@ -208,7 +208,7 @@
      * @param start the index of the first element in the range that is
      *        not already known to be sorted ({@code lo <= start <= hi})
      */
-    @SuppressWarnings({ "fallthrough", "rawtypes", "unchecked" })
+    @SuppressWarnings({"fallthrough", "rawtypes", "unchecked"})
     private static void binarySort(Object[] a, int lo, int hi, int start) {
         assert lo <= start && start <= hi;
         if (start == lo)
@@ -277,7 +277,7 @@
      * @return  the length of the run beginning at the specified position in
      *          the specified array
      */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private static int countRunAndMakeAscending(Object[] a, int lo, int hi) {
         assert lo < hi;
         int runHi = lo + 1;
@@ -612,7 +612,7 @@
      *        (must be aBase + aLen)
      * @param len2  length of second run to be merged (must be > 0)
      */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private void mergeLo(int base1, int len1, int base2, int len2) {
         assert len1 > 0 && len2 > 0 && base1 + len1 == base2;
 
@@ -729,7 +729,7 @@
      *        (must be aBase + aLen)
      * @param len2  length of second run to be merged (must be > 0)
      */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private void mergeHi(int base1, int len1, int base2, int len2) {
         assert len1 > 0 && len2 > 0 && base1 + len1 == base2;
 
--- a/src/share/classes/java/util/Currency.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/Currency.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,8 @@
 import java.io.Serializable;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.regex.Pattern;
@@ -60,7 +62,14 @@
  * and the ISO 4217 currency data respectively.  The value part consists of
  * three ISO 4217 values of a currency, i.e., an alphabetic code, a numeric
  * code, and a minor unit.  Those three ISO 4217 values are separated by commas.
- * The lines which start with '#'s are considered comment lines.  For example,
+ * The lines which start with '#'s are considered comment lines. An optional UTC
+ * timestamp may be specified per currency entry if users need to specify a
+ * cutover date indicating when the new data comes into effect. The timestamp is
+ * appended to the end of the currency properties and uses a comma as a separator.
+ * If a UTC datestamp is present and valid, the JRE will only use the new currency
+ * properties if the current UTC date is later than the date specified at class
+ * loading time. The format of the timestamp must be of ISO 8601 format :
+ * {@code 'yyyy-MM-dd'T'HH:mm:ss'}. For example,
  * <p>
  * <code>
  * #Sample currency properties<br>
@@ -69,6 +78,20 @@
  * <p>
  * will supersede the currency data for Japan.
  *
+ * <p>
+ * <code>
+ * #Sample currency properties with cutover date<br>
+ * JP=JPZ,999,0,2014-01-01T00:00:00
+ * </code>
+ * <p>
+ * will supersede the currency data for Japan if {@code Currency} class is loaded after
+ * 1st January 2014 00:00:00 GMT.
+ * <p>
+ * Where syntactically malformed entries are encountered, the entry is ignored
+ * and the remainder of entries in file are processed. For instances where duplicate
+ * country code entries exist, the behavior of the Currency information for that
+ * {@code Currency} is undefined and the remainder of entries in file are processed.
+ *
  * @since 1.4
  */
 public final class Currency implements Serializable {
@@ -100,7 +123,6 @@
     private static ConcurrentMap<String, Currency> instances = new ConcurrentHashMap<>(7);
     private static HashSet<Currency> available;
 
-
     // Class data: currency data obtained from currency.data file.
     // Purpose:
     // - determine valid country codes
@@ -235,7 +257,9 @@
                         }
                         Set<String> keys = props.stringPropertyNames();
                         Pattern propertiesPattern =
-                            Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*([0-3])");
+                            Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*" +
+                                "([0-3])\\s*,?\\s*(\\d{4}-\\d{2}-\\d{2}T\\d{2}:" +
+                                "\\d{2}:\\d{2})?");
                         for (String key : keys) {
                            replaceCurrencyData(propertiesPattern,
                                key.toUpperCase(Locale.ROOT),
@@ -645,29 +669,38 @@
      *    consists of "three-letter alphabet code", "three-digit numeric code",
      *    and "one-digit (0,1,2, or 3) default fraction digit".
      *    For example, "JPZ,392,0".
-     * @throws
+     *    An optional UTC date can be appended to the string (comma separated)
+     *    to allow a currency change take effect after date specified.
+     *    For example, "JP=JPZ,999,0,2014-01-01T00:00:00" has no effect unless
+     *    UTC time is past 1st January 2014 00:00:00 GMT.
      */
     private static void replaceCurrencyData(Pattern pattern, String ctry, String curdata) {
 
         if (ctry.length() != 2) {
             // ignore invalid country code
-            String message = new StringBuilder()
-                .append("The entry in currency.properties for ")
-                .append(ctry).append(" is ignored because of the invalid country code.")
-                .toString();
-            info(message, null);
+            info("currency.properties entry for " + ctry +
+                    " is ignored because of the invalid country code.", null);
             return;
         }
 
         Matcher m = pattern.matcher(curdata);
-        if (!m.find()) {
+        if (!m.find() || (m.group(4) == null && countOccurrences(curdata, ',') >= 3)) {
             // format is not recognized.  ignore the data
-            String message = new StringBuilder()
-                .append("The entry in currency.properties for ")
-                .append(ctry)
-                .append(" is ignored because the value format is not recognized.")
-                .toString();
-            info(message, null);
+            // if group(4) date string is null and we've 4 values, bad date value
+            info("currency.properties entry for " + ctry +
+                    " ignored because the value format is not recognized.", null);
+            return;
+        }
+
+        try {
+            if (m.group(4) != null && !isPastCutoverDate(m.group(4))) {
+                info("currency.properties entry for " + ctry +
+                        " ignored since cutover date has not passed :" + curdata, null);
+                return;
+            }
+        } catch (IndexOutOfBoundsException | NullPointerException | ParseException ex) {
+            info("currency.properties entry for " + ctry +
+                        " ignored since exception encountered :" + ex.getMessage(), null);
             return;
         }
 
@@ -695,6 +728,26 @@
         setMainTableEntry(ctry.charAt(0), ctry.charAt(1), entry);
     }
 
+    private static boolean isPastCutoverDate(String s)
+            throws IndexOutOfBoundsException, NullPointerException, ParseException {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT);
+        format.setTimeZone(TimeZone.getTimeZone("UTC"));
+        format.setLenient(false);
+        long time = format.parse(s.trim()).getTime();
+        return System.currentTimeMillis() > time;
+
+    }
+
+    private static int countOccurrences(String value, char match) {
+        int count = 0;
+        for (char c : value.toCharArray()) {
+            if (c == match) {
+               ++count;
+            }
+        }
+        return count;
+    }
+
     private static void info(String message, Throwable t) {
         PlatformLogger logger = PlatformLogger.getLogger("java.util.Currency");
         if (logger.isLoggable(PlatformLogger.INFO)) {
--- a/src/share/classes/java/util/HashMap.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/HashMap.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -230,7 +230,7 @@
 
         this.loadFactor = loadFactor;
         threshold = (int)Math.min(capacity * loadFactor, MAXIMUM_CAPACITY + 1);
-        table = new Entry[capacity];
+        table = new Entry<?,?>[capacity];
         init();
     }
 
@@ -1078,7 +1078,7 @@
             capacity <<= 1;
         }
 
-        table = new Entry[capacity];
+        table = new Entry<?,?>[capacity];
         threshold = (int) Math.min(capacity * loadFactor, MAXIMUM_CAPACITY + 1);
         init();  // Give subclass a chance to do its thing.
 
--- a/src/share/classes/java/util/JumboEnumSet.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/JumboEnumSet.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, 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
@@ -121,6 +121,7 @@
             unseen = elements[0];
         }
 
+        @Override
         public boolean hasNext() {
             while (unseen == 0 && unseenIndex < elements.length - 1)
                 unseen = elements[++unseenIndex];
@@ -128,6 +129,7 @@
         }
 
         @Override
+        @SuppressWarnings("unchecked")
         public E next() {
             if (!hasNext())
                 throw new NoSuchElementException();
@@ -138,6 +140,7 @@
                                 + Long.numberOfTrailingZeros(lastReturned)];
         }
 
+        @Override
         public void remove() {
             if (lastReturned == 0)
                 throw new IllegalStateException();
--- a/src/share/classes/java/util/PriorityQueue.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/PriorityQueue.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, 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
@@ -330,6 +330,7 @@
         return true;
     }
 
+    @SuppressWarnings("unchecked")
     public E peek() {
         if (size == 0)
             return null;
--- a/src/share/classes/java/util/PropertyPermission.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/PropertyPermission.java	Fri Sep 28 10:54:12 2012 -0700
@@ -246,7 +246,8 @@
             return mask;
         }
 
-        // Check against use of constants (used heavily within the JDK)
+        // Use object identity comparison against known-interned strings for
+        // performance benefit (these values are used heavily within the JDK).
         if (actions == SecurityConstants.PROPERTY_READ_ACTION) {
             return READ;
         } if (actions == SecurityConstants.PROPERTY_WRITE_ACTION) {
--- a/src/share/classes/java/util/PropertyResourceBundle.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/PropertyResourceBundle.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, 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
@@ -125,6 +125,7 @@
      * @throws IOException if an I/O error occurs
      * @throws NullPointerException if <code>stream</code> is null
      */
+    @SuppressWarnings({"unchecked", "rawtypes"})
     public PropertyResourceBundle (InputStream stream) throws IOException {
         Properties properties = new Properties();
         properties.load(stream);
@@ -143,6 +144,7 @@
      * @throws NullPointerException if <code>reader</code> is null
      * @since 1.6
      */
+    @SuppressWarnings({"unchecked", "rawtypes"})
     public PropertyResourceBundle (Reader reader) throws IOException {
         Properties properties = new Properties();
         properties.load(reader);
--- a/src/share/classes/java/util/jar/JarVerifier.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/jar/JarVerifier.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -325,6 +325,7 @@
      * the given file in the jar.
      * @deprecated
      */
+    @Deprecated
     public java.security.cert.Certificate[] getCerts(String name)
     {
         return mapSignersToCertArray(getCodeSigners(name));
--- a/src/share/classes/java/util/jar/Pack200.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/jar/Pack200.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003,2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003,2012, 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
@@ -726,13 +726,13 @@
     private static final String PACK_PROVIDER = "java.util.jar.Pack200.Packer";
     private static final String UNPACK_PROVIDER = "java.util.jar.Pack200.Unpacker";
 
-    private static Class packerImpl;
-    private static Class unpackerImpl;
+    private static Class<?> packerImpl;
+    private static Class<?> unpackerImpl;
 
     private synchronized static Object newInstance(String prop) {
         String implName = "(unknown)";
         try {
-            Class impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl;
+            Class<?> impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl;
             if (impl == null) {
                 // The first time, we must decide which class to use.
                 implName = java.security.AccessController.doPrivileged(
--- a/src/share/classes/java/util/zip/package.html	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/java/util/zip/package.html	Fri Sep 28 10:54:12 2012 -0700
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1998, 2012, 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
@@ -41,7 +41,7 @@
 
 </a>
 <ul>
-  <li><a href="ftp://ftp.uu.net/pub/archiving/zip/doc/appnote-970311-iz.zip">
+  <li><a href="http://www.info-zip.org/doc/appnote-19970311-iz.zip">
       Info-ZIP Application Note 970311
       </a> - a detailed description of the Info-ZIP format upon which
       the <code>java.util.zip</code> classes are based.
--- a/src/share/classes/sun/management/LockDataConverter.java	Fri Sep 28 14:54:04 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2005, 2008, 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.
- */
-
-package sun.management;
-
-import java.lang.management.LockInfo;
-import java.lang.management.ThreadInfo;
-import javax.management.Attribute;
-import javax.management.StandardMBean;
-import javax.management.openmbean.CompositeData;
-
-/**
- * This MXBean is used for data conversion from LockInfo
- * to CompositeData (its mapped type) or vice versa.
- */
-class LockDataConverter extends StandardMBean
-         implements LockDataConverterMXBean {
-    private LockInfo      lockInfo;
-    private LockInfo[]    lockedSyncs;
-
-    LockDataConverter() {
-        super(LockDataConverterMXBean.class, true);
-        this.lockInfo = null;
-        this.lockedSyncs = null;
-    }
-
-    LockDataConverter(ThreadInfo ti) {
-        super(LockDataConverterMXBean.class, true);
-        this.lockInfo = ti.getLockInfo();
-        this.lockedSyncs = ti.getLockedSynchronizers();
-    }
-
-    public void setLockInfo(LockInfo l) {
-        this.lockInfo = l;
-    }
-
-    public LockInfo getLockInfo() {
-        return this.lockInfo;
-    }
-
-    public void setLockedSynchronizers(LockInfo[] l) {
-        this.lockedSyncs = l;
-    }
-
-    public LockInfo[] getLockedSynchronizers() {
-        return this.lockedSyncs;
-    }
-
-    // helper methods
-    CompositeData toLockInfoCompositeData() {
-        try {
-            return (CompositeData) getAttribute("LockInfo");
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    CompositeData[] toLockedSynchronizersCompositeData() {
-        try {
-            return (CompositeData[]) getAttribute("LockedSynchronizers");
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    LockInfo toLockInfo(CompositeData cd) {
-        try {
-            setAttribute(new Attribute("LockInfo", cd));
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-        return getLockInfo();
-    }
-
-    LockInfo[] toLockedSynchronizers(CompositeData[] cd) {
-        try {
-            setAttribute(new Attribute("LockedSynchronizers", cd));
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-        return getLockedSynchronizers();
-    }
-
-    static CompositeData toLockInfoCompositeData(LockInfo l) {
-        LockDataConverter ldc = new LockDataConverter();
-        ldc.setLockInfo(l);
-        return ldc.toLockInfoCompositeData();
-    }
-}
--- a/src/share/classes/sun/management/LockDataConverterMXBean.java	Fri Sep 28 14:54:04 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2005, 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.
- */
-
-package sun.management;
-
-import java.lang.management.LockInfo;
-
-/**
- * This interface is used for data conversion from LockInfo
- * to CompositeData (its mapped type) or vice versa.
- */
-public interface LockDataConverterMXBean {
-    public void setLockInfo(LockInfo l);
-    public LockInfo getLockInfo();
-
-    public void setLockedSynchronizers(LockInfo[] l);
-    public LockInfo[] getLockedSynchronizers();
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/management/LockInfoCompositeData.java	Fri Sep 28 10:54:12 2012 -0700
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+package sun.management;
+
+import java.lang.management.LockInfo;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.OpenDataException;
+
+/**
+ * A CompositeData for LockInfo for the local management support.
+ * This class avoids the performance penalty paid to the
+ * construction of a CompositeData use in the local case.
+ */
+public class LockInfoCompositeData extends LazyCompositeData {
+    private final LockInfo lock;
+
+    private LockInfoCompositeData(LockInfo li) {
+        this.lock = li;
+    }
+
+    public LockInfo getLockInfo() {
+        return lock;
+    }
+
+    public static CompositeData toCompositeData(LockInfo li) {
+        if (li == null) {
+            return null;
+        }
+
+        LockInfoCompositeData licd = new LockInfoCompositeData(li);
+        return licd.getCompositeData();
+    }
+
+    protected CompositeData getCompositeData() {
+        // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
+        // lockInfoItemNames!
+        final Object[] lockInfoItemValues = {
+            new String(lock.getClassName()),
+            new Integer(lock.getIdentityHashCode()),
+        };
+
+        try {
+            return new CompositeDataSupport(lockInfoCompositeType,
+                                            lockInfoItemNames,
+                                            lockInfoItemValues);
+        } catch (OpenDataException e) {
+            // Should never reach here
+            throw Util.newException(e);
+        }
+    }
+
+    private static final CompositeType lockInfoCompositeType;
+    static {
+        try {
+            lockInfoCompositeType = (CompositeType)
+                MappedMXBeanType.toOpenType(LockInfo.class);
+        } catch (OpenDataException e) {
+            // Should never reach here
+            throw Util.newException(e);
+        }
+    }
+
+    static CompositeType getLockInfoCompositeType() {
+        return lockInfoCompositeType;
+    }
+
+    private static final String CLASS_NAME         = "className";
+    private static final String IDENTITY_HASH_CODE = "identityHashCode";
+    private static final String[] lockInfoItemNames = {
+        CLASS_NAME,
+        IDENTITY_HASH_CODE,
+    };
+
+    /*
+     * Returns a LockInfo object mapped from the given CompositeData.
+     */
+    public static LockInfo toLockInfo(CompositeData cd) {
+        if (cd == null) {
+            throw new NullPointerException("Null CompositeData");
+        }
+
+        if (!isTypeMatched(lockInfoCompositeType, cd.getCompositeType())) {
+            throw new IllegalArgumentException(
+                "Unexpected composite type for LockInfo");
+        }
+
+        String className = getString(cd, CLASS_NAME);
+        int identityHashCode = getInt(cd, IDENTITY_HASH_CODE);
+        return new LockInfo(className, identityHashCode);
+    }
+
+    private static final long serialVersionUID = -6374759159749014052L;
+}
--- a/src/share/classes/sun/management/MappedMXBeanType.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/management/MappedMXBeanType.java	Fri Sep 28 10:54:12 2012 -0700
@@ -703,7 +703,7 @@
                 if (data instanceof java.lang.management.MonitorInfo) {
                     return MonitorInfoCompositeData.toCompositeData((MonitorInfo) data);
                 }
-                return LockDataConverter.toLockInfoCompositeData((LockInfo) data);
+                return LockInfoCompositeData.toCompositeData((LockInfo) data);
             }
 
             if (data instanceof MemoryNotificationInfo) {
--- a/src/share/classes/sun/management/MonitorInfoCompositeData.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/management/MonitorInfoCompositeData.java	Fri Sep 28 10:54:12 2012 -0700
@@ -59,7 +59,7 @@
 
         int len = monitorInfoItemNames.length;
         Object[] values = new Object[len];
-        CompositeData li = LockDataConverter.toLockInfoCompositeData(lock);
+        CompositeData li = LockInfoCompositeData.toCompositeData(lock);
 
         for (int i = 0; i < len; i++) {
             String item = monitorInfoItemNames[i];
--- a/src/share/classes/sun/management/ThreadInfoCompositeData.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/management/ThreadInfoCompositeData.java	Fri Sep 28 10:54:12 2012 -0700
@@ -85,11 +85,18 @@
         }
 
         // Convert MonitorInfo[] and LockInfo[] to CompositeData[]
-        LockDataConverter converter = new LockDataConverter(threadInfo);
-        CompositeData lockInfoData = converter.toLockInfoCompositeData();
-        CompositeData[] lockedSyncsData = converter.toLockedSynchronizersCompositeData();
+        CompositeData lockInfoData =
+            LockInfoCompositeData.toCompositeData(threadInfo.getLockInfo());
 
-        // Convert MonitorInfo[] to CompositeData[]
+        // Convert LockInfo[] and MonitorInfo[] to CompositeData[]
+        LockInfo[] lockedSyncs = threadInfo.getLockedSynchronizers();
+        CompositeData[] lockedSyncsData =
+            new CompositeData[lockedSyncs.length];
+        for (int i = 0; i < lockedSyncs.length; i++) {
+            LockInfo li = lockedSyncs[i];
+            lockedSyncsData[i] = LockInfoCompositeData.toCompositeData(li);
+        }
+
         MonitorInfo[] lockedMonitors = threadInfo.getLockedMonitors();
         CompositeData[] lockedMonitorsData =
             new CompositeData[lockedMonitors.length];
@@ -98,7 +105,6 @@
             lockedMonitorsData[i] = MonitorInfoCompositeData.toCompositeData(mi);
         }
 
-
         // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
         // threadInfoItemNames!
         final Object[] threadInfoItemValues = {
@@ -216,11 +222,11 @@
         // with it.  So we can get the CompositeType representing LockInfo
         // from a mapped CompositeData for any LockInfo object.
         // Thus we construct a random LockInfo object and pass it
-        // to LockDataConverter to do the conversion.
+        // to LockInfoCompositeData to do the conversion.
         Object o = new Object();
         LockInfo li = new LockInfo(o.getClass().getName(),
                                    System.identityHashCode(o));
-        CompositeData cd = LockDataConverter.toLockInfoCompositeData(li);
+        CompositeData cd = LockInfoCompositeData.toCompositeData(li);
         lockInfoCompositeType = cd.getCompositeType();
     }
 
@@ -315,9 +321,8 @@
 
     // 6.0 new attributes
     public LockInfo lockInfo() {
-        LockDataConverter converter = new LockDataConverter();
         CompositeData lockInfoData = (CompositeData) cdata.get(LOCK_INFO);
-        return converter.toLockInfo(lockInfoData);
+        return LockInfo.from(lockInfoData);
     }
 
     public MonitorInfo[] lockedMonitors() {
@@ -336,13 +341,17 @@
     }
 
     public LockInfo[] lockedSynchronizers() {
-        LockDataConverter converter = new LockDataConverter();
         CompositeData[] lockedSyncsData =
             (CompositeData[]) cdata.get(LOCKED_SYNCS);
 
         // The LockedSynchronizers item cannot be null, but if it is we will
         // get a NullPointerException when we ask for its length.
-        return converter.toLockedSynchronizers(lockedSyncsData);
+        LockInfo[] locks = new LockInfo[lockedSyncsData.length];
+        for (int i = 0; i < lockedSyncsData.length; i++) {
+            CompositeData cdi = lockedSyncsData[i];
+            locks[i] = LockInfo.from(cdi);
+        }
+        return locks;
     }
 
     /** Validate if the input CompositeData has the expected
--- a/src/share/classes/sun/security/ec/ECParameters.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/ec/ECParameters.java	Fri Sep 28 10:54:12 2012 -0700
@@ -87,8 +87,10 @@
         if ((data.length == 0) || (data[0] != 4)) {
             throw new IOException("Only uncompressed point format supported");
         }
-        int n = data.length / 2;
-        if (n > ((curve.getField().getFieldSize() + 7 ) >> 3)) {
+        // Per ANSI X9.62, an encoded point is a 1 byte type followed by
+        // ceiling(log base 2 field-size / 8) bytes of x and the same of y.
+        int n = (data.length - 1) / 2;
+        if (n != ((curve.getField().getFieldSize() + 7 ) >> 3)) {
             throw new IOException("Point does not match field size");
         }
         byte[] xb = new byte[n];
--- a/src/share/classes/sun/security/provider/certpath/AlgorithmChecker.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/provider/certpath/AlgorithmChecker.java	Fri Sep 28 10:54:12 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2012, 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
@@ -259,8 +259,7 @@
             }
 
             // Inherit key parameters from previous key
-            if (currPubKey instanceof DSAPublicKey &&
-                ((DSAPublicKey)currPubKey).getParams() == null) {
+            if (PKIX.isDSAPublicKeyWithoutParams(currPubKey)) {
                 // Inherit DSA parameters from previous key
                 if (!(prevPubKey instanceof DSAPublicKey)) {
                     throw new CertPathValidatorException("Input key is not " +
--- a/src/share/classes/sun/security/provider/certpath/BasicChecker.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/provider/certpath/BasicChecker.java	Fri Sep 28 10:54:12 2012 -0700
@@ -101,9 +101,7 @@
     public void init(boolean forward) throws CertPathValidatorException {
         if (!forward) {
             prevPubKey = trustedPubKey;
-            if (prevPubKey instanceof DSAPublicKey &&
-                ((DSAPublicKey)prevPubKey).getParams() == null)
-            {
+            if (PKIX.isDSAPublicKeyWithoutParams(prevPubKey)) {
                 // If TrustAnchor is a DSA public key and it has no params, it
                 // cannot be used to verify the signature of the first cert,
                 // so throw exception
@@ -248,8 +246,7 @@
                 currCert.getSubjectX500Principal() + "; serial#: " +
                 currCert.getSerialNumber().toString());
         }
-        if (cKey instanceof DSAPublicKey &&
-            ((DSAPublicKey)cKey).getParams() == null) {
+        if (PKIX.isDSAPublicKeyWithoutParams(cKey)) {
             // cKey needs to inherit DSA parameters from prev key
             cKey = makeInheritedParamsKey(cKey, prevPubKey);
             if (debug != null) debug.println("BasicChecker.updateState Made " +
--- a/src/share/classes/sun/security/provider/certpath/CertStoreHelper.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/provider/certpath/CertStoreHelper.java	Fri Sep 28 10:54:12 2012 -0700
@@ -35,6 +35,7 @@
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.security.cert.CertStore;
+import java.security.cert.CertStoreException;
 import java.security.cert.X509CertSelector;
 import java.security.cert.X509CRLSelector;
 import javax.security.auth.x500.X500Principal;
@@ -96,6 +97,25 @@
         }
     }
 
+    static boolean isCausedByNetworkIssue(String type, CertStoreException cse) {
+        switch (type) {
+            case "LDAP":
+            case "SSLServer":
+                try {
+                    CertStoreHelper csh = CertStoreHelper.getInstance(type);
+                    return csh.isCausedByNetworkIssue(cse);
+                } catch (NoSuchAlgorithmException nsae) {
+                    return false;
+                }
+            case "URI":
+                Throwable t = cse.getCause();
+                return (t != null && t instanceof IOException);
+            default:
+                // we don't know about any other remote CertStore types
+                return false;
+        }
+    }
+
     /**
      * Returns a CertStore using the given URI as parameters.
      */
@@ -119,4 +139,10 @@
                          Collection<X500Principal> certIssuers,
                          String dn)
         throws IOException;
+
+    /**
+     * Returns true if the cause of the CertStoreException is a network
+     * related issue.
+     */
+    public abstract boolean isCausedByNetworkIssue(CertStoreException e);
 }
--- a/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Fri Sep 28 10:54:12 2012 -0700
@@ -116,12 +116,17 @@
     /**
      * Download CRLs from the given distribution point, verify and return them.
      * See the top of the class for current limitations.
+     *
+     * @throws CertStoreException if there is an error retrieving the CRLs
+     *         from one of the GeneralNames and no other CRLs are retrieved from
+     *         the other GeneralNames. If more than one GeneralName throws an
+     *         exception then the one from the last GeneralName is thrown.
      */
     private static Collection<X509CRL> getCRLs(X509CRLSelector selector,
         X509CertImpl certImpl, DistributionPoint point, boolean[] reasonsMask,
         boolean signFlag, PublicKey prevKey, String provider,
         List<CertStore> certStores, Set<TrustAnchor> trustAnchors,
-        Date validity) {
+        Date validity) throws CertStoreException {
 
         // check for full name
         GeneralNames fullName = point.getFullName();
@@ -149,24 +154,33 @@
                 return Collections.emptySet();
             }
         }
-        Collection<X509CRL> possibleCRLs = new ArrayList<X509CRL>();
-        Collection<X509CRL> crls = new ArrayList<X509CRL>(2);
+        Collection<X509CRL> possibleCRLs = new ArrayList<>();
+        CertStoreException savedCSE = null;
         for (Iterator<GeneralName> t = fullName.iterator(); t.hasNext(); ) {
-            GeneralName name = t.next();
-            if (name.getType() == GeneralNameInterface.NAME_DIRECTORY) {
-                X500Name x500Name = (X500Name) name.getName();
-                possibleCRLs.addAll(
-                    getCRLs(x500Name, certImpl.getIssuerX500Principal(),
-                            certStores));
-            } else if (name.getType() == GeneralNameInterface.NAME_URI) {
-                URIName uriName = (URIName)name.getName();
-                X509CRL crl = getCRL(uriName);
-                if (crl != null) {
-                    possibleCRLs.add(crl);
+            try {
+                GeneralName name = t.next();
+                if (name.getType() == GeneralNameInterface.NAME_DIRECTORY) {
+                    X500Name x500Name = (X500Name) name.getName();
+                    possibleCRLs.addAll(
+                        getCRLs(x500Name, certImpl.getIssuerX500Principal(),
+                                certStores));
+                } else if (name.getType() == GeneralNameInterface.NAME_URI) {
+                    URIName uriName = (URIName)name.getName();
+                    X509CRL crl = getCRL(uriName);
+                    if (crl != null) {
+                        possibleCRLs.add(crl);
+                    }
                 }
+            } catch (CertStoreException cse) {
+                savedCSE = cse;
             }
         }
+        // only throw CertStoreException if no CRLs are retrieved
+        if (possibleCRLs.isEmpty() && savedCSE != null) {
+            throw savedCSE;
+        }
 
+        Collection<X509CRL> crls = new ArrayList<>(2);
         for (X509CRL crl : possibleCRLs) {
             try {
                 // make sure issuer is not set
@@ -191,34 +205,43 @@
     /**
      * Download CRL from given URI.
      */
-    private static X509CRL getCRL(URIName name) {
+    private static X509CRL getCRL(URIName name) throws CertStoreException {
         URI uri = name.getURI();
         if (debug != null) {
             debug.println("Trying to fetch CRL from DP " + uri);
         }
+        CertStore ucs = null;
         try {
-            CertStore ucs = URICertStore.getInstance
+            ucs = URICertStore.getInstance
                 (new URICertStore.URICertStoreParameters(uri));
-            Collection<? extends CRL> crls = ucs.getCRLs(null);
-            if (crls.isEmpty()) {
-                return null;
-            } else {
-                return (X509CRL) crls.iterator().next();
+        } catch (InvalidAlgorithmParameterException |
+                 NoSuchAlgorithmException e) {
+            if (debug != null) {
+                debug.println("Can't create URICertStore: " + e.getMessage());
             }
-        } catch (Exception e) {
-            if (debug != null) {
-                debug.println("Exception getting CRL from CertStore: " + e);
-                e.printStackTrace();
-            }
+            return null;
         }
-        return null;
+
+        Collection<? extends CRL> crls = ucs.getCRLs(null);
+        if (crls.isEmpty()) {
+            return null;
+        } else {
+            return (X509CRL) crls.iterator().next();
+        }
     }
 
     /**
      * Fetch CRLs from certStores.
+     *
+     * @throws CertStoreException if there is an error retrieving the CRLs from
+     *         one of the CertStores and no other CRLs are retrieved from
+     *         the other CertStores. If more than one CertStore throws an
+     *         exception then the one from the last CertStore is thrown.
      */
     private static Collection<X509CRL> getCRLs(X500Name name,
-        X500Principal certIssuer, List<CertStore> certStores)
+                                               X500Principal certIssuer,
+                                               List<CertStore> certStores)
+        throws CertStoreException
     {
         if (debug != null) {
             debug.println("Trying to fetch CRL from DP " + name);
@@ -227,21 +250,27 @@
         xcs.addIssuer(name.asX500Principal());
         xcs.addIssuer(certIssuer);
         Collection<X509CRL> crls = new ArrayList<>();
+        CertStoreException savedCSE = null;
         for (CertStore store : certStores) {
             try {
                 for (CRL crl : store.getCRLs(xcs)) {
                     crls.add((X509CRL)crl);
                 }
             } catch (CertStoreException cse) {
-                // don't add the CRL
                 if (debug != null) {
-                    debug.println("Non-fatal exception while retrieving " +
+                    debug.println("Exception while retrieving " +
                         "CRLs: " + cse);
                     cse.printStackTrace();
                 }
+                savedCSE = new PKIX.CertStoreTypeException(store.getType(),cse);
             }
         }
-        return crls;
+        // only throw CertStoreException if no CRLs are retrieved
+        if (crls.isEmpty() && savedCSE != null) {
+            throw savedCSE;
+        } else {
+            return crls;
+        }
     }
 
     /**
--- a/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Fri Sep 28 10:54:12 2012 -0700
@@ -369,20 +369,21 @@
         boolean add = false;
         for (AccessDescription ad : adList) {
             CertStore cs = URICertStore.getInstance(ad);
-            try {
-                if (certs.addAll((Collection<X509Certificate>)
-                    cs.getCertificates(caSelector))) {
-                    add = true;
-                    if (!searchAllCertStores) {
-                        return true;
+            if (cs != null) {
+                try {
+                    if (certs.addAll((Collection<X509Certificate>)
+                        cs.getCertificates(caSelector))) {
+                        add = true;
+                        if (!searchAllCertStores) {
+                            return true;
+                        }
+                    }
+                } catch (CertStoreException cse) {
+                    if (debug != null) {
+                        debug.println("exception getting certs from CertStore:");
+                        cse.printStackTrace();
                     }
                 }
-            } catch (CertStoreException cse) {
-                if (debug != null) {
-                    debug.println("exception getting certs from CertStore:");
-                    cse.printStackTrace();
-                }
-                continue;
             }
         }
         return add;
@@ -816,36 +817,36 @@
                 } else {
                     continue;
                 }
-            } else {
-                X500Principal principal = anchor.getCA();
-                PublicKey publicKey = anchor.getCAPublicKey();
+            }
+            X500Principal principal = anchor.getCA();
+            PublicKey publicKey = anchor.getCAPublicKey();
 
-                if (principal != null && publicKey != null &&
-                        principal.equals(cert.getSubjectX500Principal())) {
-                    if (publicKey.equals(cert.getPublicKey())) {
-                        // the cert itself is a trust anchor
-                        this.trustAnchor = anchor;
-                        return true;
-                    }
-                    // else, it is a self-issued certificate of the anchor
+            if (principal != null && publicKey != null &&
+                    principal.equals(cert.getSubjectX500Principal())) {
+                if (publicKey.equals(cert.getPublicKey())) {
+                    // the cert itself is a trust anchor
+                    this.trustAnchor = anchor;
+                    return true;
                 }
+                // else, it is a self-issued certificate of the anchor
+            }
 
-                // Check subject/issuer name chaining
-                if (principal == null ||
-                        !principal.equals(cert.getIssuerX500Principal())) {
-                    continue;
-                }
+            // Check subject/issuer name chaining
+            if (principal == null ||
+                    !principal.equals(cert.getIssuerX500Principal())) {
+                continue;
+            }
+
+            // skip anchor if it contains a DSA key with no DSA params
+            if (PKIX.isDSAPublicKeyWithoutParams(publicKey)) {
+                continue;
             }
 
             /*
              * Check signature
              */
             try {
-                // NOTE: the DSA public key in the buildParams may lack
-                // parameters, yet there is no key to inherit the parameters
-                // from.  This is probably such a rare case that it is not worth
-                // trying to detect the situation earlier.
-                cert.verify(anchor.getCAPublicKey(), buildParams.sigProvider());
+                cert.verify(publicKey, buildParams.sigProvider());
             } catch (InvalidKeyException ike) {
                 if (debug != null) {
                     debug.println("ForwardBuilder.isPathCompleted() invalid "
--- a/src/share/classes/sun/security/provider/certpath/ForwardState.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/provider/certpath/ForwardState.java	Fri Sep 28 10:54:12 2012 -0700
@@ -26,12 +26,10 @@
 package sun.security.provider.certpath;
 
 import java.io.IOException;
-import java.security.PublicKey;
 import java.security.cert.CertificateException;
 import java.security.cert.CertPathValidatorException;
 import java.security.cert.PKIXCertPathChecker;
 import java.security.cert.X509Certificate;
-import java.security.interfaces.DSAPublicKey;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -169,9 +167,7 @@
         X509CertImpl icert = X509CertImpl.toImpl(cert);
 
         /* see if certificate key has null parameters */
-        PublicKey newKey = icert.getPublicKey();
-        if (newKey instanceof DSAPublicKey &&
-            ((DSAPublicKey)newKey).getParams() == null) {
+        if (PKIX.isDSAPublicKeyWithoutParams(icert.getPublicKey())) {
             keyParamsNeededFlag = true;
         }
 
--- a/src/share/classes/sun/security/provider/certpath/OCSP.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/provider/certpath/OCSP.java	Fri Sep 28 10:54:12 2012 -0700
@@ -335,8 +335,8 @@
     static class NetworkFailureException extends CertPathValidatorException {
         private static final long serialVersionUID = 0l;
 
-        private NetworkFailureException(IOException ioe) {
-            super(ioe);
+        NetworkFailureException(Throwable t) {
+            super(t);
         }
 
         @Override
--- a/src/share/classes/sun/security/provider/certpath/PKIX.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/provider/certpath/PKIX.java	Fri Sep 28 10:54:12 2012 -0700
@@ -26,7 +26,9 @@
 
 import java.security.InvalidAlgorithmParameterException;
 import java.security.KeyStore;
+import java.security.PublicKey;
 import java.security.cert.*;
+import java.security.interfaces.DSAPublicKey;
 import java.util.*;
 import javax.security.auth.x500.X500Principal;
 
@@ -42,6 +44,11 @@
 
     private PKIX() { }
 
+    static boolean isDSAPublicKeyWithoutParams(PublicKey publicKey) {
+        return (publicKey instanceof DSAPublicKey &&
+               ((DSAPublicKey)publicKey).getParams() == null);
+    }
+
     static ValidatorParams checkParams(CertPath cp, CertPathParameters params)
         throws InvalidAlgorithmParameterException
     {
@@ -271,6 +278,24 @@
     }
 
     /**
+     * A CertStoreException with additional information about the type of
+     * CertStore that generated the exception.
+     */
+    static class CertStoreTypeException extends CertStoreException {
+        private static final long serialVersionUID = 7463352639238322556L;
+
+        private final String type;
+
+        CertStoreTypeException(String type, CertStoreException cse) {
+            super(cse.getMessage(), cse.getCause());
+            this.type = type;
+        }
+        String getType() {
+            return type;
+        }
+    }
+
+    /**
      * Comparator that orders CertStores so that local CertStores come before
      * remote CertStores.
      */
--- a/src/share/classes/sun/security/provider/certpath/ReverseState.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/provider/certpath/ReverseState.java	Fri Sep 28 10:54:12 2012 -0700
@@ -32,7 +32,6 @@
 import java.security.cert.PKIXCertPathChecker;
 import java.security.cert.TrustAnchor;
 import java.security.cert.X509Certificate;
-import java.security.interfaces.DSAPublicKey;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -287,8 +286,7 @@
         /* check for key needing to inherit alg parameters */
         X509CertImpl icert = X509CertImpl.toImpl(cert);
         PublicKey newKey = cert.getPublicKey();
-        if (newKey instanceof DSAPublicKey &&
-            (((DSAPublicKey)newKey).getParams() == null)) {
+        if (PKIX.isDSAPublicKeyWithoutParams(newKey)) {
             newKey = BasicChecker.makeInheritedParamsKey(newKey, pubKey);
         }
 
--- a/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Fri Sep 28 14:54:04 2012 +0400
+++ b/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Fri Sep 28 10:54:12 2012 -0700
@@ -38,7 +38,6 @@
 import java.security.cert.CertPathValidatorException.BasicReason;
 import java.security.cert.Extension;
 import java.security.cert.*;
-import java.security.interfaces.DSAPublicKey;
 import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -50,7 +49,7 @@
 import javax.security.auth.x500.X500Principal;
 
 import static sun.security.provider.certpath.OCSP.*;
-import sun.security.provider.certpath.PKIX.ValidatorParams;
+import static sun.security.provider.certpath.PKIX.*;
 import sun.security.action.GetPropertyAction;
 import sun.security.x509.*;
 import static sun.security.x509.PKIXExtensions.*;
@@ -406,8 +405,7 @@
 
         // Make new public key if parameters are missing
         PublicKey pubKey = cert.getPublicKey();
-        if (pubKey instanceof DSAPublicKey &&
-            ((DSAPublicKey)pubKey).getParams() == null) {
+        if (PKIX.isDSAPublicKeyWithoutParams(pubKey)) {
             // pubKey needs to inherit DSA parameters from prev key
             pubKey = BasicChecker.makeInheritedParamsKey(pubKey, prevPubKey);
         }
@@ -458,14 +456,23 @@
         sel.setCertificateChecking(cert);
         CertPathHelper.setDateAndTime(sel, params.date(), MAX_CLOCK_SKEW);
 
-        // First, check cached CRLs
+        // First, check user-specified CertStores
+        NetworkFailureException nfe = null;
         for (CertStore store : certStores) {
             try {
                 for (CRL crl : store.getCRLs(sel)) {
                     possibleCRLs.add((X509CRL)crl);
                 }
             } catch (CertStoreException e) {
-                // XXX ignore?
+                if (debug != null) {
+                    debug.println("RevocationChecker.checkCRLs() " +
+                                  "CertStoreException: " + e.getMessage());
+                }
+                if (softFail && nfe == null &&
+                    CertStoreHelper.isCausedByNetworkIssue(store.getType(),e)) {
+                    // save this exception, we may need to throw it later
+                    nfe = new NetworkFailureException(e);
+                }
             }
         }
 
@@ -504,9 +511,12 @@
                                         reasonsMask, anchors, params.date()));
                 }
             } catch (CertStoreException e) {