changeset 9231:7d5029885187

8033236: Update GensrcCharsetMapping.gmk to build-infra standards Reviewed-by: erikj, mduigou, sherman
author ihse
date Tue, 04 Feb 2014 10:00:24 +0100
parents 078211e37e20
children ef21413d240a
files make/GenerateSources.gmk make/Tools.gmk make/data/charsetmapping/standard-charsets make/gensrc/GensrcCharsetMapping.gmk make/scripts/genCharsetProvider.sh make/src/classes/build/tools/hasher/Hasher.java src/share/classes/sun/nio/cs/StandardCharsets.java.template src/share/classes/sun/nio/cs/standard-charsets
diffstat 8 files changed, 523 insertions(+), 540 deletions(-) [+]
line wrap: on
line diff
--- a/make/GenerateSources.gmk	Mon Feb 03 22:26:26 2014 -0800
+++ b/make/GenerateSources.gmk	Tue Feb 04 10:00:24 2014 +0100
@@ -29,6 +29,7 @@
 include MakeBase.gmk
 include JavaCompilation.gmk
 include NativeCompilation.gmk
+include TextFileProcessing.gmk
 
 # Setup the java compilers for the JDK build.
 include Setup.gmk
--- a/make/Tools.gmk	Mon Feb 03 22:26:26 2014 -0800
+++ b/make/Tools.gmk	Tue Feb 04 10:00:24 2014 +0100
@@ -102,7 +102,7 @@
 
 # TODO: Lots of files in jdk/make/tools/CharsetMapping dir
 TOOL_CHARSETMAPPING = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
-    build.tools.charsetmapping.Main
+    build.tools.charsetmapping.Main $(LOG_INFO)
 
 TOOL_SPP = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/data/charsetmapping/standard-charsets	Tue Feb 04 10:00:24 2014 +0100
