1 # 2 # Copyright (c) 2005, 2012, 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 # This file defines rules to build the locales information for 28 # resources in "sun.util.resources" & "sun.text.resources" packages 29 # 30 31 # Save the current FILES_java & FILES_compiled_properties variables 32 33 FILES_java_orig := $(FILES_java) 34 FILES_compiled_properties_orig := $(FILES_compiled_properties) 35 36 37 # Since all the resources files are going to be compiled into class file format, 38 # only FILES_java and FILES_compiled_properties variables will be picked up 39 # 40 # $(BUILDDIR)/java/util/FILES_java.gmk & $(BUILDDIR)/java/util/FILES_properties.gmk 41 # contain "sun.util.resources" for US language support 42 43 include $(BUILDDIR)/java/util/FILES_java.gmk 44 include $(BUILDDIR)/java/util/FILES_properties.gmk 45 46 US_Resources_java := $(FILES_java) 47 US_Resources_properties := $(FILES_compiled_properties) 48 49 # $(BUILDDIR)/java/text/FILES_java.gmk contains the "sun.text.resources" for 50 # US language support 51 52 include $(BUILDDIR)/java/text/base/FILES_java.gmk 53 54 US_Resources_java += $(FILES_java) 55 56 FILES_compiled_properties= 57 58 # $(BUILDDIR)/sun/text/FILES_java.gmk & $(BUILDDIR)/sun/text/FILES_properties.gmk 59 # contain both resources for Non-US language support 60 61 include $(BUILDDIR)/sun/text/FILES_java.gmk 62 include $(BUILDDIR)/sun/text/FILES_properties.gmk 63 64 NonUS_Resources_java := $(FILES_java) 65 NonUS_Resources_properties := $(FILES_compiled_properties) 66 67 # Restore the orignal FILES_java & FILES_compiled_properties variables 68 FILES_java := $(FILES_java_orig) 69 FILES_compiled_properties := $(FILES_compiled_properties_orig) 70 71 LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template 72 LocaleDataMetaInfo_Dest=$(GENSRCDIR)/sun/util/locale/provider/LocaleDataMetaInfo.java 73 LOCALEGEN_SH=localegen.sh 74 RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames CalendarData" 75 76 77 # On MacOSX sed does not enter a newline as it does on other platforms with the same pattern 78 # Using awk instead 79 80 ifeq ($(PLATFORM), macosx) 81 82 $(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH) 83 @$(RM) $@.tmp.us $@.tmp.nonus; 84 @$(prep-target) 85 @$(ECHO) $(US_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.us; 86 @$(ECHO) $(US_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.us; 87 @$(ECHO) $(NonUS_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.nonus; 88 @$(ECHO) $(NonUS_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.nonus; 89 NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \ 90 $(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.us \ 91 $@.tmp.nonus $< $@ 92 @$(RM) $@.tmp.us $@.tmp.nonus; 93 94 else 95 96 $(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH) 97 @$(RM) $@.tmp.us $@.tmp.nonus; 98 @$(prep-target) 99 @$(ECHO) $(subst .properties,'\n',$(US_Resources_properties)) > $@.tmp.us; 100 @$(ECHO) $(subst .java,'\n',$(US_Resources_java)) >> $@.tmp.us; 101 @$(ECHO) $(subst .properties,'\n',$(NonUS_Resources_properties)) > $@.tmp.nonus; 102 @$(ECHO) $(subst .java,'\n',$(NonUS_Resources_java)) >> $@.tmp.nonus; 103 NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \ 104 $(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.us \ 105 $@.tmp.nonus $< $@ 106 @$(RM) $@.tmp.us $@.tmp.nonus; 107 endif 108 109 genlocales : $(LocaleDataMetaInfo_Dest) 110 111 clean clobber:: 112 $(RM) $(LocaleDataMetaInfo_Dest) 113