annotate nashorn/make/BuildNashorn.gmk @ 34020:d9b12d08137b

8085822: JEP 223: New Version-String Scheme (initial integration) Reviewed-by: erikj, dcubed, dholmes, alanb, sundar Contributed-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
author ihse
date Thu, 11 Jun 2015 00:23:35 +0200
parents 7f36aa566efe
children 00d015c3e298
rev   line source
jlaskey@16198 1 #
ihse@34020 2 # Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
jlaskey@16198 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jlaskey@16198 4 #
jlaskey@16198 5 # This code is free software; you can redistribute it and/or modify it
jlaskey@16198 6 # under the terms of the GNU General Public License version 2 only, as
jlaskey@16198 7 # published by the Free Software Foundation. Oracle designates this
jlaskey@16198 8 # particular file as subject to the "Classpath" exception as provided
jlaskey@16198 9 # by Oracle in the LICENSE file that accompanied this code.
jlaskey@16198 10 #
jlaskey@16198 11 # This code is distributed in the hope that it will be useful, but WITHOUT
jlaskey@16198 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jlaskey@16198 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jlaskey@16198 14 # version 2 for more details (a copy is included in the LICENSE file that
jlaskey@16198 15 # accompanied this code).
jlaskey@16198 16 #
jlaskey@16198 17 # You should have received a copy of the GNU General Public License version
jlaskey@16198 18 # 2 along with this work; if not, write to the Free Software Foundation,
jlaskey@16198 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jlaskey@16198 20 #
jlaskey@16198 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jlaskey@16198 22 # or visit www.oracle.com if you need additional information or have any
jlaskey@16198 23 # questions.
jlaskey@16198 24 #
jlaskey@16198 25
jlaskey@16198 26 # This must be the first rule
jlaskey@16198 27 default: all
jlaskey@16198 28
jlaskey@16198 29 -include $(SPEC)
jlaskey@16198 30 include MakeBase.gmk
jlaskey@16198 31 include JavaCompilation.gmk
erikj@26892 32 include SetupJavaCompilers.gmk
ihse@34020 33 include TextFileProcessing.gmk
jlaskey@16198 34
chegar@25865 35 JDK_CLASSES := $(subst $(SPACE),$(PATH_SEP),$(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
chegar@25865 36 java.base java.logging java.scripting)))
jlaskey@16198 37
chegar@27571 38 NASHORN_JAR := $(IMAGES_OUTPUTDIR)/nashorn.jar
jlaskey@16198 39
attila@29134 40 # Need to use source and target 8 for nasgen to work.
ihse@20576 41 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
ihse@20576 42 JVM := $(JAVA), \
ihse@20576 43 JAVAC := $(NEW_JAVAC), \
attila@29134 44 FLAGS := -g -source 8 -target 8 -bootclasspath "$(JDK_CLASSES)", \
ihse@20576 45 SERVER_DIR := $(SJAVAC_SERVER_DIR), \
ihse@20576 46 SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
jlaskey@16198 47
jlaskey@16198 48 # Build nashorn into intermediate directory
ihse@20576 49 $(eval $(call SetupJavaCompilation,BUILD_NASHORN, \
ihse@20576 50 SETUP := GENERATE_NEWBYTECODE_DEBUG, \
chegar@25865 51 SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes, \
chegar@27571 52 EXCLUDE_FILES := META-INF/MANIFEST.MF, \
ihse@20576 53 COPY := .properties .js, \
chegar@27571 54 BIN := $(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes))
jlaskey@16198 55
alanb@16266 56 NASGEN_SRC := $(NASHORN_TOPDIR)/buildtools/nasgen/src
chegar@25865 57 ASM_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
sundar@16265 58
jlaskey@16198 59 # Build nasgen
ihse@20576 60 $(eval $(call SetupJavaCompilation,BUILD_NASGEN, \
erikj@26892 61 SETUP := GENERATE_OLDBYTECODE, \
ihse@20576 62 SRC := $(NASGEN_SRC) $(ASM_SRC), \
chegar@27571 63 BIN := $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes, \
chegar@27571 64 ADD_JAVAC_FLAGS := -Xbootclasspath/p:"$(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes"))
jlaskey@16198 65
jlaskey@16198 66 # Nasgen needs nashorn classes
jlaskey@16198 67 $(BUILD_NASGEN): $(BUILD_NASHORN)
jlaskey@16198 68
chegar@25865 69 NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn
chegar@25865 70 NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run
chegar@25865 71
jlaskey@16198 72 # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
chegar@25865 73 $(NASGEN_RUN_FILE): $(BUILD_NASGEN)
jlaskey@16198 74 $(ECHO) Running nasgen
jlaskey@16198 75 $(MKDIR) -p $(@D)
jlaskey@16198 76 $(RM) -rf $(@D)/jdk $(@D)/netscape
chegar@27571 77 $(CP) -R -p $(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes/* $(@D)/
sundar@16265 78 $(FIXPATH) $(JAVA) \
chegar@27571 79 -Xbootclasspath/p:"$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes" \
ihse@20576 80 jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
jlaskey@16198 81 $(TOUCH) $@
jlaskey@16198 82
jlaskey@16198 83 # Version file needs to be processed with version numbers
ihse@34020 84 $(eval $(call SetupTextFileProcessing, BUILD_VERSION_FILE, \
ihse@34020 85 SOURCE_FILES := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties.template, \
ihse@34020 86 OUTPUT_FILE := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn/jdk/nashorn/internal/runtime/resources/version.properties, \
ihse@34020 87 REPLACEMENTS := \
ihse@34020 88 @@VERSION_STRING@@ => $(VERSION_STRING) ; \
ihse@34020 89 @@VERSION_SHORT@@ => $(VERSION_SHORT) , \
ihse@34020 90 ))
ihse@20576 91
ihse@34020 92 # Version processing needs to happen after nasgen run since nasgen run deletes it
ihse@34020 93 $(BUILD_VERSION_FILE): $(NASGEN_RUN_FILE)
jlaskey@16198 94
jlaskey@16198 95
ihse@34020 96 MANIFEST_ATTRIBUTES := Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(VERSION_SHORT)
jlaskey@16198 97
jlaskey@16198 98 # Create nashorn.jar from the final classes dir
ihse@20576 99 $(eval $(call SetupArchive,BUILD_NASHORN_JAR, \
ihse@34020 100 DEPENDENCIES := $(NASGEN_RUN_FILE) $(BUILD_VERSION_FILE), \
chegar@25865 101 SRCS := $(NASHORN_CLASSES_DIR), \
ihse@20576 102 SUFFIXES := .class .js .properties Factory, \
chegar@25865 103 MANIFEST := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/META-INF/MANIFEST.MF, \
ihse@20576 104 EXTRA_MANIFEST_ATTR := $(MANIFEST_ATTRIBUTES), \
ihse@20576 105 SKIP_METAINF := true, \
ihse@20576 106 JAR := $(NASHORN_JAR)))
jlaskey@16198 107
ihse@34020 108 compile: $(NASHORN_RUN_FILE) $(BUILD_VERSION_FILE)
jlaskey@16198 109 all: $(NASHORN_JAR)
ihse@20576 110
chegar@25865 111 .PHONY: compile all