1 #
   2 # Copyright (c) 2005, 2012, 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 #
  27 # This file defines rules to build the locales information for
  28 # resources in "sun.util.resources" & "sun.text.resources" packages
  29 #
  30 
  31 # Save the current FILES_java & FILES_compiled_properties variables
  32 
  33 FILES_java_orig := $(FILES_java)
  34 FILES_compiled_properties_orig := $(FILES_compiled_properties)
  35 
  36 
  37 # Since all the resources files are going to be compiled into class file format,
  38 # only FILES_java and FILES_compiled_properties variables will be picked up
  39 #
  40 # $(BUILDDIR)/java/util/FILES_java.gmk & $(BUILDDIR)/java/util/FILES_properties.gmk
  41 # contain "sun.util.resources" for EN language support
  42 
  43 include $(BUILDDIR)/java/util/FILES_java.gmk
  44 include $(BUILDDIR)/java/util/FILES_properties.gmk
  45 
  46 EN_Resources_java := $(FILES_java)
  47 EN_Resources_properties := $(FILES_compiled_properties)
  48 
  49 # $(BUILDDIR)/java/text/FILES_java.gmk contains the "sun.text.resources" for 
  50 # EN language support
  51 
  52 include $(BUILDDIR)/java/text/base/FILES_java.gmk
  53 
  54 EN_Resources_java += $(FILES_java)
  55 
  56 FILES_compiled_properties=
  57 
  58 # $(BUILDDIR)/sun/text/FILES_java.gmk & $(BUILDDIR)/sun/text/FILES_properties.gmk
  59 # contain both resources for Non-EN language support
  60 
  61 include $(BUILDDIR)/sun/text/FILES_java.gmk
  62 include $(BUILDDIR)/sun/text/FILES_properties.gmk
  63 
  64 NonEN_Resources_java := $(FILES_java)
  65 NonEN_Resources_properties := $(FILES_compiled_properties)
  66 
  67 # Restore the orignal FILES_java & FILES_compiled_properties variables
  68 FILES_java := $(FILES_java_orig)
  69 FILES_compiled_properties := $(FILES_compiled_properties_orig)
  70 
  71 LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
  72 LocaleDataMetaInfo_Dest=$(GENSRCDIR)/sun/util/locale/provider/LocaleDataMetaInfo.java
  73 LOCALEGEN_SH=localegen.sh
  74 RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames CalendarData"
  75 
  76 
  77 # On MacOSX sed does not enter a newline as it does on other platforms with the same pattern
  78 # Using awk instead
  79 
  80 ifeq ($(PLATFORM), macosx)
  81 
  82 $(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH)
  83         @$(RM) $@.tmp.en $@.tmp.nonen;
  84         @$(prep-target) 
  85         @$(ECHO) $(EN_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}'  > $@.tmp.en;
  86         @$(ECHO) $(EN_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.en;
  87         @$(ECHO) $(NonEN_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.nonen;
  88         @$(ECHO) $(NonEN_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.nonen;
  89         NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \
  90              $(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.en \
  91                 $@.tmp.nonen $< $@
  92         @$(RM) $@.tmp.en $@.tmp.nonen;
  93 
  94 else
  95 
  96 $(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH)
  97         @$(RM) $@.tmp.en $@.tmp.nonen;
  98         @$(prep-target) 
  99         @$(ECHO) $(subst .properties,'\n',$(EN_Resources_properties)) > $@.tmp.en;
 100         @$(ECHO) $(subst .java,'\n',$(EN_Resources_java)) >> $@.tmp.en;   
 101         @$(ECHO) $(subst .properties,'\n',$(NonEN_Resources_properties)) > $@.tmp.nonen;
 102         @$(ECHO) $(subst .java,'\n',$(NonEN_Resources_java)) >> $@.tmp.nonen;
 103         NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \
 104              $(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.en \
 105                 $@.tmp.nonen $< $@
 106         @$(RM) $@.tmp.en $@.tmp.nonen;
 107 endif
 108         
 109 genlocales : $(LocaleDataMetaInfo_Dest)  
 110 
 111 clean clobber::
 112         $(RM) $(LocaleDataMetaInfo_Dest)
 113