@@ -0,0 +1,337 @@
+#
+# Copyright (c) 2000, 2014, 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.
+#
+
+# Standard charsets provided by StandardCharsets provider.
+#
+# Note that these "standard" charsets listed here are not
+# necessary to be the "Standard charsets" defined in the
+# specification of java.nio.charset.Charset. Instead these
+# are the charsets that this implementation believes should
+# be packaged into the charsets provider class "StandardCharsets"
+# which is initialized at startup time by java.nio.charset.Charset,
+# compared to the charsets packaged in "ExtendedCharsets" provider,
+# which is lazy initialized.
+
+charset US-ASCII US_ASCII
+
+    # IANA aliases
+    alias iso-ir-6
+    alias ANSI_X3.4-1986
+    alias ISO_646.irv:1991
+    alias ASCII
+    alias ISO646-US
+    alias us
+    alias IBM367
+    alias cp367
+    alias csASCII
+    alias default
+
+    # Other aliases
+    alias 646				# Solaris POSIX locale
+    alias iso_646.irv:1983
+    alias ANSI_X3.4-1968		# Linux POSIX locale (RedHat)
+    alias ascii7
+
+charset UTF-8 UTF_8
+    alias UTF8				# JDK historical
+    alias unicode-1-1-utf-8
+
+charset CESU-8 CESU_8
+    alias CESU8
+    alias csCESU-8
+
+charset UTF-16 UTF_16
+    alias UTF_16			# JDK historical
+    alias utf16
+    alias unicode
+    alias UnicodeBig
+
+charset UTF-16BE UTF_16BE
+    alias UTF_16BE
+    alias ISO-10646-UCS-2
+    alias X-UTF-16BE
+    alias UnicodeBigUnmarked
+
+charset UTF-16LE UTF_16LE
+    alias UTF_16LE
+    alias X-UTF-16LE
+    alias UnicodeLittleUnmarked
+
+charset x-UTF-16LE-BOM UTF_16LE_BOM
+    alias UnicodeLittle
+
+charset UTF-32 UTF_32
+    alias UTF_32
+    alias UTF32
+
+charset UTF-32LE UTF_32LE
+    alias UTF_32LE
+    alias X-UTF-32LE
+
+charset UTF-32BE UTF_32BE
+    alias UTF_32BE
+    alias X-UTF-32BE
+
+charset X-UTF-32LE-BOM UTF_32LE_BOM
+    alias UTF_32LE_BOM
+    alias UTF-32LE-BOM
+
+charset X-UTF-32BE-BOM UTF_32BE_BOM
+    alias UTF_32BE_BOM
+    alias UTF-32BE-BOM
+
+charset ISO-8859-1 ISO_8859_1
+
+    # IANA aliases
+    alias iso-ir-100
+    alias ISO_8859-1
+    alias latin1
+    alias l1
+    alias IBM819
+    alias cp819
+    alias csISOLatin1
+
+    # Other aliases
+    alias 819
+    alias IBM-819
+    alias ISO8859_1
+    alias ISO_8859-1:1987
+    alias ISO_8859_1
+    alias 8859_1
+    alias ISO8859-1
+
+charset ISO-8859-2 ISO_8859_2
+    alias iso8859_2			# JDK historical
+    alias 8859_2
+    alias iso-ir-101
+    alias ISO_8859-2
+    alias ISO_8859-2:1987
+    alias ISO8859-2
+    alias latin2
+    alias l2
+    alias ibm912
+    alias ibm-912
+    alias cp912
+    alias 912
+    alias csISOLatin2
+
+charset ISO-8859-4 ISO_8859_4
+    alias iso8859_4			# JDK historical
+    alias iso8859-4
+    alias 8859_4
+    alias iso-ir-110
+    alias ISO_8859-4
+    alias ISO_8859-4:1988
+    alias latin4
+    alias l4
+    alias ibm914
+    alias ibm-914
+    alias cp914
+    alias 914
+    alias csISOLatin4
+
+charset ISO-8859-5 ISO_8859_5
+    alias iso8859_5			# JDK historical
+    alias 8859_5
+    alias iso-ir-144
+    alias ISO_8859-5
+    alias ISO_8859-5:1988
+    alias ISO8859-5
+    alias cyrillic
+    alias ibm915
+    alias ibm-915
+    alias cp915
+    alias 915
+    alias csISOLatinCyrillic
+
+charset ISO-8859-7 ISO_8859_7
+    alias iso8859_7			# JDK historical
+    alias 8859_7
+    alias iso-ir-126
+    alias ISO_8859-7
+    alias ISO_8859-7:1987
+    alias ELOT_928
+    alias ECMA-118
+    alias greek
+    alias greek8
+    alias csISOLatinGreek
+    alias sun_eu_greek			# Solaris 7/8 compatibility
+    alias ibm813
+    alias ibm-813
+    alias 813
+    alias cp813
+    alias iso8859-7			# Solaris 9 compatibility
+
+charset ISO-8859-9 ISO_8859_9
+    alias iso8859_9			# JDK historical
+    alias 8859_9
+    alias iso-ir-148
+    alias ISO_8859-9
+    alias ISO_8859-9:1989
+    alias ISO8859-9
+    alias latin5
+    alias l5
+    alias ibm920
+    alias ibm-920
+    alias 920
+    alias cp920
+    alias csISOLatin5
+
+charset ISO-8859-13 ISO_8859_13
+    alias iso8859_13			# JDK historical
+    alias 8859_13
+    alias iso_8859-13
+    alias ISO8859-13
+
+charset ISO-8859-15 ISO_8859_15
+
+    # IANA alias
+    alias ISO_8859-15
+
+    # Other aliases
+    alias 8859_15
+    alias ISO-8859-15
+    alias ISO8859_15
+    alias ISO8859-15
+    alias IBM923
+    alias IBM-923
+    alias cp923
+    alias 923
+    alias LATIN0
+    alias LATIN9
+    alias L9
+    alias csISOlatin0
+    alias csISOlatin9
+    alias ISO8859_15_FDIS
+
+charset KOI8-R KOI8_R
+    alias koi8_r			# JDK historical
+    alias koi8
+    alias cskoi8r
+
+charset KOI8-U KOI8_U
+    alias koi8_u
+
+charset windows-1250 MS1250
+    alias cp1250			# JDK historical
+    alias cp5346			# Euro IBM CCSID
+
+charset windows-1251 MS1251
+    alias cp1251			# JDK historical
+    alias cp5347			# Euro IBM CCSID
+    alias ansi-1251			# Solaris compatibility
+
+charset windows-1252 MS1252
+    alias cp1252			# JDK historical
+    alias cp5348			# Euro IBM CCSID
+
+charset windows-1253 MS1253
+    alias cp1253			# JDK historical
+    alias cp5349			# Euro IBM CCSID
+
+charset windows-1254 MS1254
+    alias cp1254			# JDK historical
+    alias cp5350			# Euro IBM CCSID
+
+charset windows-1257 MS1257
+    alias cp1257			# JDK historical
+    alias cp5353			# Euro IBM CCSID
+
+
+charset IBM437 IBM437
+    alias cp437                         #JDK historical
+    alias ibm437
+    alias ibm-437
+    alias 437
+    alias cspc8codepage437
+    alias windows-437
+
+charset x-IBM737 IBM737
+    alias cp737                         #JDK historical
+    alias ibm737
+    alias ibm-737
+    alias 737
+
+charset IBM775 IBM775
+    alias cp775                         #JDK historical
+    alias ibm775
+    alias ibm-775
+    alias 775
+
+charset IBM850 IBM850
+    alias cp850                         #JDK historical
+    alias ibm-850
+    alias ibm850
+    alias 850
+    alias cspc850multilingual
+
+charset IBM852 IBM852
+    alias cp852                         #JDK historical
+    alias ibm852
+    alias ibm-852
+    alias 852
+    alias csPCp852
+
+charset IBM855 IBM855
+    alias cp855                         #JDK historical
+    alias ibm-855
+    alias ibm855
+    alias 855
+    alias cspcp855
+
+charset IBM857 IBM857
+    alias cp857                         #JDK historical
+    alias ibm857
+    alias ibm-857
+    alias 857
+    alias csIBM857
+
+charset IBM00858 IBM858
+    alias cp858                         #JDK historical
+    alias ccsid00858
+    alias cp00858
+    alias 858
+    alias PC-Multilingual-850+euro
+
+charset IBM862 IBM862
+    alias cp862                         #JDK historical
+    alias ibm862
+    alias ibm-862
+    alias 862
+    alias csIBM862
+    alias cspc862latinhebrew
+
+charset IBM866 IBM866
+    alias cp866                         #JDK historical
+    alias ibm866
+    alias ibm-866
+    alias 866
+    alias csIBM866
+
+charset x-IBM874 IBM874
+    alias cp874                         #JDK historical
+    alias ibm874
+    alias ibm-874
+    alias 874
--- a/make/gensrc/GensrcCharsetMapping.gmk	Mon Feb 03 22:26:26 2014 -0800
+++ b/make/gensrc/GensrcCharsetMapping.gmk	Tue Feb 04 10:00:24 2014 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,80 +25,151 @@
 
 GENSRC_CHARSETMAPPING :=
 
