# # Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 only, as # published by the Free Software Foundation. Oracle designates this # particular file as subject to the "Classpath" exception as provided # by Oracle in the LICENSE file that accompanied this code. # # This code is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # version 2 for more details (a copy is included in the LICENSE file that # accompanied this code). # # You should have received a copy of the GNU General Public License version # 2 along with this work; if not, write to the Free Software Foundation, # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. # # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. #
default: all
include $(SPEC) include MakeBase.gmk include JarArchive.gmk include JavaCompilation.gmk include UtilsForTests.gmk
################################################################################ # Test: jar1 # Creates a simple jar file and unzips it to verify that the files have not # changed.
# Change a source file and call this makefile again to force the jar to be # updated.
$(OUTPUT_DIR)/_jar1_updated: $(OUTPUT_DIR)/_jar1_verified
$(ECHO) updated > $(JAR1_SRC_ROOT)/dir1/file1.class
$(ECHO) updated > $(JAR1_SRC_ROOT)/META-INF/metafile
$(TOUCH) $(OUTPUT_DIR)/_jar1_created
+$(MAKE) -f $(THIS_FILE) $(OUTPUT_DIR)/_jar1_verified
$(TOUCH) $@
update-jar1: $(OUTPUT_DIR)_jar1_updated
# Change the manifest file and call this makefile again to force the jar # to be updated
$(OUTPUT_DIR)/_jar1_updated_manifest: $(OUTPUT_DIR)/_jar1_updated
$(SLEEP_ON_MAC)
$(ECHO) "Test-Attribute: foobar" > $(JAR1_MANIFEST)
+$(MAKE) -f $(THIS_FILE) $(BUILD_JAR1)
$(RM) -r $(JAR1_UNZIP)
$(MKDIR) -p $(JAR1_UNZIP)
$(CD) $(JAR1_UNZIP) && $(UNZIP) $(JAR1_FILE) $(LOG_DEBUG) if [ "`$(GREP) 'Test-Attribute: foobar' $(JAR1_UNZIP)/META-INF/MANIFEST.MF`" = "" ]; then \
$(ECHO) "Could not find Test-Attribute in manifest of $(JAR1_FILE)"; \
exit 1; \ fi
$(TOUCH) $@
################################################################################ # Test: jar3 # Creates a jar file based on 2 source roots with an extra file
# Since this makefile calls itself a number of times, protect this macro from # being executed more than once. # Param 1 - File name # Param 2 - Package name # Param 3 - Class name # Param 4 - Message
CreateJavaSrc = \
$(if $(wildcard $1),,$(shell \
$(MKDIR) -p $(dir $1); \
$(ECHO) "package $2;" > $1; \
$(ECHO) "public class $3 {" >> $1; \
$(ECHO) " public static void main(String[] args) {" >> $1; \
$(ECHO) " System.out.print(\"$4\");" >> $1; \
$(ECHO) " }" >> $1; \
$(ECHO) "}" >> $1; \
))
# Since this makefile calls itself a number of times, protect this macro from # being executed more than once. # Param 1 - File name # Param 2 - Message
CreateTextFile = \
$(if $(wildcard $1),,$(shell \
$(MKDIR) -p $(dir $1); \
$(PRINTF) '$2' > $1; \
))
# Due to a bug in gnu make 3.81, need to add the src roots with trailing slash, # otherwise $(wildcard ) will not find the directories and the sanity check in # SetupJavaCompilation will fail.
$(eval $(call SetupJavaCompilation, BUILD_ROOT1_FIRST, \
TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \
SRC := $(JAVA_SRC_ROOT1)/ $(JAVA_SRC_ROOT2)/, \ COPY := .txt .java, \ CLEAN := .properties, \
BIN := $(OUTPUT_DIR)/root1first/, \
))
$(BUILD_ROOT1_FIRST):
verify-root1-first: $(BUILD_ROOT1_FIRST)
$(JAVA_SMALL) -cp $(OUTPUT_DIR)/root1first a.A > $(OUTPUT_DIR)/root1first.output if [ "`$(CAT) $(OUTPUT_DIR)/root1first.output`" != "javaroot1" ]; then \
$(ECHO) "The wrong class was compiled. Expected >javaroot1<"; \
$(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first.output`<"; \
false; \ fi if [ "`$(CAT) $(OUTPUT_DIR)/root1first/a/b.txt`" != "javaroot1" ]; then \
$(ECHO) "The wrong file was copied. Expected >javaroot1<"; \
$(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first/a/b.txt`<"; \
false; \ fi if [ ! -e "$(OUTPUT_DIR)/root1first/a/A.java" ]; then \
$(ECHO) "Missed copying $(OUTPUT_DIR)/root1first/a/A.java"; \
false; \ fi if [ "`$(CAT) $(OUTPUT_DIR)/root1first/a/c.properties`" != "name=value1" ]; then \
$(ECHO) "The wrong file was cleaned. Expected >name=value1<"; \
$(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first/a/c.properties`<"; \
false; \ fi
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.