0N/A#
3261N/A# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
2362N/A# published by the Free Software Foundation. Oracle designates this
0N/A# particular file as subject to the "Classpath" exception as provided
2362N/A# by Oracle in the LICENSE file that accompanied this code.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
0N/A#
0N/A
0N/A#
0N/A# Generic mechanism for installing properties files, resource bundles,
0N/A# and other resource files.
0N/A#
0N/A# FILES_properties should be defined.
0N/A# FILES_compiled_properties should be defined.
0N/A#
0N/A# If COMPILED_PROPERTIES_SUPERCLASS is defined, ALL the FILES_properties
0N/A# files will be compiled into java with this super class.
0N/A#
0N/A# You can add locales to LOCALE_SUFFIXES explicitly, or use the
0N/A# LOCALE_SET_DEFINITION variable to add some pre-defined locale lists.
0N/A# The LOCALE_SET_DEFINITION can have the value: jre, plugin, or jdk.
0N/A#
0N/A# Resource bundles to be installed are identified using the following variables.
0N/A# Note that only the file name of the base bundle is given; localized versions
0N/A# are added automatically. For Java files, use a format suitable for inclusion
0N/A# in the FILES_java list; dito for properties, all relative paths.
0N/A#
0N/A# NEW_RESOURCE_BUNDLES_JAVA - new resource bundles implemented in
0N/A# Java, not localized
0N/A# RESOURCE_BUNDLES_JAVA - resource bundles implemented in
0N/A# Java, localized
0N/A#
0N/A# The following variable is now used for most .properties files in the JDK.
0N/A# These properties files are converted into java and compiled with javac.
0N/A# The resulting .class files are usually smaller and are always faster to load.
0N/A# The relative path to the properties file becomes a relative path to a
0N/A# java source file.
0N/A#
0N/A# RESOURCE_BUNDLES_COMPILED_PROPERTIES - resource bundles implemented as
0N/A# properties files, localized
0N/A# NEW_RESOURCE_BUNDLES_COMPILED_PROPERTIES - same as above, not localized
0N/A#
803N/A# For non-compiled properties files, use the following variables:
803N/A#
803N/A# NEW_RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES - new resource bundles implemented as
803N/A# properties files, not localized
803N/A# RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES - resource bundles implemented as
803N/A# properties files, localized
803N/A#
0N/A# Other properties files to be installed are identified using the variable:
0N/A#
0N/A# OTHER_PROPERTIES
0N/A#
0N/A
0N/A# Compile properties files into java source?
0N/Aifdef COMPILED_PROPERTIES_SUPERCLASS
0N/A # Add all properties files to the compiled properties list (all or nothing)
0N/A COMPILED_PROPERTIES += $(FILES_compiled_properties) $(FILES_properties)
0N/Aelse
0N/A COMPILED_PROPERTIES_SUPERCLASS = ListResourceBundle
0N/A COMPILED_PROPERTIES += $(FILES_compiled_properties)
0N/Aendif
0N/A
0N/A# Determine the locale suffixes needed beyond the base bundle
0N/A
0N/Aifeq ($(LOCALE_SET_DEFINITION), plugin)
0N/A LOCALE_SUFFIXES += $(PLUGIN_LOCALES)
0N/Aendif
0N/Aifeq ($(LOCALE_SET_DEFINITION), jdk)
0N/A LOCALE_SUFFIXES += $(JDK_LOCALES)
0N/Aendif
0N/Aifeq ($(LOCALE_SET_DEFINITION), jre)
0N/A LOCALE_SUFFIXES += $(JRE_LOCALES)
0N/Aendif
0N/A
0N/A# Java files get tacked onto the standard list of files to compile
0N/ARESOURCE_BUNDLE_FILES_java += $(NEW_RESOURCE_BUNDLES_JAVA)
0N/ARESOURCE_BUNDLE_FILES_java += $(RESOURCE_BUNDLES_JAVA) \
0N/A $(foreach file,$(RESOURCE_BUNDLES_JAVA), \
0N/A $(foreach locale,$(LOCALE_SUFFIXES), \
0N/A $(basename $(file))_$(locale).java))
0N/A
0N/A# Add to java sources list
0N/AFILES_java += $(RESOURCE_BUNDLE_FILES_java)
0N/A
0N/A# Compiled properties files are translated to .java.
0N/A# The .java files are generated into GENSRCDIR.
0N/ACOMPILED_PROPERTIES += $(NEW_RESOURCE_BUNDLES_COMPILED_PROPERTIES)
0N/ACOMPILED_PROPERTIES += $(RESOURCE_BUNDLES_COMPILED_PROPERTIES) \
0N/A $(foreach file,$(RESOURCE_BUNDLES_COMPILED_PROPERTIES),\
0N/A $(foreach locale,$(LOCALE_SUFFIXES),\
0N/A $(basename $(file))_$(locale)$(suffix $(file))))
0N/A
0N/A# Add to java sources list
0N/AFILES_java += $(COMPILED_PROPERTIES:%.properties=%.java)
0N/A
0N/A# Non-compiled files
803N/APROPERTIES_FILES += $(NEW_RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES)
803N/APROPERTIES_FILES += $(RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES) \
803N/A $(foreach file,$(RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES), \
0N/A $(foreach locale,$(LOCALE_SUFFIXES), \
0N/A $(basename $(file))_$(locale)$(suffix $(file))))
803N/A# other properties
0N/APROPERTIES_FILES += $(OTHER_PROPERTIES)
0N/A
0N/A#
0N/A# Compile Properties tool
0N/A#
0N/ACOMPILEPROPERTIES_JARFILE = $(BUILDTOOLJARDIR)/compileproperties.jar
0N/A
0N/A#
0N/A# Strip Properties tool
0N/A#
0N/ASTRIPPROPERTIES_JARFILE = $(BUILDTOOLJARDIR)/stripproperties.jar
0N/A
0N/A#
0N/A# Process and strip all non-compiled properties files (in a batch mode)
0N/A#
0N/ASTRIP_PROP_FILES = $(PROPERTIES_FILES:%=$(CLASSDESTDIR)/%)
0N/A# To efficiently strip properties we use one run of StripProperties.
0N/A# This macro gathers an option for use later.
0N/ASTRIP_PROP_options=$(TEMPDIR)/strip_prop_options
0N/Adefine install-properties-file
0N/A$(install-file)
2080N/A$(call chmod-file, a+rw)
0N/A@$(ECHO) "# Adding to strip properties list: $@"
0N/A$(ECHO) "$@" >> $(STRIP_PROP_options)
0N/Aendef
0N/A
0N/A# Constructs command line options file
0N/A$(STRIP_PROP_options): $(STRIP_PROP_FILES)
0N/A @$(TOUCH) $@
0N/Astrip_prop_options_clean:
0N/A @$(RM) $(STRIP_PROP_options)
0N/A
0N/A# Strip the properties files
0N/Astrip_all_props: $(STRIPPROPERTIES_JARFILE) $(STRIP_PROP_options)
0N/A @if [ -s $(STRIP_PROP_options) ] ; then \
0N/A $(ECHO) "$(BOOT_JAVA_CMD) -jar $(STRIPPROPERTIES_JARFILE) -optionsfile $(STRIP_PROP_options)" ; \
0N/A $(BOOT_JAVA_CMD) -jar $(STRIPPROPERTIES_JARFILE) -optionsfile $(STRIP_PROP_options) ; \
0N/A fi
0N/A @$(java-vm-cleanup)
0N/A
0N/A#
0N/A# Creates files in CLASSDESTDIR
0N/A#
0N/A
0N/A# In some cases, we move files from package to resources subdir
0N/A$(CLASSDESTDIR)/$(PKGDIR)/resources/%.properties: \
0N/A $(SHARE_SRC)/classes/$(PKGDIR)/%.properties
0N/A $(install-properties-file)
0N/A$(CLASSDESTDIR)/%.properties: $(SHARE_SRC)/classes/%.properties
0N/A $(install-properties-file)
0N/A$(CLASSDESTDIR)/%.res: $(SHARE_SRC)/classes/%.res
0N/A $(install-file)
0N/A$(CLASSDESTDIR)/%.dtd: $(SHARE_SRC)/classes/%.dtd
0N/A $(install-file)
0N/A$(CLASSDESTDIR)/%.xml: $(SHARE_SRC)/classes/%.xml
0N/A $(install-file)
0N/A$(CLASSDESTDIR)/%.prp: $(SHARE_SRC)/classes/%.prp
0N/A $(install-file)
0N/A
0N/A#
0N/A# To efficiently compile properties into java sources we use one run
0N/A# of compileproperties. This macro gathers an option for use later.
0N/A# Note: The properties file and java source name can be different
0N/A# locales, e.g. zh_TW and zh_HK. The java source filename
0N/A# determines the name of the class.
0N/ACOMPILE_PROP_options=$(TEMPDIR)/compile_prop_options
0N/Adefine add-property-java-file
0N/A@$(prep-target)
0N/A@$(ECHO) "# Adding to compile properties list: $? -> $@"
0N/A$(ECHO) "-compile $? $@ $(COMPILED_PROPERTIES_SUPERCLASS)" \
0N/A >> $(COMPILE_PROP_options)
0N/Aendef
0N/A
0N/A$(GENSRCDIR)/%.java: $(PLATFORM_SRC)/classes/%.properties
0N/A $(add-property-java-file)
0N/A$(GENSRCDIR)/%.java: $(SHARE_SRC)/classes/%.properties
0N/A $(add-property-java-file)
0N/A$(GENSRCDIR)/%.java: $(GENSRCDIR)/%.properties
0N/A $(add-property-java-file)
5015N/Aifdef PLATFORM_SRC_MACOS
5015N/A$(GENSRCDIR)/%.java: $(PLATFORM_SRC_MACOS)/classes/%.properties
5015N/A $(add-property-java-file)
5015N/Aendif
0N/Aifndef OPENJDK
0N/A$(GENSRCDIR)/%.java: $(CLOSED_PLATFORM_SRC)/classes/%.properties
0N/A $(add-property-java-file)
0N/A$(GENSRCDIR)/%.java: $(CLOSED_SHARE_SRC)/classes/%.properties
0N/A $(add-property-java-file)
0N/Aendif
0N/A
0N/A# Create HK java file from zh_TW (explicit resource bundles only)
0N/Adefine create-hk-java-file
0N/A@$(prep-target)
0N/A$(CAT) $< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $@
0N/Aendef
0N/A
0N/A# Explicit resource bundles
0N/A$(GENSRCDIR)/%_zh_HK.java: $(PLATFORM_SRC)/classes/%_zh_TW.java
0N/A $(create-hk-java-file)
0N/A$(GENSRCDIR)/%_zh_HK.java: $(SHARE_SRC)/classes/%_zh_TW.java
0N/A $(create-hk-java-file)
0N/A
0N/A# Compile of zh_HK properties just uses the zh_TW properties files
0N/A$(GENSRCDIR)/%_zh_HK.java: $(PLATFORM_SRC)/classes/%_zh_TW.properties
0N/A $(add-property-java-file)
0N/A$(GENSRCDIR)/%_zh_HK.java: $(SHARE_SRC)/classes/%_zh_TW.properties
0N/A $(add-property-java-file)
0N/A
0N/A# Simple delivery of zh_HK properties files just copies zh_TW properties files
0N/A$(CLASSDESTDIR)/%_zh_HK.properties: \
0N/A $(PLATFORM_SRC)/classes/%_zh_TW.properties
0N/A $(install-properties-file)
0N/A$(CLASSDESTDIR)/%_zh_HK.properties: \
0N/A $(SHARE_SRC)/classes/%_zh_TW.properties
0N/A $(install-properties-file)
0N/A
0N/A# List of java files converted from properties files needed
0N/ACOMPILE_PROP_JAVA_FILES = $(COMPILED_PROPERTIES:%.properties=$(GENSRCDIR)/%.java)
0N/A
0N/A# Constructs command line options file
0N/A$(COMPILE_PROP_options): $(COMPILE_PROP_JAVA_FILES)
0N/A @$(TOUCH) $@
0N/Acompile_prop_options_clean:
0N/A @$(RM) $(COMPILE_PROP_options)
0N/A
0N/A# Make sure all are compiled, one compiler run
0N/Acompile_all_props: $(COMPILEPROPERTIES_JARFILE) $(COMPILE_PROP_options)
0N/A @if [ `$(CAT) $(COMPILE_PROP_options) | $(WC) -l` -ge 1 ] ; then \
0N/A $(MKDIR) -p $(GENSRCDIR); \
0N/A $(ECHO) "$(BOOT_JAVA_CMD) -jar $(COMPILEPROPERTIES_JARFILE) -optionsfile $(COMPILE_PROP_options)";\
0N/A $(BOOT_JAVA_CMD) -jar $(COMPILEPROPERTIES_JARFILE) -optionsfile $(COMPILE_PROP_options) ; \
0N/A $(java-vm-cleanup); \
0N/A fi
0N/A
0N/A# Make sure the build rule creates all the properties
0N/Aresources:
0N/A
2833N/Aifneq ($(strip $(PROPERTIES_FILES)),)
0N/A resources: strip_prop_options_clean strip_all_props
0N/A clobber clean::
0N/A $(RM) $(STRIP_PROP_FILES) $(STRIP_PROP_options)
0N/Aendif
0N/A
2833N/Aifneq ($(strip $(COMPILED_PROPERTIES)),)
0N/A resources: compile_prop_options_clean compile_all_props
0N/A clobber clean::
0N/A $(RM) $(COMPILE_PROP_JAVA_FILES) $(COMPILE_PROP_options)
0N/Aendif
0N/A
0N/A.PHONY: resources \
0N/A compile_prop_options_clean compile_all_props \
0N/A strip_prop_options_clean strip_all_props
0N/A