author | lana |
Thu, 15 Oct 2015 16:49:49 -0700 | |
changeset 32975 | 40c35a49ebdb |
parent 30095 | 0034766ccb09 |
child 33438 | 35cd6a1619df |
permissions | -rw-r--r-- |
25854 | 1 |
# |
2 |
# Copyright (c) 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 |
default: all |
|
27 |
||
28 |
include $(SPEC) |
|
29 |
include MakeBase.gmk |
|
30 |
include JavaCompilation.gmk |
|
31 |
||
32 |
THIS_FILE := $(SRC_ROOT)/test/make/TestJavaCompilation.gmk |
|
33 |
DEPS := $(THIS_FILE) \ |
|
34 |
$(SRC_ROOT)/make/common/MakeBase.gmk \ |
|
35 |
$(SRC_ROOT)/make/common/JavaCompilation.gmk \ |
|
36 |
# |
|
37 |
||
38 |
OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/java-compilation |
|
39 |
||
40 |
################################################################################ |
|
41 |
# Test: jar1 |
|
42 |
# Creates a simple jar file and unzips it to verify that the files have not |
|
43 |
# changed. |
|
44 |
||
45 |
JAR1_SRC_ROOT := $(OUTPUT_DIR)/jar1src |
|
46 |
JAR1_UNZIP := $(OUTPUT_DIR)/jar1unzip |
|
47 |
JAR1_FILE := $(OUTPUT_DIR)/jar1.jar |
|
48 |
JAR1_MANIFEST := $(OUTPUT_DIR)/jar1_manifest |
|
49 |
||
50 |
clean-jar1: |
|
51 |
$(RM) -r $(OUTPUT_DIR)/_jar1* $(OUTPUT_DIR)/jar1* |
|
52 |
||
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
53 |
$(JAR1_MANIFEST): | $(OUTPUT_DIR)/_jar1_created |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
54 |
$(ECHO) "Test-Attribute: value" > $(JAR1_MANIFEST) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
55 |
|
25854 | 56 |
$(OUTPUT_DIR)/_jar1_created: $(DEPS) |
57 |
$(RM) -r $(JAR1_SRC_ROOT) |
|
58 |
$(RM) $(JAR1_FILE) |
|
59 |
$(RM) -r $(JAR1_UNZIP) |
|
60 |
$(MKDIR) -p $(JAR1_SRC_ROOT) |
|
61 |
$(MKDIR) -p $(JAR1_SRC_ROOT)/dir1 |
|
62 |
$(MKDIR) -p $(JAR1_SRC_ROOT)/dir2 |
|
63 |
$(MKDIR) -p $(JAR1_SRC_ROOT)/META-INF |
|
64 |
$(TOUCH) $(JAR1_SRC_ROOT)/dir1/file1.class |
|
65 |
$(TOUCH) $(JAR1_SRC_ROOT)/dir2/file2.class |
|
66 |
$(TOUCH) $(JAR1_SRC_ROOT)/META-INF/metafile |
|
67 |
$(TOUCH) $@ |
|
68 |
||
69 |
$(eval $(call SetupArchive,BUILD_JAR1, \ |
|
29312
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28600
diff
changeset
|
70 |
DEPENDENCIES := $(OUTPUT_DIR)/_jar1_created, \ |
25854 | 71 |
SRCS := $(JAR1_SRC_ROOT), \ |
72 |
MANIFEST := $(JAR1_MANIFEST), \ |
|
73 |
JAR := $(JAR1_FILE))) |
|
74 |
||
75 |
$(OUTPUT_DIR)/_jar1_verified: $(BUILD_JAR1) |
|
76 |
$(RM) -r $(JAR1_UNZIP) |
|
77 |
$(MKDIR) -p $(JAR1_UNZIP) |
|
78 |
$(CD) $(JAR1_UNZIP) && $(UNZIP) $(JAR1_FILE) $(LOG_DEBUG) |
|
79 |
$(DIFF) -r $(JAR1_SRC_ROOT)/dir1 $(JAR1_UNZIP)/dir1 |
|
80 |
$(DIFF) -r $(JAR1_SRC_ROOT)/dir2 $(JAR1_UNZIP)/dir2 |
|
81 |
$(DIFF) -r $(JAR1_SRC_ROOT)/META-INF/metafile $(JAR1_UNZIP)/META-INF/metafile |
|
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
82 |
if [ "`$(GREP) 'Test-Attribute: value' $(JAR1_UNZIP)/META-INF/MANIFEST.MF`" = "" ]; then \ |
25854 | 83 |
$(ECHO) "Could not find Test-Attribute in manifest of $(JAR1_FILE)"; \ |
84 |
exit 1; \ |
|
85 |
fi |
|
86 |
$(TOUCH) $@ |
|
87 |
||
88 |
create-jar2: $(OUTPUT_DIR)/_jar1_verified |
|
89 |
TEST_TARGETS += $(OUTPUT_DIR)/_jar1_verified |
|
90 |
||
91 |
# Change a source file and call this makefile again to force the jar to be |
|
92 |
# updated. |
|
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
93 |
$(OUTPUT_DIR)/_jar1_updated: $(OUTPUT_DIR)/_jar1_verified |
25854 | 94 |
$(ECHO) updated > $(JAR1_SRC_ROOT)/dir1/file1.class |
95 |
$(ECHO) updated > $(JAR1_SRC_ROOT)/META-INF/metafile |
|
96 |
$(TOUCH) $(OUTPUT_DIR)/_jar1_created |
|
97 |
+$(MAKE) -f $(THIS_FILE) $(OUTPUT_DIR)/_jar1_verified |
|
98 |
$(TOUCH) $@ |
|
99 |
||
100 |
update-jar1: $(OUTPUT_DIR)_jar1_updated |
|
101 |
||
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
102 |
# Change the manifest file and call this makefile again to force the jar |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
103 |
# to be updated |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
104 |
$(OUTPUT_DIR)/_jar1_updated_manifest: $(OUTPUT_DIR)/_jar1_updated |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
105 |
$(ECHO) "Test-Attribute: foobar" > $(JAR1_MANIFEST) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
106 |
+$(MAKE) -f $(THIS_FILE) $(BUILD_JAR1) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
107 |
$(RM) -r $(JAR1_UNZIP) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
108 |
$(MKDIR) -p $(JAR1_UNZIP) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
109 |
$(CD) $(JAR1_UNZIP) && $(UNZIP) $(JAR1_FILE) $(LOG_DEBUG) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
110 |
if [ "`$(GREP) 'Test-Attribute: foobar' $(JAR1_UNZIP)/META-INF/MANIFEST.MF`" = "" ]; then \ |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
111 |
$(ECHO) "Could not find Test-Attribute in manifest of $(JAR1_FILE)"; \ |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
112 |
exit 1; \ |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
113 |
fi |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
114 |
$(TOUCH) $@ |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
115 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
116 |
update-jar1-manifest: $(OUTPUT_DIR)/_jar1_updated_manifest |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
117 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
118 |
TEST_TARGETS += $(OUTPUT_DIR)/_jar1_updated $(OUTPUT_DIR)/_jar1_updated_manifest |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
119 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
120 |
.PHONY: clean-jar1 create-jar1 update-jar1 update-jar1-manifest |
25854 | 121 |
|
122 |
################################################################################ |
|
123 |
# Test: jar2 |
|
124 |
# Creates a jar file based on 2 source roots |
|
125 |
||
126 |
JAR2_SRC_ROOT1 := $(OUTPUT_DIR)/jar2src1 |
|
127 |
JAR2_SRC_ROOT2 := $(OUTPUT_DIR)/jar2src2 |
|
128 |
JAR2_UNZIP := $(OUTPUT_DIR)/jar2unzip |
|
129 |
JAR2_FILE := $(OUTPUT_DIR)/jar2.jar |
|
130 |
||
131 |
clean-jar2: |
|
132 |
$(RM) -r $(OUTPUT_DIR)/_jar2* $(OUTPUT_DIR)/jar2* |
|
133 |
||
134 |
$(OUTPUT_DIR)/_jar2_created: $(DEPS) |
|
135 |
$(RM) -r $(JAR2_SRC_ROOT1) |
|
136 |
$(RM) -r $(JAR2_SRC_ROOT2) |
|
137 |
$(RM) $(JAR2_FILE) |
|
138 |
$(RM) -r $(JAR2_UNZIP) |
|
139 |
$(MKDIR) -p $(JAR2_SRC_ROOT1)/dir1 |
|
140 |
$(MKDIR) -p $(JAR2_SRC_ROOT2)/dir2 |
|
141 |
$(TOUCH) $(JAR2_SRC_ROOT1)/dir1/file1.class |
|
142 |
$(TOUCH) $(JAR2_SRC_ROOT2)/dir2/file2.class |
|
143 |
$(TOUCH) $@ |
|
144 |
||
145 |
$(eval $(call SetupArchive,BUILD_JAR2, \ |
|
29312
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28600
diff
changeset
|
146 |
DEPENDENCIES := $(OUTPUT_DIR)/_jar2_created, \ |
25854 | 147 |
SRCS := $(JAR2_SRC_ROOT1) $(JAR2_SRC_ROOT2), \ |
148 |
JAR := $(JAR2_FILE))) |
|
149 |
||
150 |
$(OUTPUT_DIR)/_jar2_verified: $(BUILD_JAR2) |
|
151 |
$(RM) -r $(JAR2_UNZIP) |
|
152 |
$(MKDIR) -p $(JAR2_UNZIP) |
|
153 |
$(CD) $(JAR2_UNZIP) && $(UNZIP) $(JAR2_FILE) $(LOG_DEBUG) |
|
154 |
$(DIFF) -r $(JAR2_SRC_ROOT1)/dir1 $(JAR2_UNZIP)/dir1 |
|
155 |
$(DIFF) -r $(JAR2_SRC_ROOT2)/dir2 $(JAR2_UNZIP)/dir2 |
|
156 |
$(TOUCH) $@ |
|
157 |
||
158 |
create-jar2: $(OUTPUT_DIR)/_jar2_verified |
|
159 |
TEST_TARGETS += $(OUTPUT_DIR)/_jar2_verified |
|
160 |
||
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
161 |
$(OUTPUT_DIR)/_jar2_updated: $(OUTPUT_DIR)/_jar2_verified |
25854 | 162 |
$(ECHO) updated > $(JAR2_SRC_ROOT1)/dir1/file1.class |
163 |
$(TOUCH) $(OUTPUT_DIR)/_jar2_created |
|
164 |
+$(MAKE) -f $(THIS_FILE) $(OUTPUT_DIR)/_jar2_verified |
|
165 |
$(TOUCH) $@ |
|
166 |
||
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
167 |
update-jar2: $(OUTPUT_DIR)/_jar2_updated |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
168 |
TEST_TARGETS += $(OUTPUT_DIR)/_jar2_updated |
25854 | 169 |
|
170 |
.PHONY: clean-jar2 create-jar2 update-jar2 |
|
171 |
||
172 |
################################################################################ |
|
173 |
# Test: jar3 |
|
174 |
# Creates a jar file based on 2 source roots with an extra file |
|
175 |
||
176 |
JAR3_SRC_ROOT1 := $(OUTPUT_DIR)/jar3src1 |
|
177 |
JAR3_SRC_ROOT2 := $(OUTPUT_DIR)/jar3src2 |
|
178 |
JAR3_UNZIP := $(OUTPUT_DIR)/jar3unzip |
|
179 |
JAR3_FILE := $(OUTPUT_DIR)/jar3.jar |
|
180 |
||
181 |
clean-jar3: |
|
182 |
$(RM) -r $(OUTPUT_DIR)/_jar3* $(OUTPUT_DIR)/jar3* |
|
183 |
||
184 |
$(OUTPUT_DIR)/_jar3_created: $(DEPS) |
|
185 |
$(RM) -r $(JAR3_SRC_ROOT1) |
|
186 |
$(RM) -r $(JAR3_SRC_ROOT2) |
|
187 |
$(RM) $(JAR3_FILE) |
|
188 |
$(RM) -r $(JAR3_UNZIP) |
|
189 |
$(MKDIR) -p $(JAR3_SRC_ROOT1)/dir1 |
|
190 |
$(MKDIR) -p $(JAR3_SRC_ROOT2)/dir2 |
|
191 |
$(TOUCH) $(JAR3_SRC_ROOT1)/dir1/file1\$$foo.class |
|
192 |
$(TOUCH) $(JAR3_SRC_ROOT2)/dir2/file2.class |
|
193 |
$(TOUCH) $(JAR3_SRC_ROOT2)/extra-file |
|
194 |
$(TOUCH) $(JAR3_SRC_ROOT2)/extra-file-abs |
|
195 |
$(TOUCH) $(JAR3_SRC_ROOT2)/dir2/file\$$foo.dollar |
|
196 |
$(TOUCH) $@ |
|
197 |
||
198 |
$(eval $(call SetupArchive,BUILD_JAR3, \ |
|
29312
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28600
diff
changeset
|
199 |
DEPENDENCIES := $(OUTPUT_DIR)/_jar3_created, \ |
25854 | 200 |
SRCS := $(JAR3_SRC_ROOT1) $(JAR3_SRC_ROOT2), \ |
201 |
EXTRA_FILES := extra-file \ |
|
202 |
dir2/file$$$$foo.dollar \ |
|
203 |
$(JAR3_SRC_ROOT2)/extra-file-abs, \ |
|
204 |
EXCLUDE_FILES := dir1/file1$$$$foo.class, \ |
|
205 |
JAR := $(JAR3_FILE))) |
|
206 |
||
207 |
$(OUTPUT_DIR)/_jar3_verified: $(BUILD_JAR3) |
|
208 |
$(RM) -r $(JAR3_UNZIP) |
|
209 |
$(MKDIR) -p $(JAR3_UNZIP) |
|
210 |
$(CD) $(JAR3_UNZIP) && $(UNZIP) $(JAR3_FILE) $(LOG_DEBUG) |
|
211 |
if [ -d "$(JAR3_UNZIP)/dir1" ]; then \ |
|
212 |
echo Should not be included $(JAR3_UNZIP)/dir1; \ |
|
213 |
exit 1; \ |
|
214 |
fi |
|
215 |
$(DIFF) -r $(JAR3_SRC_ROOT2)/dir2 $(JAR3_UNZIP)/dir2 |
|
216 |
$(DIFF) -r $(JAR3_SRC_ROOT2)/extra-file $(JAR3_UNZIP)/extra-file |
|
217 |
$(TOUCH) $@ |
|
218 |
||
219 |
create-jar3: $(OUTPUT_DIR)/_jar3_verified |
|
220 |
TEST_TARGETS += $(OUTPUT_DIR)/_jar3_verified |
|
221 |
||
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
222 |
$(OUTPUT_DIR)/_jar3_updated: $(OUTPUT_DIR)/_jar3_verified |
25854 | 223 |
$(ECHO) updated > $(JAR3_SRC_ROOT2)/extra-file |
224 |
$(TOUCH) $(OUTPUT_DIR)/_jar3_created |
|
225 |
+$(MAKE) -f $(THIS_FILE) $(OUTPUT_DIR)/_jar3_verified |
|
226 |
$(TOUCH) $@ |
|
227 |
||
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
228 |
update-jar3: $(OUTPUT_DIR)/_jar3_updated |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
229 |
TEST_TARGETS += $(OUTPUT_DIR)/_jar3_updated |
25854 | 230 |
|
231 |
.PHONY: clean-jar3 create-jar3 update-jar3 |
|
232 |
||
233 |
################################################################################ |
|
30095
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
234 |
# Test SetupJavaCompilation overrides of java files |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
235 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
236 |
$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
237 |
JAVAC := $(JAVAC), \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
238 |
)) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
239 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
240 |
JAVA_SRC_ROOT1 := $(OUTPUT_DIR)/javaroot1 |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
241 |
JAVA_SRC_ROOT2 := $(OUTPUT_DIR)/javaroot2 |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
242 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
243 |
# Since this makefile calls itself a number of times, protect this macro from |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
244 |
# being executed more than once. |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
245 |
# Param 1 - File name |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
246 |
# Param 2 - Package name |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
247 |
# Param 3 - Class name |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
248 |
# Param 4 - Message |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
249 |
CreateJavaSrc = \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
250 |
$(if $(wildcard $1),,$(shell \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
251 |
$(MKDIR) -p $(dir $1); \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
252 |
$(ECHO) "package $2;" > $1; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
253 |
$(ECHO) "public class $3 {" >> $1; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
254 |
$(ECHO) " public static void main(String[] args) {" >> $1; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
255 |
$(ECHO) " System.out.print(\"$4\");" >> $1; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
256 |
$(ECHO) " }" >> $1; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
257 |
$(ECHO) "}" >> $1; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
258 |
)) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
259 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
260 |
# Since this makefile calls itself a number of times, protect this macro from |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
261 |
# being executed more than once. |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
262 |
# Param 1 - File name |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
263 |
# Param 2 - Message |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
264 |
CreateTextFile = \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
265 |
$(if $(wildcard $1),,$(shell \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
266 |
$(MKDIR) -p $(dir $1); \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
267 |
$(PRINTF) '$2' > $1; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
268 |
)) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
269 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
270 |
$(call CreateJavaSrc,$(JAVA_SRC_ROOT1)/a/A.java,a,A,javaroot1) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
271 |
$(call CreateJavaSrc,$(JAVA_SRC_ROOT2)/a/A.java,a,A,javaroot2) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
272 |
$(call CreateTextFile,$(JAVA_SRC_ROOT1)/a/b.txt,javaroot1\n) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
273 |
$(call CreateTextFile,$(JAVA_SRC_ROOT2)/a/b.txt,javaroot2\n) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
274 |
$(call CreateTextFile,$(JAVA_SRC_ROOT1)/a/c.properties,#javaroot1\nname=value1\n) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
275 |
$(call CreateTextFile,$(JAVA_SRC_ROOT2)/a/c.properties,#javaroot2\nname=value2\n) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
276 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
277 |
# Due to a bug in gnu make 3.81, need to add the src roots with trailing slash, |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
278 |
# otherwise $(wildcard ) will not find the directories and the sanity check in |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
279 |
# SetupJavaCompilation will fail. |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
280 |
$(eval $(call SetupJavaCompilation, BUILD_ROOT1_FIRST, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
281 |
SETUP := BOOT_JAVAC, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
282 |
SRC := $(JAVA_SRC_ROOT1)/ $(JAVA_SRC_ROOT2)/, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
283 |
COPY := .txt .java, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
284 |
CLEAN := .properties, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
285 |
BIN := $(OUTPUT_DIR)/root1first/, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
286 |
)) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
287 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
288 |
$(BUILD_ROOT1_FIRST): |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
289 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
290 |
verify-root1-first: $(BUILD_ROOT1_FIRST) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
291 |
$(JAVA_SMALL) -cp $(OUTPUT_DIR)/root1first a.A > $(OUTPUT_DIR)/root1first.output |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
292 |
if [ "`$(CAT) $(OUTPUT_DIR)/root1first.output`" != "javaroot1" ]; then \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
293 |
$(ECHO) "The wrong class was compiled. Expected >javaroot1<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
294 |
$(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first.output`<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
295 |
false; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
296 |
fi |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
297 |
if [ "`$(CAT) $(OUTPUT_DIR)/root1first/a/b.txt`" != "javaroot1" ]; then \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
298 |
$(ECHO) "The wrong file was copied. Expected >javaroot1<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
299 |
$(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first/a/b.txt`<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
300 |
false; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
301 |
fi |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
302 |
if [ ! -e "$(OUTPUT_DIR)/root1first/a/A.java" ]; then \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
303 |
$(ECHO) "Missed copying $(OUTPUT_DIR)/root1first/a/A.java"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
304 |
false; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
305 |
fi |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
306 |
if [ "`$(CAT) $(OUTPUT_DIR)/root1first/a/c.properties`" != "name=value1" ]; then \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
307 |
$(ECHO) "The wrong file was cleaned. Expected >name=value1<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
308 |
$(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first/a/c.properties`<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
309 |
false; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
310 |
fi |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
311 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
312 |
$(eval $(call SetupJavaCompilation, BUILD_ROOT2_FIRST, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
313 |
SETUP := BOOT_JAVAC, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
314 |
SRC := $(JAVA_SRC_ROOT2)/ $(JAVA_SRC_ROOT1)/, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
315 |
COPY := .txt, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
316 |
CLEAN := .properties, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
317 |
BIN := $(OUTPUT_DIR)/root2first/, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
318 |
)) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
319 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
320 |
$(BUILD_ROOT2_FIRST): |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
321 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
322 |
verify-root2-first: $(BUILD_ROOT2_FIRST) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
323 |
$(JAVA_SMALL) -cp $(OUTPUT_DIR)/root2first a.A > $(OUTPUT_DIR)/root2first.output |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
324 |
if [ "`$(CAT) $(OUTPUT_DIR)/root2first.output`" != "javaroot2" ]; then \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
325 |
$(ECHO) "The wrong class was compiled. Expected >javaroot2<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
326 |
$(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root2first.output`<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
327 |
false; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
328 |
fi |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
329 |
if [ "`$(CAT) $(OUTPUT_DIR)/root2first/a/b.txt`" != "javaroot2" ]; then \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
330 |
$(ECHO) "The wrong file was cleaned. Expected >javaroot2<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
331 |
$(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root2first/a/b.txt`<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
332 |
false; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
333 |
fi |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
334 |
if [ "`$(CAT) $(OUTPUT_DIR)/root2first/a/c.properties`" != "name=value2" ]; then \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
335 |
$(ECHO) "The wrong file was cleaned. Expected >name=value2<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
336 |
$(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root2first/a/c.properties`<"; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
337 |
false; \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
338 |
fi |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
339 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
340 |
TEST_TARGETS += verify-root1-first verify-root2-first |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
341 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
342 |
.PHONY: verify-root1-first verify-root2-first |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
343 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
344 |
################################################################################ |
25854 | 345 |
|
346 |
all: $(TEST_TARGETS) |
|
347 |
||
348 |
.PHONY: default all |