make/BuildNashorn.gmk

Thu, 12 Oct 2017 19:52:15 +0800

author
aoqi
date
Thu, 12 Oct 2017 19:52:15 +0800
changeset 1205
4112748288bb
parent 1033
bcc569328dfa
parent 952
6d5471a497fb
permissions
-rw-r--r--

merge

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

mercurial