author | jjg |
Fri, 22 Nov 2019 16:26:35 -0800 | |
changeset 59232 | d4ddf19c2624 |
parent 54380 | e297c7bb6469 |
permissions | -rw-r--r-- |
12317
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
1 |
# |
54380 | 2 |
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
12317
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 |
|
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
26 |
# This file defines macros that sets up rules for generating java classes |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
27 |
# from resource bundle properties files. |
12317
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
28 |
|
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
29 |
################################################################################ |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
30 |
# Helper macro for SetupCopy-zh_HK. |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
31 |
define SetupOneCopy-zh_HK |
47217 | 32 |
$1_$2_TARGET := $$(patsubst $(TOPDIR)/src/$(MODULE)/share/classes/%, \ |
27565 | 33 |
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \ |
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
34 |
$$(subst _zh_TW,_zh_HK, $2)) |
12317
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
35 |
|
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
36 |
$$($1_$2_TARGET): $2 |
52065
dea8a62cdfc3
8211724: Change mkdir -p to MakeDir macro where possible
erikj
parents:
50590
diff
changeset
|
37 |
$$(call MakeTargetDir) |
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
38 |
$(CAT) $$< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $$@ |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
39 |
|
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
40 |
$1 += $$($1_$2_TARGET) |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
41 |
endef |
12317
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
42 |
|
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
43 |
################################################################################ |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
44 |
# Creates rules for copying zh_TW resources to zh_HK. |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
45 |
# Param 1 - Variable to add targets to |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
46 |
# Param 2 - Files to copy from |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
47 |
define SetupCopy-zh_HK |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
48 |
$$(foreach f, $2, $$(eval $$(call SetupOneCopy-zh_HK,$1,$$f))) |
12317
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
49 |
endef |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
50 |
|
23236
7c5997f59e20
8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents:
23010
diff
changeset
|
51 |
################################################################################ |
33669
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
52 |
# Setup make rules that runs CompileProperties on a set of properties files. |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
53 |
# |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
54 |
# Parameter 1 is the name of the rule. This name is used as variable prefix, |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
55 |
# and the targets generated are listed in a variable by that name. |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
56 |
# |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
57 |
# Remaining parameters are named arguments. These include: |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
58 |
# SRC_DIRS Directories containing properties files to process. |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
59 |
# EXCLUDE Exclude files matching this pattern. |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
60 |
# CLASS The super class for the generated classes. |
47217 | 61 |
# MODULE_PATH_ROOT Module path root, defaults to $(TOPDIR)/src. |
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47217
diff
changeset
|
62 |
# KEEP_ALL_TRANSLATIONS Set to true to skip filtering of excluded translations. |
33669
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
63 |
SetupCompileProperties = $(NamedParamsMacroTemplate) |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
64 |
define SetupCompilePropertiesBody |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
65 |
# Set default value unless overridden |
29096
e91fff38083a
8073498: Enhance GensrcProperties.gmk to allow an alternative source root
erikj
parents:
27799
diff
changeset
|
66 |
ifeq ($$($1_MODULE_PATH_ROOT), ) |
47217 | 67 |
$1_MODULE_PATH_ROOT := $(TOPDIR)/src |
29096
e91fff38083a
8073498: Enhance GensrcProperties.gmk to allow an alternative source root
erikj
parents:
27799
diff
changeset
|
68 |
endif |
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
69 |
|
33669
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
70 |
# Locate all properties files in the given source dirs. |
54380 | 71 |
$1_SRC_FILES := $$(call FindFiles, $$($1_SRC_DIRS), *.properties) |
33669
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
72 |
|
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
73 |
ifneq ($$($1_EXCLUDE), ) |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
74 |
$1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES)) |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
75 |
endif |
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
76 |
|
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47217
diff
changeset
|
77 |
# Filter out any excluded translations |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47217
diff
changeset
|
78 |
ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true) |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47217
diff
changeset
|
79 |
$1_SRC_FILES := $$(call FilterExcludedTranslations, $$($1_SRC_FILES), .properties) |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47217
diff
changeset
|
80 |
endif |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47217
diff
changeset
|
81 |
|
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
82 |
# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties |
27753
a6c284fa0745
8065412: generated source to compile .properties file incorreectly includes the module name in the package name
erikj
parents:
27088
diff
changeset
|
83 |
# to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java |
29096
e91fff38083a
8073498: Enhance GensrcProperties.gmk to allow an alternative source root
erikj
parents:
27799
diff
changeset
|
84 |
$1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \ |
27565 | 85 |
$(SUPPORT_OUTPUTDIR)/gensrc/%, \ |
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
86 |
$$(patsubst %.properties, %.java, \ |
27753
a6c284fa0745
8065412: generated source to compile .properties file incorreectly includes the module name in the package name
erikj
parents:
27088
diff
changeset
|
87 |
$$(subst /$(OPENJDK_TARGET_OS)/classes,, \ |
a6c284fa0745
8065412: generated source to compile .properties file incorreectly includes the module name in the package name
erikj
parents:
27088
diff
changeset
|
88 |
$$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \ |
33669
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
89 |
$$(subst /share/classes,, $$($1_SRC_FILES)))))) |
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
90 |
|
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
91 |
# Generate the package dirs for the to be generated java files. Sort to remove |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
92 |
# duplicates. |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
93 |
$1_DIRS := $$(sort $$(dir $$($1_JAVAS))) |
12317
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
94 |
|
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
95 |
# Now generate a sequence of: |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
96 |
# "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
97 |
# suitable to be fed into the CompileProperties command. |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
98 |
$1_CMDLINE := $$(subst _SPACE_, $(SPACE), \ |
33669
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
99 |
$$(join $$(addprefix -compile_SPACE_, $$($1_SRC_FILES)), \ |
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
100 |
$$(addsuffix _SPACE_$$($1_CLASS), \ |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
101 |
$$(addprefix _SPACE_, $$($1_JAVAS))))) |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
102 |
|
33669
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
103 |
$1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.marker |
27565 | 104 |
$1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline |
13702 | 105 |
|
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47217
diff
changeset
|
106 |
# Now setup the rule for the generation of the resource bundles. |
33669
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
107 |
$$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK) |
52065
dea8a62cdfc3
8211724: Change mkdir -p to MakeDir macro where possible
erikj
parents:
50590
diff
changeset
|
108 |
$$(call LogWarn, Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE)) |
dea8a62cdfc3
8211724: Change mkdir -p to MakeDir macro where possible
erikj
parents:
50590
diff
changeset
|
109 |
$$(call MakeDir, $$(@D) $$($1_DIRS)) |
32833
b99bc9129f51
8136385: Various build speed improvements for windows
erikj
parents:
29096
diff
changeset
|
110 |
$$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE))) |
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
111 |
$(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE) |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
112 |
$(TOUCH) $$@ |
13702 | 113 |
|
33669
1082bb5cff16
8142383: Use named arguments for SetupCompileProperties in jdk
ihse
parents:
32833
diff
changeset
|
114 |
$$($1_JAVAS): $$($1_SRC_FILES) |
12317
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
115 |
|
27088
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
116 |
# Create zh_HK versions of all zh_TW files created above |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
117 |
$$(eval $$(call SetupCopy-zh_HK,$1_HK,$$(filter %_zh_TW.java, $$($1_JAVAS)))) |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
118 |
# The zh_HK copy must wait for the compile properties tool to run |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
119 |
$$($1_HK): $$($1_TARGET) |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
120 |
|
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
121 |
$1 += $$($1_JAVAS) $$($1_TARGET) $$($1_HK) |
ea6446a9121b
8055191: Split GensrcProperties.gmk into separate modules
erikj
parents:
26192
diff
changeset
|
122 |
endef |
12317
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
123 |
|
23236
7c5997f59e20
8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents:
23010
diff
changeset
|
124 |
################################################################################ |