1#
2# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation.  Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26include GensrcCommon.gmk
27
28################################################################################
29#
30# Generate files using the charsetmapping tool
31#
32CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
33
34CHARSET_GENSRC_JAVA_DIR_CS := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext
35CHARSET_DONE_CS := $(CHARSET_GENSRC_JAVA_DIR_CS)/_the.charsetmapping
36CHARSET_COPYRIGHT_HEADER := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
37CHARSET_TEMPLATES := \
38    $(CHARSET_DATA_DIR)/SingleByte-X.java.template \
39    $(CHARSET_DATA_DIR)/DoubleByte-X.java.template
40CHARSET_EXTENDED_JAVA_TEMPLATES := \
41    $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template
42CHARSET_EXTENDED_JAVA_DIR := $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext
43CHARSET_STANDARD_OS := stdcs-$(OPENJDK_TARGET_OS)
44
45$(CHARSET_DONE_CS)-extcs: $(CHARSET_DATA_DIR)/charsets \
46    $(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
47    $(CHARSET_TEMPLATES) $(CHARSET_EXTENDED_JAVA_TEMPLATES) \
48    $(BUILD_TOOLS_JDK)
49	$(call LogInfo, Generating jdk.charsets extcs)
50	$(call MakeDir, $(@D))
51	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) \
52	    extcs charsets  $(CHARSET_STANDARD_OS) \
53	    $(CHARSET_EXTENDED_JAVA_TEMPLATES) \
54	    $(CHARSET_EXTENDED_JAVA_DIR) \
55	    $(CHARSET_COPYRIGHT_HEADER) \
56	    $(LOG_DEBUG)
57	$(TOUCH) '$@'
58
59$(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \
60    $(BUILD_TOOLS_JDK)
61	$(call LogInfo, Generating jdk.charsets hkscs)
62	$(call MakeDir, $(@D))
63	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) hkscs '$<'
64	$(TOUCH) '$@'
65
66$(CHARSET_DONE_CS)-euctw: $(CHARSET_COPYRIGHT_HEADER)/EUC_TW.java \
67    $(BUILD_TOOLS_JDK)
68	$(call LogInfo, Generating jdk.charsets euctw)
69	$(call MakeDir, $(@D))
70	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) euctw '$<'
71	$(TOUCH) '$@'
72
73$(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \
74    $(BUILD_TOOLS_JDK)
75	$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
76	$(call MakeDir, $(@D))
77	$(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
78
79GENSRC_JDK_CHARSETS += \
80    $(CHARSET_DONE_CS)-extcs \
81    $(CHARSET_DONE_CS)-hkscs \
82    $(CHARSET_DONE_CS)-euctw \
83    $(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat \
84    #
85
86################################################################################
87
88jdk.charsets: $(GENSRC_JDK_CHARSETS)
89
90all: jdk.charsets
91
92.PHONY: all jdk.charsets
93