1 # 2 # Copyright (c) 2011, 2013, 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 # This file defines macros that sets up rules for generating java classes 27 # from resource bundle properties files. 28 29 ################################################################################ 30 # Helper macro for SetupCopy-zh_HK. 31 define SetupOneCopy-zh_HK 32 $1_$2_TARGET := $$(patsubst $(JDK_TOPDIR)/src/$(MODULE)/share/classes/%, \ 33 $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/%, \ 34 $$(subst _zh_TW,_zh_HK, $2)) 35 36 $$($1_$2_TARGET): $2 37 $(MKDIR) -p $$(@D) 38 $(CAT) $$< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $$@ 39 40 $1 += $$($1_$2_TARGET) 41 endef 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 # Creates a rule that runs CompileProperties on a set of properties files. 53 # Param 1 - Variable to add targets to, must not contain space 54 # Param 2 - Properties files to process 55 # Param 3 - The super class for the generated classes 56 define SetupCompileProperties 57 $1_SRCS := $2 58 $1_CLASS := $3 59 60 # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties 61 # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java 62 # Strip away prefix and suffix, leaving for example only: 63 # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN" 64 $1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \ 65 $(JDK_OUTPUTDIR)/gensrc/%, \ 66 $$(patsubst %.properties, %.java, \ 67 $$(subst /share/classes,, $$($1_SRCS)))) 68 69 # Generate the package dirs for the to be generated java files. Sort to remove 70 # duplicates. 71 $1_DIRS := $$(sort $$(dir $$($1_JAVAS))) 72 73 # Now generate a sequence of: 74 # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" 75 # suitable to be fed into the CompileProperties command. 76 $1_CMDLINE := $$(subst _SPACE_, $(SPACE), \ 77 $$(join $$(addprefix -compile_SPACE_, $$($1_SRCS)), \ 78 $$(addsuffix _SPACE_$$($1_CLASS), \ 79 $$(addprefix _SPACE_, $$($1_JAVAS))))) 80 81 $1_TARGET := $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.done 82 $1_CMDLINE_FILE := $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline 83 84 # Now setup the rule for the generation of the resource bundles. 85 $$($1_TARGET): $$($1_SRCS) $$($1_JAVAS) $(BUILD_TOOLS_JDK) 86 $(MKDIR) -p $$(@D) $$($1_DIRS) 87 $(ECHO) Compiling $$(words $$($1_SRCS)) properties into resource bundles for $(MODULE) 88 $(RM) $$($1_CMDLINE_FILE) 89 $$(call ListPathsSafely,$1_CMDLINE,\n, >> $$($1_CMDLINE_FILE)) 90 $(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE) 91 $(TOUCH) $$@ 92 93 $$($1_JAVAS): $$($1_SRCS) 94 95 # Create zh_HK versions of all zh_TW files created above 96 $$(eval $$(call SetupCopy-zh_HK,$1_HK,$$(filter %_zh_TW.java, $$($1_JAVAS)))) 97 # The zh_HK copy must wait for the compile properties tool to run 98 $$($1_HK): $$($1_TARGET) 99 100 $1 += $$($1_JAVAS) $$($1_TARGET) $$($1_HK) 101 endef 102 103 ################################################################################ | 1 # 2 # Copyright (c) 2011, 2014, 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 # This file defines macros that sets up rules for generating java classes 27 # from resource bundle properties files. 28 29 ################################################################################ 30 # Helper macro for SetupCopy-zh_HK. 31 define SetupOneCopy-zh_HK 32 $1_$2_TARGET := $$(patsubst $(JDK_TOPDIR)/src/$(MODULE)/share/classes/%, \ 33 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \ 34 $$(subst _zh_TW,_zh_HK, $2)) 35 36 $$($1_$2_TARGET): $2 37 $(MKDIR) -p $$(@D) 38 $(CAT) $$< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $$@ 39 40 $1 += $$($1_$2_TARGET) 41 endef 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 # Creates a rule that runs CompileProperties on a set of properties files. 53 # Param 1 - Variable to add targets to, must not contain space 54 # Param 2 - Properties files to process 55 # Param 3 - The super class for the generated classes 56 define SetupCompileProperties 57 $1_SRCS := $2 58 $1_CLASS := $3 59 60 # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties 61 # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java 62 # Strip away prefix and suffix, leaving for example only: 63 # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN" 64 $1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \ 65 $(SUPPORT_OUTPUTDIR)/gensrc/%, \ 66 $$(patsubst %.properties, %.java, \ 67 $$(subst /share/classes,, $$($1_SRCS)))) 68 69 # Generate the package dirs for the to be generated java files. Sort to remove 70 # duplicates. 71 $1_DIRS := $$(sort $$(dir $$($1_JAVAS))) 72 73 # Now generate a sequence of: 74 # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" 75 # suitable to be fed into the CompileProperties command. 76 $1_CMDLINE := $$(subst _SPACE_, $(SPACE), \ 77 $$(join $$(addprefix -compile_SPACE_, $$($1_SRCS)), \ 78 $$(addsuffix _SPACE_$$($1_CLASS), \ 79 $$(addprefix _SPACE_, $$($1_JAVAS))))) 80 81 $1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.done 82 $1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline 83 84 # Now setup the rule for the generation of the resource bundles. 85 $$($1_TARGET): $$($1_SRCS) $$($1_JAVAS) $(BUILD_TOOLS_JDK) 86 $(MKDIR) -p $$(@D) $$($1_DIRS) 87 $(ECHO) Compiling $$(words $$($1_SRCS)) properties into resource bundles for $(MODULE) 88 $(RM) $$($1_CMDLINE_FILE) 89 $$(call ListPathsSafely,$1_CMDLINE,\n, >> $$($1_CMDLINE_FILE)) 90 $(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE) 91 $(TOUCH) $$@ 92 93 $$($1_JAVAS): $$($1_SRCS) 94 95 # Create zh_HK versions of all zh_TW files created above 96 $$(eval $$(call SetupCopy-zh_HK,$1_HK,$$(filter %_zh_TW.java, $$($1_JAVAS)))) 97 # The zh_HK copy must wait for the compile properties tool to run 98 $$($1_HK): $$($1_TARGET) 99 100 $1 += $$($1_JAVAS) $$($1_TARGET) $$($1_HK) 101 endef 102 103 ################################################################################ |