-GENSRC_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_DST := $(JDK_OUTPUTDIR)/gensrc/sun/nio/cs
-
-GENSRC_DATA := $(JDK_TOPDIR)/make/data/charsetmapping
-GENSRC_JAVA_SRC := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
-
-GENSRC_TEMPLATES := $(GENSRC_DATA)/SingleByte-X.java.template $(GENSRC_DATA)/DoubleByte-X.java.template
+CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
 
 ###
+### Generate files using the charsetmapping tool
+###
 
-$(GENSRC_TMP)/_the.charsetmapping.dir:
-	$(ECHO) Generating charsetmapping classes
-	$(MKDIR) -p $(GENSRC_DST)/ext
-	$(TOUCH) $@
+CHARSET_GENSRC_JAVA_DIR := $(JDK_OUTPUTDIR)/gensrc/sun/nio/cs
+CHARSET_DONE := $(CHARSET_GENSRC_JAVA_DIR)/_the.charsetmapping
+CHARSET_COPYRIGHT_HEADER_BASE := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
+CHARSET_TEMPLATES := \
+    $(CHARSET_DATA_DIR)/SingleByte-X.java.template \
+    $(CHARSET_DATA_DIR)/DoubleByte-X.java.template
+
+# This target should be referenced using the order-only operator (|)
+$(CHARSET_GENSRC_JAVA_DIR)/ext:
+	$(ECHO)	"Generating charset mappings"
+	$(MKDIR) -p $(CHARSET_GENSRC_JAVA_DIR)/ext
+
+$(CHARSET_DONE)-sbcs: $(CHARSET_DATA_DIR)/sbcs \
+    $(CHARSET_TEMPLATES) $(BUILD_TOOLS) | $(CHARSET_GENSRC_JAVA_DIR)/ext
+	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR) sbcs
+	$(TOUCH) '$@'
+
+$(CHARSET_DONE)-extsbcs: $(CHARSET_DATA_DIR)/extsbcs  \
+    $(CHARSET_DONE)-sbcs $(CHARSET_TEMPLATES) $(BUILD_TOOLS) 
+	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR)/ext extsbcs
+	$(TOUCH) '$@'
+
+$(CHARSET_DONE)-dbcs: $(CHARSET_DATA_DIR)/dbcs \
+    $(CHARSET_DONE)-sbcs $(CHARSET_TEMPLATES) $(BUILD_TOOLS) 
+	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR)/ext dbcs
+	$(TOUCH) '$@'
+
+$(CHARSET_DONE)-hkscs: $(CHARSET_COPYRIGHT_HEADER_BASE)/HKSCS.java \
+    $(CHARSET_DONE)-sbcs $(BUILD_TOOLS)
+	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR)/ext hkscs '$<'
+	$(TOUCH) '$@'
+
+$(CHARSET_DONE)-euctw: $(CHARSET_COPYRIGHT_HEADER_BASE)/EUC_TW.java \
+    $(CHARSET_DONE)-sbcs $(BUILD_TOOLS)
+	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR)/ext euctw '$<'
+	$(TOUCH) '$@'
+
+$(CHARSET_GENSRC_JAVA_DIR)/ext/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \
+    $(CHARSET_DONE)-sbcs $(BUILD_TOOLS)
+	$(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
+
+GENSRC_CHARSETMAPPING += \
+    $(CHARSET_DONE)-sbcs \
+    $(CHARSET_DONE)-extsbcs \
+    $(CHARSET_DONE)-dbcs \
+    $(CHARSET_DONE)-hkscs \
+    $(CHARSET_DONE)-euctw \
+    $(CHARSET_GENSRC_JAVA_DIR)/ext/sjis0213.dat \
+    #
 
 ###
-
-GENSRC_SB := $(GENSRC_TMP)/_the.charsetmapping.sbcs
-
-$(GENSRC_SB): $(GENSRC_DATA)/sbcs $(GENSRC_TEMPLATES) $(GENSRC_TMP)/_the.charsetmapping.dir
-	$(TOOL_CHARSETMAPPING) $(LOG_INFO) $(GENSRC_DATA) $(GENSRC_DST) sbcs
-	$(TOUCH) $@
-
-GENSRC_CHARSETMAPPING += $(GENSRC_SB)
-
+### Generate the sun/nio/cs/StandardCharsets.java file
 ###
 
-$(GENSRC_DST)/ext/sjis0213.dat: $(GENSRC_DATA)/sjis0213.map $(GENSRC_SB)
-	$(TOOL_CHARSETMAPPING) $(LOG_INFO) $< $@ sjis0213
+CHARSET_STANDARD_GENSRC_DIR := $(JDK_OUTPUTDIR)/gensrc/standardcharsets
+CHARSET_STANDARD_DATA := $(CHARSET_DATA_DIR)/standard-charsets
+CHARSET_STANDARD_JAVA :=  sun/nio/cs/StandardCharsets.java
 
-GENSRC_CHARSETMAPPING += $(GENSRC_DST)/ext/sjis0213.dat
+CHARSET_ALIASES_TABLES_AWK := ' \
+    BEGIN { n = 1; m = 1; } \
+    /^[ \t]*charset / { \
+      csn = $$2; cln = $$3; \
+      lcsn = tolower(csn); \
+      lcsns[n++] = lcsn; \
+      csns[lcsn] = csn; \
+      classMap[lcsn] = cln; \
+      if (n > 2) \
+        printf "    };\n\n"; \
+      printf "    static final String[] aliases_%s = new String[] {\n", cln; \
+    } \
+    /^[ \t]*alias / { \
+      acsns[m++] = tolower($$2); \
+      aliasMap[tolower($$2)] = lcsn; \
+      printf "        \"%s\",\n", $$2; \
+    } \
+    END { \
+      printf "    };\n\n"; \
+    } '
 
-###
+CHARSET_ALIASES_MAP_AWK := ' \
+    /^[ \t]*charset / { \
+      csn = $$2; \
+      lcsn = tolower(csn); \
+    } \
+    /^[ \t]*alias / { \
+      an = tolower($$2); \
+      printf "%-20s \"%s\"\n", an, lcsn; \
+    } '
 
-$(GENSRC_DST)/ext/EUC_TWMapping.java: $(GENSRC_JAVA_SRC)/EUC_TW.java $(GENSRC_SB)
-	$(TOOL_CHARSETMAPPING) $(LOG_INFO) $(GENSRC_DATA) $(GENSRC_DST)/ext euctw $(GENSRC_JAVA_SRC)/EUC_TW.java
+CHARSET_CLASSES_MAP_AWK := ' \
+    /^[ \t]*charset / { \
+      csn = $$2; cln = $$3; \
+      lcsn = tolower(csn); \
+      printf "%-20s \"%s\"\n", lcsn, cln; \
+    } '
 
-GENSRC_CHARSETMAPPING += $(GENSRC_DST)/ext/EUC_TWMapping.java
+# This target should be referenced using the order-only operator (|)
+$(CHARSET_STANDARD_GENSRC_DIR):
+	$(MKDIR) -p '$@'
 
-###
+$(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet: $(CHARSET_STANDARD_DATA) \
+    | $(CHARSET_STANDARD_GENSRC_DIR)
+	$(NAWK) < '$<' > '$@' $(CHARSET_ALIASES_TABLES_AWK)
 
-$(GENSRC_DST)/ext/HKSCSMapping.java: $(GENSRC_JAVA_SRC)/HKSCS.java $(GENSRC_SB)
-	$(TOOL_CHARSETMAPPING) $(LOG_INFO) $(GENSRC_DATA) $(GENSRC_DST)/ext hkscs $(GENSRC_JAVA_SRC)/HKSCS.java
+$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map: $(CHARSET_STANDARD_DATA) \
+    | $(CHARSET_STANDARD_GENSRC_DIR)
+	$(NAWK) < '$<' > '$@' $(CHARSET_ALIASES_MAP_AWK)
 
-GENSRC_CHARSETMAPPING += $(GENSRC_DST)/ext/HKSCSMapping.java
+$(CHARSET_STANDARD_GENSRC_DIR)/classes-map: $(CHARSET_STANDARD_DATA) \
+    | $(CHARSET_STANDARD_GENSRC_DIR)
+	$(NAWK) < '$<' > '$@' $(CHARSET_CLASSES_MAP_AWK)
 
-###
+$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map \
+    $(BUILD_TOOLS) | $(CHARSET_STANDARD_GENSRC_DIR)
+	$(TOOL_HASHER) -i Aliases < '$<' > '$@'
 
-$(GENSRC_TMP)/gensrc_the.charsetmapping.extsbcs: $(GENSRC_DATA)/extsbcs $(GENSRC_TEMPLATES) $(GENSRC_SB)
-	$(TOOL_CHARSETMAPPING) $(GENSRC_DATA) $(LOG_INFO) $(GENSRC_DST)/ext extsbcs
-	$(TOUCH) $@
+$(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/classes-map \
+    $(BUILD_TOOLS) | $(CHARSET_STANDARD_GENSRC_DIR)
+	$(TOOL_HASHER) -i Classes < '$<' > '$@'
 
-GENSRC_CHARSETMAPPING += $(GENSRC_TMP)/gensrc_the.charsetmapping.extsbcs
+$(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/classes-map \
+    $(BUILD_TOOLS) | $(CHARSET_STANDARD_GENSRC_DIR)
+	$(TOOL_HASHER) -i -e Cache -t Charset < '$<' > '$@'
 
-###
+$(eval $(call SetupTextFileProcessing, BUILD_CHARSET_STANDARD, \
+    SOURCE_FILES := $(JDK_TOPDIR)/src/share/classes/$(CHARSET_STANDARD_JAVA).template, \
+    OUTPUT_FILE := $(JDK_OUTPUTDIR)/gensrc/$(CHARSET_STANDARD_JAVA), \
+    INCLUDES := \
+        _INCLUDE_ALIASES_TABLES_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet ; \
+        _INCLUDE_ALIASES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet ; \
+        _INCLUDE_CLASSES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet ; \
+        _INCLUDE_CACHE_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet ; , \
+))
 
-$(GENSRC_TMP)/gensrc_the.charsetmapping.dbcs: $(GENSRC_DATA)/dbcs $(GENSRC_TEMPLATES) $(GENSRC_SB)
-	$(TOOL_CHARSETMAPPING) $(GENSRC_DATA) $(LOG_INFO) $(GENSRC_DST)/ext dbcs
-	$(TOUCH) $@
+# Processing of template depends on the snippets being generated first
+$(BUILD_CHARSET_STANDARD): \
+    $(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet \
+    $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet \
+    $(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet \
+    $(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet
 
-GENSRC_CHARSETMAPPING += $(GENSRC_TMP)/gensrc_the.charsetmapping.dbcs
-
-###
-
-GENSRC_CHARSET_PROVIDER_CMD := $(JDK_TOPDIR)/make/scripts/genCharsetProvider.sh
-
-$(GENSRC_DST)/StandardCharsets.java: $(JDK_TOPDIR)/src/share/classes/sun/nio/cs/standard-charsets \
-    $(GENSRC_CHARSET_PROVIDER_CMD) \
-    $(GENSRC_TMP)/_the.charsetmapping.dir
-	NAWK="$(NAWK)" TEMPDIR="$(GENSRC_TMP)" SH="$(SH)" \
-	    HASHER="$(TOOL_HASHER)" \
-	    SCRIPTS="$(JDK_TOPDIR)/make/scripts" \
-	    $(SH) -e $(GENSRC_CHARSET_PROVIDER_CMD) $(LOG_INFO) $< $(@D)
-
-GENSRC_CHARSETMAPPING += $(GENSRC_DST)/StandardCharsets.java
-
-$(GENSRC_CHARSETMAPPING): $(BUILD_TOOLS)
+GENSRC_CHARSETMAPPING += $(BUILD_CHARSET_STANDARD)
--- a/make/scripts/genCharsetProvider.sh	Mon Feb 03 22:26:26 2014 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-#! /bin/sh
-
-#
-# Copyright (c) 2004, 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.
-#
-
-# Generate a charset provider class
-
-# Required environment variables
-#   NAWK    awk tool
-#   TEMPDIR temporary directory
-#   HASHER  Hasher program
-
-SPEC=$1; shift
-DST=$1; shift
-
-eval `$NAWK <$SPEC '
-    /^[ \t]*copyright / { printf "COPYRIGHT_YEARS=\"%s %s\"\n", $2, $3; }
-    /^[ \t]*package / { printf "PKG=%s\n", $2; }
-    /^[ \t]*class / { printf "CLASS=%s\n", $2; }
-'`
-
-OUT=$DST/$CLASS.java
-echo '-->' $OUT
-
-
-# Header
-#
-
-$SH ${SCRIPTS}/addNotices.sh "$COPYRIGHT_YEARS" > $OUT
-
-cat <<__END__ >>$OUT
-
-// -- This file was mechanically generated: Do not edit! -- //
-
-package $PKG;
-
-import java.nio.charset.*;
-
-
-public class $CLASS
-    extends FastCharsetProvider
-{
-
-__END__
-
-
-# Alias tables
-#
-$NAWK <$SPEC >>$OUT '
-    BEGIN { n = 1; m = 1; }
-
-    /^[ \t]*charset / {
-      csn = $2; cln = $3;
-      lcsn = tolower(csn);
-      lcsns[n++] = lcsn;
-      csns[lcsn] = csn;
-      classMap[lcsn] = cln;
-      if (n > 2)
-        printf "    };\n\n";
-      printf "    static final String[] aliases_%s = new String[] {\n", cln;
-    }
-
-    /^[ \t]*alias / {
-      acsns[m++] = tolower($2);
-      aliasMap[tolower($2)] = lcsn;
-      printf "        \"%s\",\n", $2;
-    }
-
-    END {
-      printf "    };\n\n";
-    }
-'
-
-
-# Prehashed alias and class maps
-#
-$NAWK <$SPEC >$TEMPDIR/aliases '
-    /^[ \t]*charset / {
-      csn = $2;
-      lcsn = tolower(csn);
-    }
-    /^[ \t]*alias / {
-      an = tolower($2);
-      printf "%-20s \"%s\"\n", an, lcsn;
-    }
-'
-
-$NAWK <$SPEC >$TEMPDIR/classes '
-    /^[ \t]*charset / {
-      csn = $2; cln = $3;
-      lcsn = tolower(csn);
-      printf "%-20s \"%s\"\n", lcsn, cln;
-    }
-'
-
-${HASHER} -i Aliases <$TEMPDIR/aliases >>$OUT
-${HASHER} -i Classes <$TEMPDIR/classes >>$OUT
-${HASHER} -i -e Cache -t Charset <$TEMPDIR/classes >>$OUT
-
-
-# Constructor
-#
-cat <<__END__ >>$OUT
-    public $CLASS() {
-        super("$PKG", new Aliases(), new Classes(), new Cache());
-    }
-
-}
-__END__
--- a/make/src/classes/build/tools/hasher/Hasher.java	Mon Feb 03 22:26:26 2014 -0800
+++ b/make/src/classes/build/tools/hasher/Hasher.java	Tue Feb 04 10:00:24 2014 +0100
@@ -43,9 +43,6 @@
 
 public class Hasher {
 
-    // This class cannot, sadly, make use of 1.5 features since it must be
-    // compiled and run with the bootstrap JDK, which is 1.4.2.
-
     static final PrintStream out = System.out;
     static final PrintStream err = System.err;
 
@@ -184,11 +181,13 @@
                 if (md <= maxDepth) {
                     // Success
                     out.flush();
-                    if (cln != null)
-                        err.print(cln + ": ");
-                    err.println("Table size " + (1 << nb) + " (" + nb + " bits)"
-                                + ", shift " + shift
-                                + ", max chain depth " + md);
+                    if (verbose) {
+                        if (cln != null)
+                            err.print(cln + ": ");
+                        err.println("Table size " + (1 << nb) + " (" + nb + " bits)"
+                                    + ", shift " + shift
+                                    + ", max chain depth " + md);
+                    }
                     return this;
                 }
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/nio/cs/StandardCharsets.java.template	Tue Feb 04 10:00:24 2014 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2000, 2014, 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.
+ *
+ */
+
+// -- This file was mechanically generated: Do not edit! -- //
+
+package sun.nio.cs;
+
+import java.nio.charset.*;
+
+
+public class StandardCharsets
+    extends FastCharsetProvider
+{
+
+    _INCLUDE_ALIASES_TABLES_
+    _INCLUDE_ALIASES_MAP_
+    _INCLUDE_CLASSES_MAP_
+    _INCLUDE_CACHE_MAP_
+
+    public StandardCharsets() {
+        super("sun.nio.cs", new Aliases(), new Classes(), new Cache());
+    }
+
+}
--- a/src/share/classes/sun/nio/cs/standard-charsets	Mon Feb 03 22:26:26 2014 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,342 +0,0 @@
-#
-# Copyright (c) 2000, 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.
-#
-
-# Standard charsets provided by StandardCharsets provider.
-#
-# Note that these "standard" charsets listed here are not
-# necessary to be the "Standard charsets" defined in the
-# specification of java.nio.charset.Charset. Instead these
-# are the charsets that this implementation believes should
-# be packaged into the charsets provider class "StandardCharsets"
-# which is initialized at startup time by java.nio.charset.Charset,
-# compared to the charsets packaged in "ExtendedCharsets" provider,
-# which is lazy initialized.
-
-# This year should only change if the generated source is modified.
-copyright 2000, 2007,
-package sun.nio.cs
-class StandardCharsets
-
-charset US-ASCII US_ASCII
-
-    # IANA aliases
-    alias iso-ir-6
-    alias ANSI_X3.4-1986
-    alias ISO_646.irv:1991
-    alias ASCII
-    alias ISO646-US
-    alias us
-    alias IBM367
-    alias cp367
-    alias csASCII
-    alias default
-
-    # Other aliases
-    alias 646				# Solaris POSIX locale
-    alias iso_646.irv:1983
-    alias ANSI_X3.4-1968		# Linux POSIX locale (RedHat)
-    alias ascii7
-
-charset UTF-8 UTF_8
-    alias UTF8				# JDK historical
-    alias unicode-1-1-utf-8
-
-charset CESU-8 CESU_8
-    alias CESU8
-    alias csCESU-8
-
-charset UTF-16 UTF_16
-    alias UTF_16			# JDK historical
-    alias utf16
-    alias unicode
-    alias UnicodeBig
-
-charset UTF-16BE UTF_16BE
-    alias UTF_16BE
-    alias ISO-10646-UCS-2
-    alias X-UTF-16BE
-    alias UnicodeBigUnmarked
-
-charset UTF-16LE UTF_16LE
-    alias UTF_16LE
-    alias X-UTF-16LE
-    alias UnicodeLittleUnmarked
-
-charset x-UTF-16LE-BOM UTF_16LE_BOM
-    alias UnicodeLittle
-
-charset UTF-32 UTF_32
-    alias UTF_32
-    alias UTF32
-
-charset UTF-32LE UTF_32LE
-    alias UTF_32LE
-    alias X-UTF-32LE
-
-charset UTF-32BE UTF_32BE
-    alias UTF_32BE
-    alias X-UTF-32BE
-
-charset X-UTF-32LE-BOM UTF_32LE_BOM
-    alias UTF_32LE_BOM
-    alias UTF-32LE-BOM
-
-charset X-UTF-32BE-BOM UTF_32BE_BOM
-    alias UTF_32BE_BOM
-    alias UTF-32BE-BOM
-
-charset ISO-8859-1 ISO_8859_1
-
-    # IANA aliases
-    alias iso-ir-100
-    alias ISO_8859-1
-    alias latin1
-    alias l1
-    alias IBM819
-    alias cp819
-    alias csISOLatin1
-
-    # Other aliases
-    alias 819
-    alias IBM-819
-    alias ISO8859_1
-    alias ISO_8859-1:1987
-    alias ISO_8859_1
-    alias 8859_1
-    alias ISO8859-1
-
-charset ISO-8859-2 ISO_8859_2
-    alias iso8859_2			# JDK historical
-    alias 8859_2
-    alias iso-ir-101
-    alias ISO_8859-2
-    alias ISO_8859-2:1987
-    alias ISO8859-2
-    alias latin2
-    alias l2
-    alias ibm912
-    alias ibm-912
-    alias cp912
-    alias 912
-    alias csISOLatin2
-
-charset ISO-8859-4 ISO_8859_4
-    alias iso8859_4			# JDK historical
-    alias iso8859-4
-    alias 8859_4
-    alias iso-ir-110
-    alias ISO_8859-4
-    alias ISO_8859-4:1988
-    alias latin4
-    alias l4
-    alias ibm914
-    alias ibm-914
-    alias cp914
-    alias 914
-    alias csISOLatin4
-
-charset ISO-8859-5 ISO_8859_5
-    alias iso8859_5			# JDK historical
-    alias 8859_5
-    alias iso-ir-144
-    alias ISO_8859-5
-    alias ISO_8859-5:1988
-    alias ISO8859-5
-    alias cyrillic
-    alias ibm915
-    alias ibm-915
-    alias cp915
-    alias 915
-    alias csISOLatinCyrillic
-
-charset ISO-8859-7 ISO_8859_7
-    alias iso8859_7			# JDK historical
-    alias 8859_7
-    alias iso-ir-126
-    alias ISO_8859-7
-    alias ISO_8859-7:1987
-    alias ELOT_928
-    alias ECMA-118
-    alias greek
-    alias greek8
-    alias csISOLatinGreek
-    alias sun_eu_greek			# Solaris 7/8 compatibility
-    alias ibm813
-    alias ibm-813
-    alias 813
-    alias cp813
-    alias iso8859-7			# Solaris 9 compatibility
-
-charset ISO-8859-9 ISO_8859_9
-    alias iso8859_9			# JDK historical
-    alias 8859_9
-    alias iso-ir-148
-    alias ISO_8859-9
-    alias ISO_8859-9:1989
-    alias ISO8859-9
-    alias latin5
-    alias l5
-    alias ibm920
-    alias ibm-920
-    alias 920
-    alias cp920
-    alias csISOLatin5
-
-charset ISO-8859-13 ISO_8859_13
-    alias iso8859_13			# JDK historical
-    alias 8859_13
-    alias iso_8859-13
-    alias ISO8859-13
-
-charset ISO-8859-15 ISO_8859_15
-
-    # IANA alias
-    alias ISO_8859-15
-
-    # Other aliases
-    alias 8859_15
-    alias ISO-8859-15
-    alias ISO8859_15
-    alias ISO8859-15
-    alias IBM923
-    alias IBM-923
-    alias cp923
-    alias 923
-    alias LATIN0
-    alias LATIN9
-    alias L9
-    alias csISOlatin0
-    alias csISOlatin9
-    alias ISO8859_15_FDIS
-
-charset KOI8-R KOI8_R
-    alias koi8_r			# JDK historical
-    alias koi8
-    alias cskoi8r
-
-charset KOI8-U KOI8_U
-    alias koi8_u
-
-charset windows-1250 MS1250
-    alias cp1250			# JDK historical
-    alias cp5346			# Euro IBM CCSID
-
-charset windows-1251 MS1251
-    alias cp1251			# JDK historical
-    alias cp5347			# Euro IBM CCSID
-    alias ansi-1251			# Solaris compatibility
-
-charset windows-1252 MS1252
-    alias cp1252			# JDK historical
-    alias cp5348			# Euro IBM CCSID
-
-charset windows-1253 MS1253
-    alias cp1253			# JDK historical
-    alias cp5349			# Euro IBM CCSID
-
-charset windows-1254 MS1254
-    alias cp1254			# JDK historical
-    alias cp5350			# Euro IBM CCSID
-
-charset windows-1257 MS1257
-    alias cp1257			# JDK historical
-    alias cp5353			# Euro IBM CCSID
-
-
-charset IBM437 IBM437
-    alias cp437                         #JDK historical
-    alias ibm437
-    alias ibm-437
-    alias 437
-    alias cspc8codepage437
-    alias windows-437
-
-charset x-IBM737 IBM737
-    alias cp737                         #JDK historical
-    alias ibm737
-    alias ibm-737
-    alias 737
-
-charset IBM775 IBM775
-    alias cp775                         #JDK historical
-    alias ibm775
-    alias ibm-775
-    alias 775
-
-charset IBM850 IBM850
-    alias cp850                         #JDK historical
-    alias ibm-850
-    alias ibm850
-    alias 850
-    alias cspc850multilingual
-
-charset IBM852 IBM852
-    alias cp852                         #JDK historical
-    alias ibm852
-    alias ibm-852
-    alias 852
-    alias csPCp852
-
-charset IBM855 IBM855
-    alias cp855                         #JDK historical
-    alias ibm-855
-    alias ibm855
-    alias 855
-    alias cspcp855
-
-charset IBM857 IBM857
-    alias cp857                         #JDK historical
-    alias ibm857
-    alias ibm-857
-    alias 857
-    alias csIBM857
-
-charset IBM00858 IBM858
-    alias cp858                         #JDK historical
-    alias ccsid00858
-    alias cp00858
-    alias 858
-    alias PC-Multilingual-850+euro
-
-charset IBM862 IBM862
-    alias cp862                         #JDK historical
-    alias ibm862
-    alias ibm-862
-    alias 862
-    alias csIBM862
-    alias cspc862latinhebrew
-
-charset IBM866 IBM866
-    alias cp866                         #JDK historical
-    alias ibm866
-    alias ibm-866
-    alias 866
-    alias csIBM866
-
-charset x-IBM874 IBM874
-    alias cp874                         #JDK historical
-    alias ibm874
-    alias ibm-874
-    alias 874