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