26 # Scan for all locale resources and extract for which locales there exists |
26 # Scan for all locale resources and extract for which locales there exists |
27 # resources. Then put this meta information about exiting (supported?) locales |
27 # resources. Then put this meta information about exiting (supported?) locales |
28 # into LocaleDataMetaInfo.java |
28 # into LocaleDataMetaInfo.java |
29 |
29 |
30 # First go look for all locale files |
30 # First go look for all locale files |
31 LOCALE_FILES:=$(shell $(FIND) $(JDK_TOPDIR)/src/share/classes \ |
31 LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/share/classes \ |
32 -name "FormatData_*.java" -o -name "FormatData_*.properties" -o \ |
32 -name "FormatData_*.java" -o -name "FormatData_*.properties" -o \ |
33 -name "CollationData_*.java" -o -name "CollationData_*.properties" -o \ |
33 -name "CollationData_*.java" -o -name "CollationData_*.properties" -o \ |
34 -name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \ |
34 -name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \ |
35 -name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \ |
35 -name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \ |
36 -name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \ |
36 -name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \ |
37 -name "CalendarData_*.java" -o -name "CalendarData_*.properties") |
37 -name "CalendarData_*.java" -o -name "CalendarData_*.properties") |
38 |
38 |
39 # Then translate the locale files into for example: FormatData_sv |
39 # Then translate the locale files into for example: FormatData_sv |
40 LOCALE_RESOURCES:=$(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES))))) |
40 LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES))))) |
41 |
41 |
42 # Include the list of resources found during the previous compile. |
42 # Include the list of resources found during the previous compile. |
43 -include $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources |
43 -include $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources |
44 |
44 |
45 MISSING_RESOURCES:=$(filter-out $(LOCALE_RESOURCES),$(PREV_LOCALE_RESOURCES)) |
45 MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES)) |
46 NEW_RESOURCES:=$(filter-out $(PREV_LOCALE_RESOURCES),$(LOCALE_RESOURCES)) |
46 NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES)) |
47 |
47 |
48 ifneq (,$(MISSING_RESOURCES)$(NEW_RESOURCES)) |
48 ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES)) |
49 # There is a difference in the number of supported resources. Trigger a regeneration. |
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) |
50 $(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java) |
51 endif |
51 endif |
52 |
52 |
53 # The EN locales |
53 # The EN locales |
54 EN_LOCALES:=en% |
54 EN_LOCALES := en% |
55 |
55 |
56 # ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files. |
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 |
57 ALL_NON_EN_LOCALES := ja-JP-JP th-TH-TH |
58 |
58 |
59 SED_ARGS:=-e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g' |
59 SED_ARGS := -e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g' |
60 |
60 |
61 # This macro creates a sed expression that substitues for example: |
61 # This macro creates a sed expression that substitues for example: |
62 # #FormatData_ENLocales# with: en% locales. |
62 # #FormatData_ENLocales# with: en% locales. |
63 define CaptureLocale |
63 define CaptureLocale |
64 $1_LOCALES := $$(subst _,-,$$(filter-out $1,$$(subst $1_,,$$(filter $1_%,$(LOCALE_RESOURCES))))) |
64 $1_LOCALES := $$(subst _,-,$$(filter-out $1, $$(subst $1_,,$$(filter $1_%, $(LOCALE_RESOURCES))))) |
65 $1_EN_LOCALES := $$(filter $(EN_LOCALES),$$($1_LOCALES)) |
65 $1_EN_LOCALES := $$(filter $(EN_LOCALES), $$($1_LOCALES)) |
66 $1_NON_EN_LOCALES := $$(filter-out $(EN_LOCALES),$$($1_LOCALES)) |
66 $1_NON_EN_LOCALES := $$(filter-out $(EN_LOCALES), $$($1_LOCALES)) |
67 |
67 |
68 ALL_EN_LOCALES += $$($1_EN_LOCALES) |
68 ALL_EN_LOCALES += $$($1_EN_LOCALES) |
69 ALL_NON_EN_LOCALES += $$($1_NON_EN_LOCALES) |
69 ALL_NON_EN_LOCALES += $$($1_NON_EN_LOCALES) |
70 |
70 |
71 # Don't sed in a space if there are no locales. |
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' |
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' |
73 SED_ARGS += -e 's/$$(HASH)$1_NonENLocales$$(HASH)/$$(if $$($1_NON_EN_LOCALES),$$(SPACE)$$($1_NON_EN_LOCALES),)/g' |
74 endef |
74 endef |
75 |
75 |
76 #sun.text.resources.FormatData |
76 #sun.text.resources.FormatData |
77 $(eval $(call CaptureLocale,FormatData)) |
77 $(eval $(call CaptureLocale,FormatData)) |
78 |
78 |
89 $(eval $(call CaptureLocale,CurrencyNames)) |
89 $(eval $(call CaptureLocale,CurrencyNames)) |
90 |
90 |
91 #sun.util.resources.CalendarData |
91 #sun.util.resources.CalendarData |
92 $(eval $(call CaptureLocale,CalendarData)) |
92 $(eval $(call CaptureLocale,CalendarData)) |
93 |
93 |
94 SED_ARGS+= -e 's/$(HASH)AvailableLocales_ENLocales$(HASH)/$(sort $(ALL_EN_LOCALES))/g' |
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' |
95 SED_ARGS += -e 's/$(HASH)AvailableLocales_NonENLocales$(HASH)/$(sort $(ALL_NON_EN_LOCALES))/g' |
96 |
96 |
97 $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java: \ |
97 $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java: \ |
98 $(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template |
98 $(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template |
99 $(MKDIR) -p $(@D) |
99 $(MKDIR) -p $(@D) |
100 $(ECHO) Creating sun/util/LocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources. |
100 $(ECHO) Creating sun/util/LocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources. |
101 $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources |
101 $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources |
102 $(SED) $(SED_ARGS) $< > $@ |
102 $(SED) $(SED_ARGS) $< > $@ |
103 |
103 |
104 GENSRC_LOCALEDATAMETAINFO:=$(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java |
104 GENSRC_LOCALEDATAMETAINFO := $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java |
105 |
105 |
106 ### |
106 ### |
107 |
107 |
108 GENSRC_CRBC_DST := $(JDK_OUTPUTDIR)/gensrc/sun/util/CoreResourceBundleControl.java |
108 GENSRC_CRBC_DST := $(JDK_OUTPUTDIR)/gensrc/sun/util/CoreResourceBundleControl.java |
109 GENSRC_CRBC_CMD := $(JDK_TOPDIR)/makefiles/scripts/localelist.sh |
109 GENSRC_CRBC_CMD := $(JDK_TOPDIR)/makefiles/scripts/localelist.sh |
110 |
110 |
111 JRE_NONEXIST_LOCALES := en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh |
111 JRE_NONEXIST_LOCALES := en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh |
112 |
112 |
113 $(GENSRC_CRBC_DST) : $(JDK_TOPDIR)/src/share/classes/sun/util/CoreResourceBundleControl-XLocales.java.template \ |
113 $(GENSRC_CRBC_DST): $(JDK_TOPDIR)/src/share/classes/sun/util/CoreResourceBundleControl-XLocales.java.template \ |
114 $(GENSRC_CRBC_CMD) |
114 $(GENSRC_CRBC_CMD) |
115 $(MKDIR) -p $(@D) |
115 $(MKDIR) -p $(@D) |
116 NAWK="$(NAWK)" SED="$(SED)" $(SH) $(GENSRC_CRBC_CMD) "$(JRE_NONEXIST_LOCALES)" $< $@ |
116 NAWK="$(NAWK)" SED="$(SED)" $(SH) $(GENSRC_CRBC_CMD) "$(JRE_NONEXIST_LOCALES)" $< $@ |
117 |
117 |
118 GENSRC_LOCALEDATAMETAINFO += $(GENSRC_CRBC_DST) |
118 GENSRC_LOCALEDATAMETAINFO += $(GENSRC_CRBC_DST) |
119 |
119 |
120 ### |
120 ### |