4
|
1 |
#
|
|
2 |
# Copyright 1997-2005 Sun Microsystems, Inc. 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. Sun designates this
|
|
8 |
# particular file as subject to the "Classpath" exception as provided
|
|
9 |
# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
# CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
# have any questions.
|
|
24 |
#
|
|
25 |
|
|
26 |
#
|
|
27 |
# Generic mechanism for installing properties files, resource bundles,
|
|
28 |
# and other resource files.
|
|
29 |
#
|
|
30 |
# FILES_properties should be defined.
|
|
31 |
# FILES_compiled_properties should be defined.
|
|
32 |
#
|
|
33 |
# If COMPILED_PROPERTIES_SUPERCLASS is defined, ALL the FILES_properties
|
|
34 |
# files will be compiled into java with this super class.
|
|
35 |
#
|
|
36 |
# You can add locales to LOCALE_SUFFIXES explicitly, or use the
|
|
37 |
# LOCALE_SET_DEFINITION variable to add some pre-defined locale lists.
|
|
38 |
# The LOCALE_SET_DEFINITION can have the value: jre, plugin, or jdk.
|
|
39 |
#
|
|
40 |
# Resource bundles to be installed are identified using the following variables.
|
|
41 |
# Note that only the file name of the base bundle is given; localized versions
|
|
42 |
# are added automatically. For Java files, use a format suitable for inclusion
|
|
43 |
# in the FILES_java list; dito for properties, all relative paths.
|
|
44 |
#
|
|
45 |
# NEW_RESOURCE_BUNDLES_JAVA - new resource bundles implemented in
|
|
46 |
# Java, not localized
|
|
47 |
# NEW_RESOURCE_BUNDLES_PROPERTIES - new resource bundles implemented as
|
|
48 |
# properties files, not localized
|
|
49 |
# RESOURCE_BUNDLES_JAVA - resource bundles implemented in
|
|
50 |
# Java, localized
|
|
51 |
# RESOURCE_BUNDLES_PROPERTIES - new resource bundles implemented as
|
|
52 |
# properties files, localized
|
|
53 |
#
|
|
54 |
# The following variable is now used for most .properties files in the JDK.
|
|
55 |
# These properties files are converted into java and compiled with javac.
|
|
56 |
# The resulting .class files are usually smaller and are always faster to load.
|
|
57 |
# The relative path to the properties file becomes a relative path to a
|
|
58 |
# java source file.
|
|
59 |
#
|
|
60 |
# RESOURCE_BUNDLES_COMPILED_PROPERTIES - resource bundles implemented as
|
|
61 |
# properties files, localized
|
|
62 |
# NEW_RESOURCE_BUNDLES_COMPILED_PROPERTIES - same as above, not localized
|
|
63 |
#
|
|
64 |
# Other properties files to be installed are identified using the variable:
|
|
65 |
#
|
|
66 |
# OTHER_PROPERTIES
|
|
67 |
#
|
|
68 |
|
|
69 |
# Compile properties files into java source?
|
|
70 |
ifdef COMPILED_PROPERTIES_SUPERCLASS
|
|
71 |
# Add all properties files to the compiled properties list (all or nothing)
|
|
72 |
COMPILED_PROPERTIES += $(FILES_compiled_properties) $(FILES_properties)
|
|
73 |
else
|
|
74 |
COMPILED_PROPERTIES_SUPERCLASS = ListResourceBundle
|
|
75 |
COMPILED_PROPERTIES += $(FILES_compiled_properties)
|
|
76 |
endif
|
|
77 |
|
|
78 |
# Determine the locale suffixes needed beyond the base bundle
|
|
79 |
|
|
80 |
ifeq ($(LOCALE_SET_DEFINITION), plugin)
|
|
81 |
LOCALE_SUFFIXES += $(PLUGIN_LOCALES)
|
|
82 |
endif
|
|
83 |
ifeq ($(LOCALE_SET_DEFINITION), jdk)
|
|
84 |
LOCALE_SUFFIXES += $(JDK_LOCALES)
|
|
85 |
endif
|
|
86 |
ifeq ($(LOCALE_SET_DEFINITION), jre)
|
|
87 |
LOCALE_SUFFIXES += $(JRE_LOCALES)
|
|
88 |
endif
|
|
89 |
|
|
90 |
# Java files get tacked onto the standard list of files to compile
|
|
91 |
RESOURCE_BUNDLE_FILES_java += $(NEW_RESOURCE_BUNDLES_JAVA)
|
|
92 |
RESOURCE_BUNDLE_FILES_java += $(RESOURCE_BUNDLES_JAVA) \
|
|
93 |
$(foreach file,$(RESOURCE_BUNDLES_JAVA), \
|
|
94 |
$(foreach locale,$(LOCALE_SUFFIXES), \
|
|
95 |
$(basename $(file))_$(locale).java))
|
|
96 |
|
|
97 |
# Add to java sources list
|
|
98 |
FILES_java += $(RESOURCE_BUNDLE_FILES_java)
|
|
99 |
|
|
100 |
# Compiled properties files are translated to .java.
|
|
101 |
# The .java files are generated into GENSRCDIR.
|
|
102 |
COMPILED_PROPERTIES += $(NEW_RESOURCE_BUNDLES_COMPILED_PROPERTIES)
|
|
103 |
COMPILED_PROPERTIES += $(RESOURCE_BUNDLES_COMPILED_PROPERTIES) \
|
|
104 |
$(foreach file,$(RESOURCE_BUNDLES_COMPILED_PROPERTIES),\
|
|
105 |
$(foreach locale,$(LOCALE_SUFFIXES),\
|
|
106 |
$(basename $(file))_$(locale)$(suffix $(file))))
|
|
107 |
|
|
108 |
# Add to java sources list
|
|
109 |
FILES_java += $(COMPILED_PROPERTIES:%.properties=%.java)
|
|
110 |
|
|
111 |
# Non-compiled files
|
|
112 |
PROPERTIES_FILES += $(NEW_RESOURCE_BUNDLES_PROPERTIES)
|
|
113 |
PROPERTIES_FILES += $(RESOURCE_BUNDLES_PROPERTIES) \
|
|
114 |
$(foreach file,$(RESOURCE_BUNDLES_PROPERTIES), \
|
|
115 |
$(foreach locale,$(LOCALE_SUFFIXES), \
|
|
116 |
$(basename $(file))_$(locale)$(suffix $(file))))
|
|
117 |
PROPERTIES_FILES += $(OTHER_PROPERTIES)
|
|
118 |
|
|
119 |
#
|
|
120 |
# Compile Properties tool
|
|
121 |
#
|
|
122 |
COMPILEPROPERTIES_JARFILE = $(BUILDTOOLJARDIR)/compileproperties.jar
|
|
123 |
|
|
124 |
#
|
|
125 |
# Strip Properties tool
|
|
126 |
#
|
|
127 |
STRIPPROPERTIES_JARFILE = $(BUILDTOOLJARDIR)/stripproperties.jar
|
|
128 |
|
|
129 |
#
|
|
130 |
# Process and strip all non-compiled properties files (in a batch mode)
|
|
131 |
#
|
|
132 |
STRIP_PROP_FILES = $(PROPERTIES_FILES:%=$(CLASSDESTDIR)/%)
|
|
133 |
# To efficiently strip properties we use one run of StripProperties.
|
|
134 |
# This macro gathers an option for use later.
|
|
135 |
STRIP_PROP_options=$(TEMPDIR)/strip_prop_options
|
|
136 |
define install-properties-file
|
|
137 |
$(install-file)
|
|
138 |
$(CHMOD) a+rw $@
|
|
139 |
@$(ECHO) "# Adding to strip properties list: $@"
|
|
140 |
$(ECHO) "$@" >> $(STRIP_PROP_options)
|
|
141 |
endef
|
|
142 |
|
|
143 |
# Constructs command line options file
|
|
144 |
$(STRIP_PROP_options): $(STRIP_PROP_FILES)
|
|
145 |
@$(TOUCH) $@
|
|
146 |
strip_prop_options_clean:
|
|
147 |
@$(RM) $(STRIP_PROP_options)
|
|
148 |
|
|
149 |
# Strip the properties files
|
|
150 |
strip_all_props: $(STRIPPROPERTIES_JARFILE) $(STRIP_PROP_options)
|
|
151 |
@if [ -s $(STRIP_PROP_options) ] ; then \
|
|
152 |
$(ECHO) "$(BOOT_JAVA_CMD) -jar $(STRIPPROPERTIES_JARFILE) -optionsfile $(STRIP_PROP_options)" ; \
|
|
153 |
$(BOOT_JAVA_CMD) -jar $(STRIPPROPERTIES_JARFILE) -optionsfile $(STRIP_PROP_options) ; \
|
|
154 |
fi
|
|
155 |
@$(java-vm-cleanup)
|
|
156 |
|
|
157 |
#
|
|
158 |
# Creates files in CLASSDESTDIR
|
|
159 |
#
|
|
160 |
|
|
161 |
# In some cases, we move files from package to resources subdir
|
|
162 |
$(CLASSDESTDIR)/$(PKGDIR)/resources/%.properties: \
|
|
163 |
$(SHARE_SRC)/classes/$(PKGDIR)/%.properties
|
|
164 |
$(install-properties-file)
|
|
165 |
$(CLASSDESTDIR)/%.properties: $(SHARE_SRC)/classes/%.properties
|
|
166 |
$(install-properties-file)
|
|
167 |
$(CLASSDESTDIR)/%.res: $(SHARE_SRC)/classes/%.res
|
|
168 |
$(install-file)
|
|
169 |
$(CLASSDESTDIR)/%.dtd: $(SHARE_SRC)/classes/%.dtd
|
|
170 |
$(install-file)
|
|
171 |
$(CLASSDESTDIR)/%.xml: $(SHARE_SRC)/classes/%.xml
|
|
172 |
$(install-file)
|
|
173 |
$(CLASSDESTDIR)/%.prp: $(SHARE_SRC)/classes/%.prp
|
|
174 |
$(install-file)
|
|
175 |
|
|
176 |
$(GENSRCDIR)/%.java: $(PLATFORM_SRC)/classes/%.properties
|
|
177 |
$(add-property-java-file)
|
|
178 |
$(GENSRCDIR)/%.java: $(SHARE_SRC)/classes/%.properties
|
|
179 |
$(add-property-java-file)
|
|
180 |
$(GENSRCDIR)/%.java: $(GENSRCDIR)/%.properties
|
|
181 |
$(add-property-java-file)
|
|
182 |
|
|
183 |
# Create HK java file from zh_TW (explicit resource bundles only)
|
|
184 |
define create-hk-java-file
|
|
185 |
@$(prep-target)
|
|
186 |
$(CAT) $< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $@
|
|
187 |
endef
|
|
188 |
|
|
189 |
# Explicit resource bundles
|
|
190 |
$(GENSRCDIR)/%_zh_HK.java: $(PLATFORM_SRC)/classes/%_zh_TW.java
|
|
191 |
$(create-hk-java-file)
|
|
192 |
$(GENSRCDIR)/%_zh_HK.java: $(SHARE_SRC)/classes/%_zh_TW.java
|
|
193 |
$(create-hk-java-file)
|
|
194 |
|
|
195 |
# Compile of zh_HK properties just uses the zh_TW properties files
|
|
196 |
$(GENSRCDIR)/%_zh_HK.java: $(PLATFORM_SRC)/classes/%_zh_TW.properties
|
|
197 |
$(add-property-java-file)
|
|
198 |
$(GENSRCDIR)/%_zh_HK.java: $(SHARE_SRC)/classes/%_zh_TW.properties
|
|
199 |
$(add-property-java-file)
|
|
200 |
|
|
201 |
# Simple delivery of zh_HK properties files just copies zh_TW properties files
|
|
202 |
$(CLASSDESTDIR)/%_zh_HK.properties: \
|
|
203 |
$(PLATFORM_SRC)/classes/%_zh_TW.properties
|
|
204 |
$(install-properties-file)
|
|
205 |
$(CLASSDESTDIR)/%_zh_HK.properties: \
|
|
206 |
$(SHARE_SRC)/classes/%_zh_TW.properties
|
|
207 |
$(install-properties-file)
|
|
208 |
|
|
209 |
# List of java files converted from properties files needed
|
|
210 |
COMPILE_PROP_JAVA_FILES = $(COMPILED_PROPERTIES:%.properties=$(GENSRCDIR)/%.java)
|
|
211 |
|
|
212 |
# Make sure the build rule creates all the properties
|
|
213 |
resources:
|
|
214 |
|
|
215 |
ifneq ($(PROPERTIES_FILES),)
|
|
216 |
resources: strip_prop_options_clean strip_all_props
|
|
217 |
clobber clean::
|
|
218 |
$(RM) $(STRIP_PROP_FILES)
|
|
219 |
$(RM) $(STRIP_PROP_options)
|
|
220 |
endif
|
|
221 |
|
|
222 |
.PHONY: resources \
|
|
223 |
strip_prop_options_clean strip_all_props
|
|
224 |
|