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 222 $(OUTPUT_DIR)/_jar3_updated: $(OUTPUT_DIR)/_jar3_verified 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 228 update-jar3: $(OUTPUT_DIR)/_jar3_updated 229 TEST_TARGETS += $(OUTPUT_DIR)/_jar3_updated 230 231 .PHONY: clean-jar3 create-jar3 update-jar3 232 233 ################################################################################ 234 235 all: $(TEST_TARGETS) 236 237 .PHONY: default all | 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 222 $(OUTPUT_DIR)/_jar3_updated: $(OUTPUT_DIR)/_jar3_verified 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 228 update-jar3: $(OUTPUT_DIR)/_jar3_updated 229 TEST_TARGETS += $(OUTPUT_DIR)/_jar3_updated 230 231 .PHONY: clean-jar3 create-jar3 update-jar3 232 233 ################################################################################ 234 # Test SetupJavaCompilation overrides of java files 235 236 $(eval $(call SetupJavaCompiler,BOOT_JAVAC, \ 237 JAVAC := $(JAVAC), \ 238 )) 239 240 JAVA_SRC_ROOT1 := $(OUTPUT_DIR)/javaroot1 241 JAVA_SRC_ROOT2 := $(OUTPUT_DIR)/javaroot2 242 243 # Since this makefile calls itself a number of times, protect this macro from 244 # being executed more than once. 245 # Param 1 - File name 246 # Param 2 - Package name 247 # Param 3 - Class name 248 # Param 4 - Message 249 CreateJavaSrc = \ 250 $(if $(wildcard $1),,$(shell \ 251 $(MKDIR) -p $(dir $1); \ 252 $(ECHO) "package $2;" > $1; \ 253 $(ECHO) "public class $3 {" >> $1; \ 254 $(ECHO) " public static void main(String[] args) {" >> $1; \ 255 $(ECHO) " System.out.print(\"$4\");" >> $1; \ 256 $(ECHO) " }" >> $1; \ 257 $(ECHO) "}" >> $1; \ 258 )) 259 260 # Since this makefile calls itself a number of times, protect this macro from 261 # being executed more than once. 262 # Param 1 - File name 263 # Param 2 - Message 264 CreateTextFile = \ 265 $(if $(wildcard $1),,$(shell \ 266 $(MKDIR) -p $(dir $1); \ 267 $(PRINTF) '$2' > $1; \ 268 )) 269 270 $(call CreateJavaSrc,$(JAVA_SRC_ROOT1)/a/A.java,a,A,javaroot1) 271 $(call CreateJavaSrc,$(JAVA_SRC_ROOT2)/a/A.java,a,A,javaroot2) 272 $(call CreateTextFile,$(JAVA_SRC_ROOT1)/a/b.txt,javaroot1\n) 273 $(call CreateTextFile,$(JAVA_SRC_ROOT2)/a/b.txt,javaroot2\n) 274 $(call CreateTextFile,$(JAVA_SRC_ROOT1)/a/c.properties,#javaroot1\nname=value1\n) 275 $(call CreateTextFile,$(JAVA_SRC_ROOT2)/a/c.properties,#javaroot2\nname=value2\n) 276 277 # Due to a bug in gnu make 3.81, need to add the src roots with trailing slash, 278 # otherwise $(wildcard ) will not find the directories and the sanity check in 279 # SetupJavaCompilation will fail. 280 $(eval $(call SetupJavaCompilation, BUILD_ROOT1_FIRST, \ 281 SETUP := BOOT_JAVAC, \ 282 SRC := $(JAVA_SRC_ROOT1)/ $(JAVA_SRC_ROOT2)/, \ 283 COPY := .txt .java, \ 284 CLEAN := .properties, \ 285 BIN := $(OUTPUT_DIR)/root1first/, \ 286 )) 287 288 $(BUILD_ROOT1_FIRST): 289 290 verify-root1-first: $(BUILD_ROOT1_FIRST) 291 $(JAVA_SMALL) -cp $(OUTPUT_DIR)/root1first a.A > $(OUTPUT_DIR)/root1first.output 292 if [ "`$(CAT) $(OUTPUT_DIR)/root1first.output`" != "javaroot1" ]; then \ 293 $(ECHO) "The wrong class was compiled. Expected >javaroot1<"; \ 294 $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first.output`<"; \ 295 false; \ 296 fi 297 if [ "`$(CAT) $(OUTPUT_DIR)/root1first/a/b.txt`" != "javaroot1" ]; then \ 298 $(ECHO) "The wrong file was copied. Expected >javaroot1<"; \ 299 $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first/a/b.txt`<"; \ 300 false; \ 301 fi 302 if [ ! -e "$(OUTPUT_DIR)/root1first/a/A.java" ]; then \ 303 $(ECHO) "Missed copying $(OUTPUT_DIR)/root1first/a/A.java"; \ 304 false; \ 305 fi 306 if [ "`$(CAT) $(OUTPUT_DIR)/root1first/a/c.properties`" != "name=value1" ]; then \ 307 $(ECHO) "The wrong file was cleaned. Expected >name=value1<"; \ 308 $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first/a/c.properties`<"; \ 309 false; \ 310 fi 311 312 $(eval $(call SetupJavaCompilation, BUILD_ROOT2_FIRST, \ 313 SETUP := BOOT_JAVAC, \ 314 SRC := $(JAVA_SRC_ROOT2)/ $(JAVA_SRC_ROOT1)/, \ 315 COPY := .txt, \ 316 CLEAN := .properties, \ 317 BIN := $(OUTPUT_DIR)/root2first/, \ 318 )) 319 320 $(BUILD_ROOT2_FIRST): 321 322 verify-root2-first: $(BUILD_ROOT2_FIRST) 323 $(JAVA_SMALL) -cp $(OUTPUT_DIR)/root2first a.A > $(OUTPUT_DIR)/root2first.output 324 if [ "`$(CAT) $(OUTPUT_DIR)/root2first.output`" != "javaroot2" ]; then \ 325 $(ECHO) "The wrong class was compiled. Expected >javaroot2<"; \ 326 $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root2first.output`<"; \ 327 false; \ 328 fi 329 if [ "`$(CAT) $(OUTPUT_DIR)/root2first/a/b.txt`" != "javaroot2" ]; then \ 330 $(ECHO) "The wrong file was cleaned. Expected >javaroot2<"; \ 331 $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root2first/a/b.txt`<"; \ 332 false; \ 333 fi 334 if [ "`$(CAT) $(OUTPUT_DIR)/root2first/a/c.properties`" != "name=value2" ]; then \ 335 $(ECHO) "The wrong file was cleaned. Expected >name=value2<"; \ 336 $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root2first/a/c.properties`<"; \ 337 false; \ 338 fi 339 340 TEST_TARGETS += verify-root1-first verify-root2-first 341 342 .PHONY: verify-root1-first verify-root2-first 343 344 ################################################################################ 345 346 all: $(TEST_TARGETS) 347 348 .PHONY: default all |