make/BuildNashorn.gmk

Fri, 05 Jun 2015 12:38:53 +0200

author
mhaupt
date
Fri, 05 Jun 2015 12:38:53 +0200
changeset 1398
2f1b9f4daec1
parent 1033
bcc569328dfa
child 1205
4112748288bb
permissions
-rw-r--r--

8080087: Nashorn $ENV.PWD is originally undefined
Summary: On Windows, the PWD environment variable does not exist and cannot be imported in scripting mode, so it is set explicitly.
Reviewed-by: lagergren, sundar

jlaskey@54 1 #
jlaskey@54 2 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
jlaskey@54 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jlaskey@54 4 #
jlaskey@54 5 # This code is free software; you can redistribute it and/or modify it
jlaskey@54 6 # under the terms of the GNU General Public License version 2 only, as
jlaskey@54 7 # published by the Free Software Foundation. Oracle designates this
jlaskey@54 8 # particular file as subject to the "Classpath" exception as provided
jlaskey@54 9 # by Oracle in the LICENSE file that accompanied this code.
jlaskey@54 10 #
jlaskey@54 11 # This code is distributed in the hope that it will be useful, but WITHOUT
jlaskey@54 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jlaskey@54 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jlaskey@54 14 # version 2 for more details (a copy is included in the LICENSE file that
jlaskey@54 15 # accompanied this code).
jlaskey@54 16 #
jlaskey@54 17 # You should have received a copy of the GNU General Public License version
jlaskey@54 18 # 2 along with this work; if not, write to the Free Software Foundation,
jlaskey@54 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jlaskey@54 20 #
jlaskey@54 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jlaskey@54 22 # or visit www.oracle.com if you need additional information or have any
jlaskey@54 23 # questions.
jlaskey@54 24 #
jlaskey@54 25
jlaskey@54 26 # This must be the first rule
jlaskey@54 27 default: all
jlaskey@54 28
jlaskey@54 29 -include $(SPEC)
jlaskey@54 30 include MakeBase.gmk
jlaskey@54 31 include JavaCompilation.gmk
jlaskey@54 32
jlaskey@54 33 JDK_CLASSES := $(JDK_OUTPUTDIR)/classes
jlaskey@54 34
jlaskey@54 35 NASHORN_JAR := $(NASHORN_DIST)/nashorn.jar
jlaskey@56 36 NASHORN_VERSION := $(JDK_VERSION)
jlaskey@56 37 NASHORN_FULL_VERSION := $(FULL_VERSION)
jlaskey@56 38
jlaskey@56 39 ifdef MILESTONE
ihse@599 40 ifeq ($(MILESTONE), internal)
jlaskey@56 41 NASHORN_VERSION = $(FULL_VERSION)
jlaskey@56 42 endif
jlaskey@56 43 endif
jlaskey@54 44
jlaskey@54 45 # Need to use source and target 7 for nasgen to work.
ihse@599 46 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
ihse@599 47 JVM := $(JAVA), \
ihse@599 48 JAVAC := $(NEW_JAVAC), \
ihse@599 49 FLAGS := -g -source 7 -target 7 -bootclasspath $(JDK_CLASSES), \
ihse@599 50 SERVER_DIR := $(SJAVAC_SERVER_DIR), \
ihse@599 51 SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
jlaskey@54 52
jlaskey@54 53 # Build nashorn into intermediate directory
ihse@599 54 $(eval $(call SetupJavaCompilation,BUILD_NASHORN, \
ihse@599 55 SETUP := GENERATE_NEWBYTECODE_DEBUG, \
ihse@599 56 SRC := $(NASHORN_TOPDIR)/src, \
ihse@599 57 COPY := .properties .js, \
ihse@599 58 BIN := $(NASHORN_OUTPUTDIR)/nashorn_classes))
jlaskey@54 59
alanb@122 60 NASGEN_SRC := $(NASHORN_TOPDIR)/buildtools/nasgen/src
alanb@122 61 ASM_SRC := $(JDK_TOPDIR)/src/share/classes/jdk/internal/org/objectweb/asm
sundar@121 62
jlaskey@54 63 # Build nasgen
ihse@599 64 $(eval $(call SetupJavaCompilation,BUILD_NASGEN, \
ihse@599 65 SETUP := GENERATE_NEWBYTECODE_DEBUG, \
ihse@599 66 SRC := $(NASGEN_SRC) $(ASM_SRC), \
ihse@599 67 BIN := $(NASHORN_OUTPUTDIR)/nasgen_classes, \
erikj@1033 68 ADD_JAVAC_FLAGS := -bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes"))
jlaskey@54 69
jlaskey@54 70 # Nasgen needs nashorn classes
jlaskey@54 71 $(BUILD_NASGEN): $(BUILD_NASHORN)
jlaskey@54 72
jlaskey@54 73 # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
jlaskey@54 74 $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run: $(BUILD_NASGEN)
jlaskey@54 75 $(ECHO) Running nasgen
jlaskey@54 76 $(MKDIR) -p $(@D)
jlaskey@54 77 $(RM) -rf $(@D)/jdk $(@D)/netscape
jlaskey@54 78 $(CP) -R -p $(NASHORN_OUTPUTDIR)/nashorn_classes/* $(@D)/
sundar@121 79 $(FIXPATH) $(JAVA) \
simonis@767 80 -Xbootclasspath/p:"$(NASHORN_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes" \
ihse@599 81 jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
jlaskey@54 82 $(TOUCH) $@
jlaskey@54 83
jlaskey@54 84 # Version file needs to be processed with version numbers
jlaskey@54 85 VERSION_FILE := $(NASHORN_OUTPUTDIR)/classes/jdk/nashorn/internal/runtime/resources/version.properties
ihse@599 86
jlaskey@54 87 # Needs to happen after nasgen run since nasgen run deletes it
jlaskey@54 88 $(VERSION_FILE): $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run
jlaskey@54 89 $(VERSION_FILE): $(NASHORN_TOPDIR)/src/jdk/nashorn/internal/runtime/resources/version.properties-template
jlaskey@54 90 $(ECHO) Creating version.properties
jlaskey@54 91 $(MKDIR) -p $(@D)
jlaskey@56 92 $(CAT) $< | $(SED) -e 's/$$(FULL_VERSION)/$(NASHORN_FULL_VERSION)/g' \
ihse@599 93 -e 's/$$(RELEASE)/$(NASHORN_VERSION)/g' \
ihse@599 94 -e '/^#.*$$/d' -e '/^$$/d' > $@
jlaskey@54 95
jlaskey@54 96
ihse@599 97 MANIFEST_ATTRIBUTES := Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(NASHORN_FULL_VERSION)
jlaskey@54 98
jlaskey@54 99 # Create nashorn.jar from the final classes dir
ihse@599 100 $(eval $(call SetupArchive,BUILD_NASHORN_JAR, \
jlaskey@54 101 $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run \
ihse@599 102 $(VERSION_FILE), \
ihse@599 103 SRCS := $(NASHORN_OUTPUTDIR)/classes, \
ihse@599 104 SUFFIXES := .class .js .properties Factory, \
ihse@599 105 MANIFEST := $(NASHORN_TOPDIR)/src/META-INF/MANIFEST.MF, \
ihse@599 106 EXTRA_MANIFEST_ATTR := $(MANIFEST_ATTRIBUTES), \
ihse@599 107 SKIP_METAINF := true, \
ihse@599 108 JAR := $(NASHORN_JAR)))
jlaskey@54 109
jlaskey@54 110 all: $(NASHORN_JAR)
ihse@599 111
jlaskey@54 112 .PHONY: all

mercurial