jdk/makefiles/GensrcLocaleDataMetaInfo.gmk
author naoto
Tue, 21 Aug 2012 11:00:30 -0700
changeset 13583 dc0017b1a452
parent 12892 3ef14bab6254
child 14334 43556afc3c04
child 14231 a0c23c1c010f
permissions -rw-r--r--
6336885: RFE: Locale Data Deployment Enhancements 4609153: Provide locale data for Indic locales 5104387: Support for gl_ES locale (galician language) 6337471: desktop/system locale preferences support 7056139: (cal) SPI support for locale-dependent Calendar parameters 7058206: Provide CalendarData SPI for week params and display field value names 7073852: Support multiple scripts for digits and decimal symbols per locale 7079560: [Fmt-Da] Context dependent month names support in SimpleDateFormat 7171324: getAvailableLocales() of locale sensitive services should return the actual availability of locales 7151414: (cal) Support calendar type identification 7168528: LocaleServiceProvider needs to be aware of Locale extensions 7171372: (cal) locale's default Calendar should be created if unknown calendar is specified Summary: JEP 127: Improve Locale Data Packaging and Adopt Unicode CLDR Data (part 1 w/o packaging changes. by Naoto Sato and Masayoshi Okutsu) Reviewed-by: erikj, sherman, peytoia
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     1
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     2
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     4
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    10
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    15
# accompanied this code).
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    16
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    20
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    23
# questions.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    24
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    25
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    26
# Scan for all locale resources and extract for which locales there exists
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    27
# resources. Then put this meta information about exiting (supported?) locales
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    28
# into LocaleDataMetaInfo.java
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    29
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    30
# First go look for all locale files
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    31
LOCALE_FILES:=$(shell $(FIND) $(JDK_TOPDIR)/src/share/classes \
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    32
	-name "FormatData_*.java" -o -name "FormatData_*.properties" -o \
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    33
	-name "CollationData_*.java" -o -name "CollationData_*.properties" -o \
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    34
	-name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    35
	-name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    36
	-name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    37
	-name "CalendarData_*.java" -o -name "CalendarData_*.properties")
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    38
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    39
# Then translate the locale files into for example: FormatData_sv 
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    40
LOCALE_RESOURCES:=$(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    41
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    42
# Include the list of resources found during the previous compile.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    43
-include $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/_the.locale_resources
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    44
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    45
MISSING_RESOURCES:=$(filter-out $(LOCALE_RESOURCES),$(PREV_LOCALE_RESOURCES))
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    46
NEW_RESOURCES:=$(filter-out $(PREV_LOCALE_RESOURCES),$(LOCALE_RESOURCES))
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    47
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    48
ifneq (,$(MISSING_RESOURCES)$(NEW_RESOURCES))
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    49
    # There is a difference in the number of supported resources. Trigger a regeneration.
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    50
    $(shell $(RM) $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/locale/provider/LocaleDataMetaInfo.java)
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    51
endif
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    52
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    53
# The non-euro zone locales have to be separated from the euro-zone locales.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    54
NON_EURO_LOCALES:=ar% hi% iw% ja% ko% th% vi% zh%
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    55
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    56
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    57
ALL_NON_EURO_LOCALES:=ja-JP-JP th-TH-TH
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    58
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    59
SED_ARGS:=-e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    60
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    61
# This macro creates a sed expression that substitues for example:
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    62
# #FormatData_EuroLocales# with: be be_BY bg bg_BG ca ca_ES... and some more.
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    63
define CaptureLocale
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    64
    $1_LOCALES := $$(subst _,-,$$(filter-out $1,$$(subst $1_,,$$(filter $1_%,$(LOCALE_RESOURCES)))))
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    65
    $1_EURO_LOCALES := $$(filter-out $(NON_EURO_LOCALES),$$($1_LOCALES))
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    66
    $1_NON_EURO_LOCALES := $$(filter $(NON_EURO_LOCALES),$$($1_LOCALES))
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    67
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    68
    ALL_EURO_LOCALES += $$($1_EURO_LOCALES)
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    69
    ALL_NON_EURO_LOCALES += $$($1_NON_EURO_LOCALES)
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    70
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    71
    SED_ARGS+= -e 's/$$(HASH)$1_EuroLocales$$(HASH)/ $$($1_EURO_LOCALES)/g'
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    72
    SED_ARGS+= -e 's/$$(HASH)$1_NonEuroLocales$$(HASH)/ $$($1_NON_EURO_LOCALES)/g'
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    73
endef
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    74
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    75
#sun.text.resources.FormatData
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    76
$(eval $(call CaptureLocale,FormatData))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    77
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    78
#sun.text.resources.CollationData
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    79
$(eval $(call CaptureLocale,CollationData))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    80
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    81
#sun.util.resources.TimeZoneNames
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    82
$(eval $(call CaptureLocale,TimeZoneNames))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    83
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    84
#sun.util.resources.LocaleNames
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    85
$(eval $(call CaptureLocale,LocaleNames))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    86
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    87
#sun.util.resources.CurrencyNames
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    88
$(eval $(call CaptureLocale,CurrencyNames))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    89
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    90
#sun.util.resources.CalendarData
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    91
$(eval $(call CaptureLocale,CalendarData))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    92
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    93
SED_ARGS+= -e 's/$(HASH)AvailableLocales_EuroLocales$(HASH)/$(sort $(ALL_EURO_LOCALES))/g'
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    94
SED_ARGS+= -e 's/$(HASH)AvailableLocales_NonEuroLocales$(HASH)/$(sort $(ALL_NON_EURO_LOCALES))/g'
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    95
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    96
$(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/locale/provider/LocaleDataMetaInfo.java: \
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    97
		$(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
    98
	$(MKDIR) -p $(@D)
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    99
	$(ECHO) Creating sun/util/LocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   100
	$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/_the.locale_resources
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
   101
	$(SED) $(SED_ARGS) $< > $@
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   102
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
   103
GENSRC_LOCALEDATAMETAINFO:=$(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/locale/provider/LocaleDataMetaInfo.java
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   104
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   105
###
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   106
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   107
GENSRC_CRBC_DST := $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/CoreResourceBundleControl.java
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   108
GENSRC_CRBC_CMD := $(JDK_TOPDIR)/makefiles/scripts/localelist.sh
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   109
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   110
JRE_NONEXIST_LOCALES := en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   111
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   112
$(GENSRC_CRBC_DST) : $(JDK_TOPDIR)/src/share/classes/sun/util/CoreResourceBundleControl-XLocales.java.template \
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   113
                     $(GENSRC_CRBC_CMD)
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   114
	$(MKDIR) -p $(@D)
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   115
	NAWK="$(NAWK)" SED="$(SED)" $(SH) $(GENSRC_CRBC_CMD) "$(JRE_NONEXIST_LOCALES)" $< $@ 
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   116
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   117
GENSRC_LOCALEDATAMETAINFO += $(GENSRC_CRBC_DST)
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   118
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   119
###