< prev index next >

make/gensrc/GensrcProperties.gmk

Print this page


   1 #
   2 # Copyright (c) 2011, 2015, 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


  42 
  43 ################################################################################
  44 # Creates rules for copying zh_TW resources to zh_HK.
  45 # Param 1 - Variable to add targets to
  46 # Param 2 - Files to copy from
  47 define SetupCopy-zh_HK
  48   $$(foreach f, $2, $$(eval $$(call SetupOneCopy-zh_HK,$1,$$f)))
  49 endef
  50 
  51 ################################################################################
  52 # Setup make rules that runs CompileProperties on a set of properties files.
  53 #
  54 # Parameter 1 is the name of the rule. This name is used as variable prefix,
  55 # and the targets generated are listed in a variable by that name.
  56 #
  57 # Remaining parameters are named arguments. These include:
  58 # SRC_DIRS   Directories containing properties files to process.
  59 # EXCLUDE   Exclude files matching this pattern.
  60 # CLASS   The super class for the generated classes.
  61 # MODULE_PATH_ROOT   Module path root, defaults to $(TOPDIR)/src.

  62 SetupCompileProperties = $(NamedParamsMacroTemplate)
  63 define SetupCompilePropertiesBody
  64   # Set default value unless overridden
  65   ifeq ($$($1_MODULE_PATH_ROOT), )
  66     $1_MODULE_PATH_ROOT := $(TOPDIR)/src
  67   endif
  68 
  69   # Locate all properties files in the given source dirs.
  70   $1_SRC_FILES := $$(filter %.properties, $$(call CacheFind, $$($1_SRC_DIRS)))
  71 
  72   ifneq ($$($1_EXCLUDE), )
  73     $1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES))
  74   endif
  75 





  76   # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
  77   # to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
  78   # Strip away prefix and suffix, leaving for example only:
  79   # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
  80   $1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
  81       $(SUPPORT_OUTPUTDIR)/gensrc/%, \
  82       $$(patsubst %.properties, %.java, \
  83       $$(subst /$(OPENJDK_TARGET_OS)/classes,, \
  84       $$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \
  85       $$(subst /share/classes,, $$($1_SRC_FILES))))))
  86 
  87   # Generate the package dirs for the to be generated java files. Sort to remove
  88   # duplicates.
  89   $1_DIRS := $$(sort $$(dir $$($1_JAVAS)))
  90 
  91   # Now generate a sequence of:
  92   # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
  93   # suitable to be fed into the CompileProperties command.
  94   $1_CMDLINE := $$(subst _SPACE_, $(SPACE), \
  95       $$(join $$(addprefix -compile_SPACE_, $$($1_SRC_FILES)), \
  96       $$(addsuffix _SPACE_$$($1_CLASS), \
  97       $$(addprefix _SPACE_, $$($1_JAVAS)))))
  98 
  99   $1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.marker
 100   $1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
 101 
 102 # Now setup the rule for the generation of the resource bundles.
 103   $$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
 104         $(MKDIR) -p $$(@D) $$($1_DIRS)
 105         $(ECHO) Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE)
 106         $$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE)))
 107         $(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)
 108         $(TOUCH) $$@
 109 
 110   $$($1_JAVAS): $$($1_SRC_FILES)
 111 
 112   # Create zh_HK versions of all zh_TW files created above
 113   $$(eval $$(call SetupCopy-zh_HK,$1_HK,$$(filter %_zh_TW.java, $$($1_JAVAS))))
 114   # The zh_HK copy must wait for the compile properties tool to run
 115   $$($1_HK): $$($1_TARGET)
 116 
 117   $1 += $$($1_JAVAS) $$($1_TARGET) $$($1_HK)
 118 endef
 119 
 120 ################################################################################
   1 #
   2 # Copyright (c) 2011, 2018, 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


  42 
  43 ################################################################################
  44 # Creates rules for copying zh_TW resources to zh_HK.
  45 # Param 1 - Variable to add targets to
  46 # Param 2 - Files to copy from
  47 define SetupCopy-zh_HK
  48   $$(foreach f, $2, $$(eval $$(call SetupOneCopy-zh_HK,$1,$$f)))
  49 endef
  50 
  51 ################################################################################
  52 # Setup make rules that runs CompileProperties on a set of properties files.
  53 #
  54 # Parameter 1 is the name of the rule. This name is used as variable prefix,
  55 # and the targets generated are listed in a variable by that name.
  56 #
  57 # Remaining parameters are named arguments. These include:
  58 # SRC_DIRS   Directories containing properties files to process.
  59 # EXCLUDE   Exclude files matching this pattern.
  60 # CLASS   The super class for the generated classes.
  61 # MODULE_PATH_ROOT   Module path root, defaults to $(TOPDIR)/src.
  62 # KEEP_ALL_TRANSLATIONS Set to true to skip filtering of excluded translations.
  63 SetupCompileProperties = $(NamedParamsMacroTemplate)
  64 define SetupCompilePropertiesBody
  65   # Set default value unless overridden
  66   ifeq ($$($1_MODULE_PATH_ROOT), )
  67     $1_MODULE_PATH_ROOT := $(TOPDIR)/src
  68   endif
  69 
  70   # Locate all properties files in the given source dirs.
  71   $1_SRC_FILES := $$(filter %.properties, $$(call CacheFind, $$($1_SRC_DIRS)))
  72 
  73   ifneq ($$($1_EXCLUDE), )
  74     $1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES))
  75   endif
  76 
  77   # Filter out any excluded translations
  78   ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
  79     $1_SRC_FILES := $$(call FilterExcludedTranslations, $$($1_SRC_FILES), .properties)
  80   endif
  81 
  82   # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
  83   # to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java


  84   $1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
  85       $(SUPPORT_OUTPUTDIR)/gensrc/%, \
  86       $$(patsubst %.properties, %.java, \
  87       $$(subst /$(OPENJDK_TARGET_OS)/classes,, \
  88       $$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \
  89       $$(subst /share/classes,, $$($1_SRC_FILES))))))
  90 
  91   # Generate the package dirs for the to be generated java files. Sort to remove
  92   # duplicates.
  93   $1_DIRS := $$(sort $$(dir $$($1_JAVAS)))
  94 
  95   # Now generate a sequence of:
  96   # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
  97   # suitable to be fed into the CompileProperties command.
  98   $1_CMDLINE := $$(subst _SPACE_, $(SPACE), \
  99       $$(join $$(addprefix -compile_SPACE_, $$($1_SRC_FILES)), \
 100       $$(addsuffix _SPACE_$$($1_CLASS), \
 101       $$(addprefix _SPACE_, $$($1_JAVAS)))))
 102 
 103   $1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.marker
 104   $1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
 105 
 106   # Now setup the rule for the generation of the resource bundles.
 107   $$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
 108         $(MKDIR) -p $$(@D) $$($1_DIRS)
 109         $(ECHO) Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE)
 110         $$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE)))
 111         $(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)
 112         $(TOUCH) $$@
 113 
 114   $$($1_JAVAS): $$($1_SRC_FILES)
 115 
 116   # Create zh_HK versions of all zh_TW files created above
 117   $$(eval $$(call SetupCopy-zh_HK,$1_HK,$$(filter %_zh_TW.java, $$($1_JAVAS))))
 118   # The zh_HK copy must wait for the compile properties tool to run
 119   $$($1_HK): $$($1_TARGET)
 120 
 121   $1 += $$($1_JAVAS) $$($1_TARGET) $$($1_HK)
 122 endef
 123 
 124 ################################################################################
< prev index next >