jdk/makefiles/GensrcLocaleDataMetaInfo.gmk
author lana
Fri, 26 Jul 2013 14:08:37 -0700
changeset 19130 d14e77dc1e0a
parent 14427 8b159b688292
child 19837 6f1c611fb72c
permissions -rw-r--r--
Merge
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.
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13583
diff changeset
    43
-include $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
12317
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.
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13583
diff changeset
    50
    $(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/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
14334
43556afc3c04 8001231: Move locale data out of rt.jar (except the US locale)
naoto
parents: 13583
diff changeset
    53
# The US locales
43556afc3c04 8001231: Move locale data out of rt.jar (except the US locale)
naoto
parents: 13583
diff changeset
    54
US_LOCALES:=en en-US
12317
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.
14334
43556afc3c04 8001231: Move locale data out of rt.jar (except the US locale)
naoto
parents: 13583
diff changeset
    57
ALL_NON_US_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:
14334
43556afc3c04 8001231: Move locale data out of rt.jar (except the US locale)
naoto
parents: 13583
diff changeset
    62
# #FormatData_USLocales# with: en and/or en_US.
13583
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)))))
14334
43556afc3c04 8001231: Move locale data out of rt.jar (except the US locale)
naoto
parents: 13583
diff changeset
    65
    $1_US_LOCALES := $$(filter $(US_LOCALES),$$($1_LOCALES))
43556afc3c04 8001231: Move locale data out of rt.jar (except the US locale)
naoto
parents: 13583
diff changeset
    66
    $1_NON_US_LOCALES := $$(filter-out $(US_LOCALES),$$($1_LOCALES))
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    67
14334
43556afc3c04 8001231: Move locale data out of rt.jar (except the US locale)
naoto
parents: 13583
diff changeset
    68
    ALL_US_LOCALES += $$($1_US_LOCALES)
43556afc3c04 8001231: Move locale data out of rt.jar (except the US locale)
naoto
parents: 13583
diff changeset
    69
    ALL_NON_US_LOCALES += $$($1_NON_US_LOCALES)
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    70
14427
8b159b688292 8003177: build-infra: Compare reports diff in LocaleDataMetaInfo.class
tbell
parents: 14343
diff changeset
    71
    # Don't sed in a space if there are no locales.
8b159b688292 8003177: build-infra: Compare reports diff in LocaleDataMetaInfo.class
tbell
parents: 14343
diff changeset
    72
    SED_ARGS+= -e 's/$$(HASH)$1_USLocales$$(HASH)/$$(if $$($1_US_LOCALES),$$(SPACE)$$($1_US_LOCALES),)/g'
8b159b688292 8003177: build-infra: Compare reports diff in LocaleDataMetaInfo.class
tbell
parents: 14343
diff changeset
    73
    SED_ARGS+= -e 's/$$(HASH)$1_NonUSLocales$$(HASH)/$$(if $$($1_NON_US_LOCALES),$$(SPACE)$$($1_NON_US_LOCALES),)/g'
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    74
endef
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    75
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    76
#sun.text.resources.FormatData
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    77
$(eval $(call CaptureLocale,FormatData))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    78
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    79
#sun.text.resources.CollationData
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    80
$(eval $(call CaptureLocale,CollationData))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    81
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    82
#sun.util.resources.TimeZoneNames
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    83
$(eval $(call CaptureLocale,TimeZoneNames))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    84
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    85
#sun.util.resources.LocaleNames
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    86
$(eval $(call CaptureLocale,LocaleNames))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    87
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    88
#sun.util.resources.CurrencyNames
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    89
$(eval $(call CaptureLocale,CurrencyNames))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    90
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    91
#sun.util.resources.CalendarData
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    92
$(eval $(call CaptureLocale,CalendarData))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    93
14334
43556afc3c04 8001231: Move locale data out of rt.jar (except the US locale)
naoto
parents: 13583
diff changeset
    94
SED_ARGS+= -e 's/$(HASH)AvailableLocales_USLocales$(HASH)/$(sort $(ALL_US_LOCALES))/g'
43556afc3c04 8001231: Move locale data out of rt.jar (except the US locale)
naoto
parents: 13583
diff changeset
    95
SED_ARGS+= -e 's/$(HASH)AvailableLocales_NonUSLocales$(HASH)/$(sort $(ALL_NON_US_LOCALES))/g'
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    96
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13583
diff changeset
    97
$(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java: \
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
    98
		$(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
    99
	$(MKDIR) -p $(@D)
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   100
	$(ECHO) Creating sun/util/LocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13583
diff changeset
   101
	$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 12892
diff changeset
   102
	$(SED) $(SED_ARGS) $< > $@
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   103
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13583
diff changeset
   104
GENSRC_LOCALEDATAMETAINFO:=$(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java
12892
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
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13583
diff changeset
   108
GENSRC_CRBC_DST := $(JDK_OUTPUTDIR)/gensrc/sun/util/CoreResourceBundleControl.java
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   109
GENSRC_CRBC_CMD := $(JDK_TOPDIR)/makefiles/scripts/localelist.sh
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   110
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   111
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
   112
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   113
$(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
   114
                     $(GENSRC_CRBC_CMD)
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   115
	$(MKDIR) -p $(@D)
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   116
	NAWK="$(NAWK)" SED="$(SED)" $(SH) $(GENSRC_CRBC_CMD) "$(JRE_NONEXIST_LOCALES)" $< $@ 
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   117
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   118
GENSRC_LOCALEDATAMETAINFO += $(GENSRC_CRBC_DST)
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   119
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents: 12317
diff changeset
   120
###