annotate nashorn/make/BuildNashorn.gmk @ 25865:d38d876f1654

8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
author chegar
date Sun, 17 Aug 2014 15:56:32 +0100
parents 20c3810174dc
children 97093836f3b7
rev   line source
jlaskey@16198 1 #
jlaskey@16198 2 # Copyright (c) 2010, 2013, 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
jlaskey@16198 32
chegar@25865 33 JDK_CLASSES := $(subst $(SPACE),$(PATH_SEP),$(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
chegar@25865 34 java.base java.logging java.scripting)))
jlaskey@16198 35
jlaskey@16198 36 NASHORN_JAR := $(NASHORN_DIST)/nashorn.jar
jlaskey@16200 37 NASHORN_VERSION := $(JDK_VERSION)
jlaskey@16200 38 NASHORN_FULL_VERSION := $(FULL_VERSION)
jlaskey@16200 39
jlaskey@16200 40 ifdef MILESTONE
ihse@20576 41 ifeq ($(MILESTONE), internal)
jlaskey@16200 42 NASHORN_VERSION = $(FULL_VERSION)
jlaskey@16200 43 endif
jlaskey@16200 44 endif
jlaskey@16198 45
jlaskey@16198 46 # Need to use source and target 7 for nasgen to work.
ihse@20576 47 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
ihse@20576 48 JVM := $(JAVA), \
ihse@20576 49 JAVAC := $(NEW_JAVAC), \
chegar@25865 50 FLAGS := -g -source 7 -target 7 -bootclasspath "$(JDK_CLASSES)", \
ihse@20576 51 SERVER_DIR := $(SJAVAC_SERVER_DIR), \
ihse@20576 52 SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
jlaskey@16198 53
jlaskey@16198 54 # Build nashorn into intermediate directory
ihse@20576 55 $(eval $(call SetupJavaCompilation,BUILD_NASHORN, \
ihse@20576 56 SETUP := GENERATE_NEWBYTECODE_DEBUG, \
chegar@25865 57 SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes, \
ihse@20576 58 COPY := .properties .js, \
ihse@20576 59 BIN := $(NASHORN_OUTPUTDIR)/nashorn_classes))
jlaskey@16198 60
alanb@16266 61 NASGEN_SRC := $(NASHORN_TOPDIR)/buildtools/nasgen/src
chegar@25865 62 ASM_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
sundar@16265 63
jlaskey@16198 64 # Build nasgen
ihse@20576 65 $(eval $(call SetupJavaCompilation,BUILD_NASGEN, \
ihse@20576 66 SETUP := GENERATE_NEWBYTECODE_DEBUG, \
ihse@20576 67 SRC := $(NASGEN_SRC) $(ASM_SRC), \
ihse@20576 68 BIN := $(NASHORN_OUTPUTDIR)/nasgen_classes, \
ihse@20576 69 ADD_JAVAC_FLAGS := -cp $(NASHORN_OUTPUTDIR)/nashorn_classes))
jlaskey@16198 70
jlaskey@16198 71 # Nasgen needs nashorn classes
jlaskey@16198 72 $(BUILD_NASGEN): $(BUILD_NASHORN)
jlaskey@16198 73
chegar@25865 74 NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn
chegar@25865 75 NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run
chegar@25865 76
jlaskey@16198 77 # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
chegar@25865 78 $(NASGEN_RUN_FILE): $(BUILD_NASGEN)
jlaskey@16198 79 $(ECHO) Running nasgen
jlaskey@16198 80 $(MKDIR) -p $(@D)
jlaskey@16198 81 $(RM) -rf $(@D)/jdk $(@D)/netscape
jlaskey@16198 82 $(CP) -R -p $(NASHORN_OUTPUTDIR)/nashorn_classes/* $(@D)/
sundar@16265 83 $(FIXPATH) $(JAVA) \
simonis@23367 84 -Xbootclasspath/p:"$(NASHORN_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes" \
ihse@20576 85 jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
jlaskey@16198 86 $(TOUCH) $@
jlaskey@16198 87
jlaskey@16198 88 # Version file needs to be processed with version numbers
chegar@25865 89 VERSION_FILE := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn/jdk/nashorn/internal/runtime/resources/version.properties
chegar@25865 90 VERSION_SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties-template
ihse@20576 91
jlaskey@16198 92 # Needs to happen after nasgen run since nasgen run deletes it
chegar@25865 93 $(VERSION_FILE): $(NASGEN_RUN_FILE)
chegar@25865 94 $(VERSION_FILE): $(VERSION_SRC)
jlaskey@16198 95 $(ECHO) Creating version.properties
jlaskey@16198 96 $(MKDIR) -p $(@D)
jlaskey@16200 97 $(CAT) $< | $(SED) -e 's/$$(FULL_VERSION)/$(NASHORN_FULL_VERSION)/g' \
ihse@20576 98 -e 's/$$(RELEASE)/$(NASHORN_VERSION)/g' \
ihse@20576 99 -e '/^#.*$$/d' -e '/^$$/d' > $@
jlaskey@16198 100
jlaskey@16198 101
ihse@20576 102 MANIFEST_ATTRIBUTES := Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(NASHORN_FULL_VERSION)
jlaskey@16198 103
jlaskey@16198 104 # Create nashorn.jar from the final classes dir
ihse@20576 105 $(eval $(call SetupArchive,BUILD_NASHORN_JAR, \
chegar@25865 106 $(NASGEN_RUN_FILE) \
ihse@20576 107 $(VERSION_FILE), \
chegar@25865 108 SRCS := $(NASHORN_CLASSES_DIR), \
ihse@20576 109 SUFFIXES := .class .js .properties Factory, \
chegar@25865 110 MANIFEST := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/META-INF/MANIFEST.MF, \
ihse@20576 111 EXTRA_MANIFEST_ATTR := $(MANIFEST_ATTRIBUTES), \
ihse@20576 112 SKIP_METAINF := true, \
ihse@20576 113 JAR := $(NASHORN_JAR)))
jlaskey@16198 114
chegar@25865 115 compile: $(NASHORN_RUN_FILE) $(VERSION_FILE)
jlaskey@16198 116 all: $(NASHORN_JAR)
ihse@20576 117
chegar@25865 118 .PHONY: compile all