1 # 2 # Copyright (c) 2011, 2013, 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 # Scan for all locale resources and extract for which locales there exists 27 # resources. Then put this meta information about exiting (supported?) locales 28 # into LocaleDataMetaInfo.java 29 30 # First go look for all locale files 31 LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/share/classes \ 32 -name "FormatData_*.java" -o -name "FormatData_*.properties" -o \ 33 -name "CollationData_*.java" -o -name "CollationData_*.properties" -o \ 34 -name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \ 35 -name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \ 36 -name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \ 37 -name "CalendarData_*.java" -o -name "CalendarData_*.properties") 38 39 # Then translate the locale files into for example: FormatData_sv 40 LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES))))) 41 42 # Include the list of resources found during the previous compile. 43 -include $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources 44 45 MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES)) 46 NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES)) 47 48 ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES)) 49 # There is a difference in the number of supported resources. Trigger a regeneration. 50 $(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java) 51 endif 52 53 # The EN locales 54 EN_LOCALES := en% 55 56 # ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files. 57 ALL_NON_EN_LOCALES := ja-JP-JP th-TH-TH 61 # This macro creates a sed expression that substitues for example: 62 # #FormatData_ENLocales# with: en% locales. 63 define CaptureLocale 64 $1_LOCALES := $$(subst _,-,$$(filter-out $1, $$(subst $1_,,$$(filter $1_%, $(LOCALE_RESOURCES))))) 65 $1_EN_LOCALES := $$(filter $(EN_LOCALES), $$($1_LOCALES)) 66 $1_NON_EN_LOCALES := $$(filter-out $(EN_LOCALES), $$($1_LOCALES)) 67 68 ALL_EN_LOCALES += $$($1_EN_LOCALES) 69 ALL_NON_EN_LOCALES += $$($1_NON_EN_LOCALES) 70 71 # Don't sed in a space if there are no locales. 72 SED_ARGS += -e 's/$$(HASH)$1_ENLocales$$(HASH)/$$(if $$($1_EN_LOCALES),$$(SPACE)$$($1_EN_LOCALES),)/g' 73 SED_ARGS += -e 's/$$(HASH)$1_NonENLocales$$(HASH)/$$(if $$($1_NON_EN_LOCALES),$$(SPACE)$$($1_NON_EN_LOCALES),)/g' 74 endef 75 76 #sun.text.resources.FormatData 77 $(eval $(call CaptureLocale,FormatData)) 78 79 #sun.text.resources.CollationData 80 $(eval $(call CaptureLocale,CollationData)) 81 82 #sun.util.resources.TimeZoneNames 83 $(eval $(call CaptureLocale,TimeZoneNames)) 84 85 #sun.util.resources.LocaleNames 86 $(eval $(call CaptureLocale,LocaleNames)) 87 88 #sun.util.resources.CurrencyNames 89 $(eval $(call CaptureLocale,CurrencyNames)) 90 91 #sun.util.resources.CalendarData 92 $(eval $(call CaptureLocale,CalendarData)) 93 94 SED_ARGS += -e 's/$(HASH)AvailableLocales_ENLocales$(HASH)/$(sort $(ALL_EN_LOCALES))/g' 95 SED_ARGS += -e 's/$(HASH)AvailableLocales_NonENLocales$(HASH)/$(sort $(ALL_NON_EN_LOCALES))/g' 96 97 $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java: \ 98 $(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template 99 $(MKDIR) -p $(@D) 100 $(ECHO) Creating sun/util/LocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources. | 1 # 2 # Copyright (c) 2011, 2015, 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 # Scan for all locale resources and extract for which locales there exists 27 # resources. Then put this meta information about exiting (supported?) locales 28 # into LocaleDataMetaInfo.java 29 30 # First go look for all locale files 31 LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/share/classes \ 32 -name "FormatData_*.java" -o -name "FormatData_*.properties" -o \ 33 -name "CollationData_*.java" -o -name "CollationData_*.properties" -o \ 34 -name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \ 35 -name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \ 36 -name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \ 37 -name "CalendarData_*.java" -o -name "CalendarData_*.properties" -o \ 38 -name "BreakIteratorInfo_*.java" -o -name "BreakIteratorRules_*.java") 39 40 # Then translate the locale files into for example: FormatData_sv 41 LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES))))) 42 43 # Include the list of resources found during the previous compile. 44 -include $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources 45 46 MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES)) 47 NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES)) 48 49 ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES)) 50 # There is a difference in the number of supported resources. Trigger a regeneration. 51 $(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java) 52 endif 53 54 # The EN locales 55 EN_LOCALES := en% 56 57 # ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files. 58 ALL_NON_EN_LOCALES := ja-JP-JP th-TH-TH 62 # This macro creates a sed expression that substitues for example: 63 # #FormatData_ENLocales# with: en% locales. 64 define CaptureLocale 65 $1_LOCALES := $$(subst _,-,$$(filter-out $1, $$(subst $1_,,$$(filter $1_%, $(LOCALE_RESOURCES))))) 66 $1_EN_LOCALES := $$(filter $(EN_LOCALES), $$($1_LOCALES)) 67 $1_NON_EN_LOCALES := $$(filter-out $(EN_LOCALES), $$($1_LOCALES)) 68 69 ALL_EN_LOCALES += $$($1_EN_LOCALES) 70 ALL_NON_EN_LOCALES += $$($1_NON_EN_LOCALES) 71 72 # Don't sed in a space if there are no locales. 73 SED_ARGS += -e 's/$$(HASH)$1_ENLocales$$(HASH)/$$(if $$($1_EN_LOCALES),$$(SPACE)$$($1_EN_LOCALES),)/g' 74 SED_ARGS += -e 's/$$(HASH)$1_NonENLocales$$(HASH)/$$(if $$($1_NON_EN_LOCALES),$$(SPACE)$$($1_NON_EN_LOCALES),)/g' 75 endef 76 77 #sun.text.resources.FormatData 78 $(eval $(call CaptureLocale,FormatData)) 79 80 #sun.text.resources.CollationData 81 $(eval $(call CaptureLocale,CollationData)) 82 83 #sun.text.resources.BreakIteratorInfo 84 $(eval $(call CaptureLocale,BreakIteratorInfo)) 85 86 #sun.text.resources.BreakIteratorRules 87 $(eval $(call CaptureLocale,BreakIteratorRules)) 88 89 #sun.util.resources.TimeZoneNames 90 $(eval $(call CaptureLocale,TimeZoneNames)) 91 92 #sun.util.resources.LocaleNames 93 $(eval $(call CaptureLocale,LocaleNames)) 94 95 #sun.util.resources.CurrencyNames 96 $(eval $(call CaptureLocale,CurrencyNames)) 97 98 #sun.util.resources.CalendarData 99 $(eval $(call CaptureLocale,CalendarData)) 100 101 SED_ARGS += -e 's/$(HASH)AvailableLocales_ENLocales$(HASH)/$(sort $(ALL_EN_LOCALES))/g' 102 SED_ARGS += -e 's/$(HASH)AvailableLocales_NonENLocales$(HASH)/$(sort $(ALL_NON_EN_LOCALES))/g' 103 104 $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java: \ 105 $(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template 106 $(MKDIR) -p $(@D) 107 $(ECHO) Creating sun/util/LocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources. |