annotate nashorn/make/BuildNashorn.gmk @ 32152:705d4af0d4d7

8133347: Add makefiles support and basic session, persistence history navigation with jline Reviewed-by: erikj, jlahoda, jlaskey
author sundar
date Thu, 13 Aug 2015 19:07:27 +0530
parents 11a170ff3549
children 0dab24cf1c3c d1868a6ad5f8
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
erikj@26892 32 include SetupJavaCompilers.gmk
jlaskey@16198 33
chegar@25865 34 JDK_CLASSES := $(subst $(SPACE),$(PATH_SEP),$(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
chegar@25865 35 java.base java.logging java.scripting)))
jlaskey@16198 36
chegar@27571 37 NASHORN_JAR := $(IMAGES_OUTPUTDIR)/nashorn.jar
jlaskey@16200 38 NASHORN_VERSION := $(JDK_VERSION)
jlaskey@16200 39 NASHORN_FULL_VERSION := $(FULL_VERSION)
jlaskey@16200 40
jlaskey@16200 41 ifdef MILESTONE
ihse@20576 42 ifeq ($(MILESTONE), internal)
jlaskey@16200 43 NASHORN_VERSION = $(FULL_VERSION)
jlaskey@16200 44 endif
jlaskey@16200 45 endif
jlaskey@16198 46
attila@29134 47 # Need to use source and target 8 for nasgen to work.
ihse@20576 48 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
ihse@20576 49 JVM := $(JAVA), \
ihse@20576 50 JAVAC := $(NEW_JAVAC), \
attila@29134 51 FLAGS := -g -source 8 -target 8 -bootclasspath "$(JDK_CLASSES)", \
ihse@20576 52 SERVER_DIR := $(SJAVAC_SERVER_DIR), \
ihse@20576 53 SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
jlaskey@16198 54
jlaskey@16198 55 # Build nashorn into intermediate directory
sundar@32152 56 # Name the compilation setup the same as the module, as is done in the global
sundar@32152 57 # CompileJavaModules.gmk, to make dependency checking with other modules work
sundar@32152 58 # seamlessly.
sundar@32152 59 $(eval $(call SetupJavaCompilation,jdk.scripting.nashorn, \
ihse@20576 60 SETUP := GENERATE_NEWBYTECODE_DEBUG, \
chegar@25865 61 SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes, \
chegar@27571 62 EXCLUDE_FILES := META-INF/MANIFEST.MF, \
ihse@20576 63 COPY := .properties .js, \
erikj@31486 64 BIN := $(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/classes))
jlaskey@16198 65
alanb@16266 66 NASGEN_SRC := $(NASHORN_TOPDIR)/buildtools/nasgen/src
chegar@25865 67 ASM_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
sundar@16265 68
jlaskey@16198 69 # Build nasgen
ihse@20576 70 $(eval $(call SetupJavaCompilation,BUILD_NASGEN, \
erikj@26892 71 SETUP := GENERATE_OLDBYTECODE, \
ihse@20576 72 SRC := $(NASGEN_SRC) $(ASM_SRC), \
chegar@27571 73 BIN := $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes, \
erikj@31486 74 ADD_JAVAC_FLAGS := -Xbootclasspath/p:"$(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/classes"))
jlaskey@16198 75
jlaskey@16198 76 # Nasgen needs nashorn classes
sundar@32152 77 $(BUILD_NASGEN): $(jdk.scripting.nashorn)
jlaskey@16198 78
chegar@25865 79 NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn
chegar@25865 80 NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run
chegar@25865 81
jlaskey@16198 82 # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
chegar@25865 83 $(NASGEN_RUN_FILE): $(BUILD_NASGEN)
jlaskey@16198 84 $(ECHO) Running nasgen
jlaskey@16198 85 $(MKDIR) -p $(@D)
jlaskey@16198 86 $(RM) -rf $(@D)/jdk $(@D)/netscape
erikj@31486 87 $(CP) -R -p $(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/classes/* $(@D)/
sundar@16265 88 $(FIXPATH) $(JAVA) \
erikj@31486 89 -Xbootclasspath/p:"$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/classes" \
ihse@20576 90 jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
jlaskey@16198 91 $(TOUCH) $@
jlaskey@16198 92
jlaskey@16198 93 # Version file needs to be processed with version numbers
chegar@25865 94 VERSION_FILE := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn/jdk/nashorn/internal/runtime/resources/version.properties
chegar@25865 95 VERSION_SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties-template
ihse@20576 96
jlaskey@16198 97 # Needs to happen after nasgen run since nasgen run deletes it
chegar@25865 98 $(VERSION_FILE): $(NASGEN_RUN_FILE)
chegar@25865 99 $(VERSION_FILE): $(VERSION_SRC)
jlaskey@16198 100 $(ECHO) Creating version.properties
jlaskey@16198 101 $(MKDIR) -p $(@D)
jlaskey@16200 102 $(CAT) $< | $(SED) -e 's/$$(FULL_VERSION)/$(NASHORN_FULL_VERSION)/g' \
ihse@20576 103 -e 's/$$(RELEASE)/$(NASHORN_VERSION)/g' \
ihse@20576 104 -e '/^#.*$$/d' -e '/^$$/d' > $@
jlaskey@16198 105
jlaskey@16198 106
ihse@20576 107 MANIFEST_ATTRIBUTES := Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(NASHORN_FULL_VERSION)
jlaskey@16198 108
jlaskey@16198 109 # Create nashorn.jar from the final classes dir
ihse@20576 110 $(eval $(call SetupArchive,BUILD_NASHORN_JAR, \
erikj@29415 111 DEPENDENCIES := $(NASGEN_RUN_FILE) \
erikj@29415 112 $(VERSION_FILE), \
chegar@25865 113 SRCS := $(NASHORN_CLASSES_DIR), \
ihse@20576 114 SUFFIXES := .class .js .properties Factory, \
chegar@25865 115 MANIFEST := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/META-INF/MANIFEST.MF, \
ihse@20576 116 EXTRA_MANIFEST_ATTR := $(MANIFEST_ATTRIBUTES), \
ihse@20576 117 SKIP_METAINF := true, \
ihse@20576 118 JAR := $(NASHORN_JAR)))
jlaskey@16198 119
chegar@25865 120 compile: $(NASHORN_RUN_FILE) $(VERSION_FILE)
jlaskey@16198 121 all: $(NASHORN_JAR)
ihse@20576 122
chegar@25865 123 .PHONY: compile all