1
2# Copyright (c) 2011, 2016, 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
26#
27# Make file for generating BreakIterator data files.
28#
29
30# input
31#
32# Notes: sun.text.resources.BreakIteratorRules no longer goes to runtime.
33# They are used at JDK build phase in order to create $(BIFILES) which
34# are used on runtime instead.
35#
36TEXT_PKG := sun/text/resources
37TEXT_PKG_LD := $(TEXT_PKG)/ext
38TEXT_SOURCES := $(TEXT_PKG)/BreakIteratorRules.java \
39    $(TEXT_PKG)/BreakIteratorInfo.java \
40    $(TEXT_PKG_LD)/BreakIteratorRules_th.java \
41    $(TEXT_PKG_LD)/BreakIteratorInfo_th.java
42
43# Generate BreakIteratorData
44BREAK_ITERATOR_CLASSES := $(BUILDTOOLS_OUTPUTDIR)/break_iterator_classes
45
46# These two files should be moved out to a build tool!
47$(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR_BASE, \
48    SETUP := GENERATE_OLDBYTECODE, \
49    SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
50    INCLUDE_FILES := \
51        $(TEXT_PKG)/BreakIteratorRules.java \
52        $(TEXT_PKG)/BreakIteratorInfo.java, \
53    BIN := $(BREAK_ITERATOR_CLASSES)/java.base))
54
55$(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR_LD, \
56    SETUP := GENERATE_OLDBYTECODE, \
57    SRC := $(JDK_TOPDIR)/src/jdk.localedata/share/classes, \
58    INCLUDE_FILES := \
59        $(TEXT_PKG_LD)/BreakIteratorRules_th.java \
60        $(TEXT_PKG_LD)/BreakIteratorInfo_th.java, \
61    BIN := $(BREAK_ITERATOR_CLASSES)/jdk.localedata))
62
63ifeq ($(BOOT_JDK_MODULAR), true)
64  BREAK_ITERATOR_BOOTCLASSPATH := \
65      --patch-module java.base=$(BREAK_ITERATOR_CLASSES)/java.base \
66      --patch-module jdk.localedata=$(BREAK_ITERATOR_CLASSES)/jdk.localedata \
67      --add-exports java.base/sun.text=ALL-UNNAMED \
68      --add-exports java.base/sun.text.resources=ALL-UNNAMED \
69      --add-exports jdk.localedata/sun.text.resources.ext=ALL-UNNAMED \
70      #
71else
72  BREAK_ITERATOR_BOOTCLASSPATH := -Xbootclasspath/p:$(call PathList, \
73      $(BREAK_ITERATOR_CLASSES)/java.base \
74      $(BREAK_ITERATOR_CLASSES)/jdk.localedata)
75endif
76
77# Generate data resource files.
78# input
79UNICODEDATA := $(JDK_TOPDIR)/make/data/unicodedata/UnicodeData.txt
80
81# output
82BASE_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/java.base/sun/text/resources
83LD_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/jdk.localedata/sun/text/resources/ext
84BIFILES := $(BASE_DATA_PKG_DIR)/CharacterBreakIteratorData \
85    $(BASE_DATA_PKG_DIR)/WordBreakIteratorData \
86    $(BASE_DATA_PKG_DIR)/LineBreakIteratorData \
87    $(BASE_DATA_PKG_DIR)/SentenceBreakIteratorData
88BIFILES_TH := $(LD_DATA_PKG_DIR)/WordBreakIteratorData_th \
89    $(LD_DATA_PKG_DIR)/LineBreakIteratorData_th
90
91$(BIFILES): $(BASE_DATA_PKG_DIR)/_the.bifiles
92$(BASE_DATA_PKG_DIR)/_the.bifiles: JAVA_FLAGS += $(BREAK_ITERATOR_BOOTCLASSPATH)
93$(BASE_DATA_PKG_DIR)/_the.bifiles: $(BUILD_TOOLS) $(UNICODEDATA) \
94    $(BUILD_BREAKITERATOR_BASE) $(BUILD_BREAKITERATOR_LD)
95	$(call LogInfo, Generating BreakIteratorData)
96	$(call MakeDir, $(@D))
97	$(RM) $(BIFILES)
98	$(TOOL_GENERATEBREAKITERATORDATA) \
99	    -o $(@D) \
100	    -spec $(UNICODEDATA)
101	$(TOUCH) $@
102
103$(BIFILES_TH): $(LD_DATA_PKG_DIR)/_the.bifiles_th
104$(LD_DATA_PKG_DIR)/_the.bifiles_th: JAVA_FLAGS += $(BREAK_ITERATOR_BOOTCLASSPATH)
105$(LD_DATA_PKG_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) \
106    $(BUILD_BREAKITERATOR_BASE) $(BUILD_BREAKITERATOR_LD)
107	$(call LogInfo, Generating BreakIteratorData_th)
108	$(RM) $(BIFILES_TH)
109	$(TOOL_GENERATEBREAKITERATORDATA) \
110	    -o $(@D) \
111	    -spec $(UNICODEDATA) \
112	    -language th
113	$(TOUCH) $@
114
115TARGETS += $(BIFILES) $(BIFILES_TH)
116