25 26 # Scan for all locale resources and extract for which locales there exists 27 # resources. Then put this meta information about existing (supported?) locales 28 # into LocaleDataMetaInfo.java 29 30 # First go look for all locale files 31 LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/java.base/share/classes \ 32 $(JDK_TOPDIR)/src/jdk.localedata/share/classes \ 33 -name "FormatData_*.java" -o -name "FormatData_*.properties" -o \ 34 -name "CollationData_*.java" -o -name "CollationData_*.properties" -o \ 35 -name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \ 36 -name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \ 37 -name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \ 38 -name "CalendarData_*.java" -o -name "CalendarData_*.properties" -o \ 39 -name "BreakIteratorInfo_*.java" -o -name "BreakIteratorRules_*.java") 40 41 # Then translate the locale files into for example: FormatData_sv 42 LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES))))) 43 44 # Include the list of resources found during the previous compile. 45 -include $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_the.locale_resources 46 47 MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES)) 48 NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES)) 49 50 ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES)) 51 # There is a difference in the number of supported resources. Trigger a regeneration. 52 $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/LocaleDataMetaInfo.java) 53 endif 54 55 # The EN locales 56 EN_LOCALES := en% 57 58 # Locales that don't have any resource files should be included here. 59 ALL_NON_EN_LOCALES := ja-JP-JP nb-NO nn-NO th-TH-TH 60 61 SED_ENARGS := -e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g' 62 SED_NONENARGS := $(SED_ENARGS) 63 64 # Fill in the languages and package names 65 SED_ENARGS += -e 's/$(HASH)Lang$(HASH)/En/' \ 66 -e 's/$(HASH)Package$(HASH)/sun.util.locale.provider/' 67 SED_NONENARGS += -e 's/$(HASH)Lang$(HASH)/NonEn/' \ 68 -e 's/$(HASH)Package$(HASH)/sun.util.resources.provider/' 69 70 # This macro creates a sed expression that substitues for example: 71 # #FormatData_ENLocales# with: en% locales. 72 define CaptureLocale 73 $1_LOCALES := $$(subst _,-,$$(filter-out $1, $$(subst $1_,,$$(filter $1_%, $(LOCALE_RESOURCES))))) 74 $1_EN_LOCALES := $$(filter $(EN_LOCALES), $$($1_LOCALES)) 75 $1_NON_EN_LOCALES := $$(filter-out $(EN_LOCALES), $$($1_LOCALES)) 76 77 # Special handling for Chinese locales to include implicit scripts 78 $1_NON_EN_LOCALES := $$(subst zh-CN,zh-CN$$(SPACE)zh-Hans-CN, $$($1_NON_EN_LOCALES)) 79 $1_NON_EN_LOCALES := $$(subst zh-SG,zh-SG$$(SPACE)zh-Hans-SG, $$($1_NON_EN_LOCALES)) 80 $1_NON_EN_LOCALES := $$(subst zh-HK,zh-HK$$(SPACE)zh-Hant-HK, $$($1_NON_EN_LOCALES)) 81 $1_NON_EN_LOCALES := $$(subst zh-MO,zh-MO$$(SPACE)zh-Hant-MO, $$($1_NON_EN_LOCALES)) 82 $1_NON_EN_LOCALES := $$(subst zh-TW,zh-TW$$(SPACE)zh-Hant-TW, $$($1_NON_EN_LOCALES)) 83 84 ALL_EN_LOCALES += $$($1_EN_LOCALES) 85 ALL_NON_EN_LOCALES += $$($1_NON_EN_LOCALES) 86 87 # Don't sed in a space if there are no locales. 88 SED_ENARGS += -e 's/$$(HASH)$1_Locales$$(HASH)/$$(if $$($1_EN_LOCALES),$$(SPACE)$$($1_EN_LOCALES),)/g' 89 SED_NONENARGS += -e 's/$$(HASH)$1_Locales$$(HASH)/$$(if $$($1_NON_EN_LOCALES),$$(SPACE)$$($1_NON_EN_LOCALES),)/g' 90 endef 91 92 #sun.text.resources.FormatData 93 $(eval $(call CaptureLocale,FormatData)) 94 95 #sun.text.resources.CollationData 96 $(eval $(call CaptureLocale,CollationData)) 97 98 #sun.text.resources.BreakIteratorInfo 99 $(eval $(call CaptureLocale,BreakIteratorInfo)) 100 101 #sun.text.resources.BreakIteratorRules 102 $(eval $(call CaptureLocale,BreakIteratorRules)) 103 104 #sun.util.resources.TimeZoneNames 105 $(eval $(call CaptureLocale,TimeZoneNames)) 106 107 #sun.util.resources.LocaleNames 108 $(eval $(call CaptureLocale,LocaleNames)) 109 110 #sun.util.resources.CurrencyNames 111 $(eval $(call CaptureLocale,CurrencyNames)) 112 113 #sun.util.resources.CalendarData 114 $(eval $(call CaptureLocale,CalendarData)) 115 116 SED_ENARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_EN_LOCALES))/g' 117 SED_NONENARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_NON_EN_LOCALES))/g' 118 119 $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java: \ 120 $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template 121 $(MKDIR) -p $(@D) 122 $(ECHO) Creating sun/util/locale/provider/EnLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources. 123 $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \ 124 > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources 125 $(SED) $(SED_ENARGS) $< > $@ 126 127 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java: \ 128 $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template 129 $(MKDIR) -p $(@D) 130 $(ECHO) Creating sun/util/resources/provider/NonEnLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources. 131 $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \ 132 > $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/_the.locale_resources 133 $(SED) $(SED_NONENARGS) $< > $@ 134 135 GENSRC_BASELOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java 136 GENSRC_LOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java 137 138 ################################################################################ 139 140 GENSRC_CRBC_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/CoreResourceBundleControl.java 141 GENSRC_CRBC_CMD := $(JDK_TOPDIR)/make/scripts/localelist.sh 142 143 JRE_NONEXIST_LOCALES := en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh 144 145 $(GENSRC_CRBC_DST): $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/CoreResourceBundleControl-XLocales.java.template \ 146 $(GENSRC_CRBC_CMD) 147 $(MKDIR) -p $(@D) 148 NAWK="$(NAWK)" SED="$(SED)" $(SH) $(GENSRC_CRBC_CMD) "$(JRE_NONEXIST_LOCALES)" $< $@ 149 150 GENSRC_BASELOCALEDATA += $(GENSRC_CRBC_DST) 151 GENSRC_JAVA_BASE += $(GENSRC_BASELOCALEDATA) 152 GENSRC_JDK_LOCALEDATA += $(GENSRC_LOCALEDATA) 153 154 ################################################################################ | 25 26 # Scan for all locale resources and extract for which locales there exists 27 # resources. Then put this meta information about existing (supported?) locales 28 # into LocaleDataMetaInfo.java 29 30 # First go look for all locale files 31 LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/java.base/share/classes \ 32 $(JDK_TOPDIR)/src/jdk.localedata/share/classes \ 33 -name "FormatData_*.java" -o -name "FormatData_*.properties" -o \ 34 -name "CollationData_*.java" -o -name "CollationData_*.properties" -o \ 35 -name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \ 36 -name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \ 37 -name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \ 38 -name "CalendarData_*.java" -o -name "CalendarData_*.properties" -o \ 39 -name "BreakIteratorInfo_*.java" -o -name "BreakIteratorRules_*.java") 40 41 # Then translate the locale files into for example: FormatData_sv 42 LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES))))) 43 44 # Include the list of resources found during the previous compile. 45 -include $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources 46 47 MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES)) 48 NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES)) 49 50 ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES)) 51 # There is a difference in the number of supported resources. Trigger a regeneration. 52 $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java \ 53 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java \ 54 $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java \ 55 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo_jdk_localedata.java) 56 endif 57 58 # The base locales 59 BASE_LOCALES := en en-US 60 61 # Locales that don't have any resource files should be included here. 62 ALL_NON_BASE_LOCALES := ja-JP-JP nb-NO nn-NO th-TH-TH 63 64 SED_BASEARGS := -e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g' 65 SED_NONBASEARGS := $(SED_BASEARGS) 66 67 # Fill in the languages and package names 68 SED_BASEARGS += -e 's/$(HASH)Lang$(HASH)/Base/' \ 69 -e 's/$(HASH)Package$(HASH)/sun.util.locale.provider/' 70 SED_NONBASEARGS += -e 's/$(HASH)Lang$(HASH)/NonBase/' \ 71 -e 's/$(HASH)Package$(HASH)/sun.util.resources.provider/' 72 73 # This macro creates a sed expression that substitues for example: 74 # #FormatData_Locales# with: en-US locales. 75 define CaptureLocale 76 $1_LOCALES := $$(subst _,-,$$(filter-out $1, $$(subst $1_,,$$(filter $1_%, $(LOCALE_RESOURCES))))) 77 $1_BASE_LOCALES := $$(filter $(BASE_LOCALES), $$($1_LOCALES)) 78 $1_NON_BASE_LOCALES := $$(filter-out $(BASE_LOCALES), $$($1_LOCALES)) 79 80 # Special handling for Chinese locales to include implicit scripts 81 $1_NON_BASE_LOCALES := $$(subst zh-CN,zh-CN$$(SPACE)zh-Hans-CN, $$($1_NON_BASE_LOCALES)) 82 $1_NON_BASE_LOCALES := $$(subst zh-SG,zh-SG$$(SPACE)zh-Hans-SG, $$($1_NON_BASE_LOCALES)) 83 $1_NON_BASE_LOCALES := $$(subst zh-HK,zh-HK$$(SPACE)zh-Hant-HK, $$($1_NON_BASE_LOCALES)) 84 $1_NON_BASE_LOCALES := $$(subst zh-MO,zh-MO$$(SPACE)zh-Hant-MO, $$($1_NON_BASE_LOCALES)) 85 $1_NON_BASE_LOCALES := $$(subst zh-TW,zh-TW$$(SPACE)zh-Hant-TW, $$($1_NON_BASE_LOCALES)) 86 87 ALL_BASE_LOCALES += $$($1_BASE_LOCALES) 88 ALL_NON_BASE_LOCALES += $$($1_NON_BASE_LOCALES) 89 90 # Don't sed in a space if there are no locales. 91 SED_BASEARGS += -e 's/$$(HASH)$1_Locales$$(HASH)/$$(if $$($1_BASE_LOCALES),$$(SPACE)$$($1_BASE_LOCALES),)/g' 92 SED_NONBASEARGS += -e 's/$$(HASH)$1_Locales$$(HASH)/$$(if $$($1_NON_BASE_LOCALES),$$(SPACE)$$($1_NON_BASE_LOCALES),)/g' 93 endef 94 95 #sun.text.resources.FormatData 96 $(eval $(call CaptureLocale,FormatData)) 97 98 #sun.text.resources.CollationData 99 $(eval $(call CaptureLocale,CollationData)) 100 101 #sun.text.resources.BreakIteratorInfo 102 $(eval $(call CaptureLocale,BreakIteratorInfo)) 103 104 #sun.text.resources.BreakIteratorRules 105 $(eval $(call CaptureLocale,BreakIteratorRules)) 106 107 #sun.util.resources.TimeZoneNames 108 $(eval $(call CaptureLocale,TimeZoneNames)) 109 110 #sun.util.resources.LocaleNames 111 $(eval $(call CaptureLocale,LocaleNames)) 112 113 #sun.util.resources.CurrencyNames 114 $(eval $(call CaptureLocale,CurrencyNames)) 115 116 #sun.util.resources.CalendarData 117 $(eval $(call CaptureLocale,CalendarData)) 118 119 SED_BASEARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_BASE_LOCALES))/g' 120 SED_NONBASEARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_NON_BASE_LOCALES))/g' 121 122 $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java: \ 123 $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template 124 $(MKDIR) -p $(@D) 125 $(ECHO) Creating sun/util/locale/provider/BaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources. 126 $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \ 127 > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources 128 $(SED) $(SED_BASEARGS) $< > $@ 129 130 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java: \ 131 $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template 132 $(MKDIR) -p $(@D) 133 $(ECHO) Creating sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources. 134 $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \ 135 > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources 136 $(SED) $(SED_NONBASEARGS) $< > $@ 137 138 GENSRC_BASELOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java 139 GENSRC_LOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java 140 141 ################################################################################ 142 143 GENSRC_CRBC_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/CoreResourceBundleControl.java 144 GENSRC_CRBC_CMD := $(JDK_TOPDIR)/make/scripts/localelist.sh 145 146 JRE_NONEXIST_LOCALES := en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh 147 148 $(GENSRC_CRBC_DST): $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/CoreResourceBundleControl-XLocales.java.template \ 149 $(GENSRC_CRBC_CMD) 150 $(MKDIR) -p $(@D) 151 NAWK="$(NAWK)" SED="$(SED)" $(SH) $(GENSRC_CRBC_CMD) "$(JRE_NONEXIST_LOCALES)" $< $@ 152 153 GENSRC_BASELOCALEDATA += $(GENSRC_CRBC_DST) 154 GENSRC_JAVA_BASE += $(GENSRC_BASELOCALEDATA) 155 GENSRC_JDK_LOCALEDATA += $(GENSRC_LOCALEDATA) 156 157 ################################################################################ |