annotate nashorn/make/BuildNashorn.gmk @ 36517:41a1c20eb619

8142968: Module System implementation Summary: Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282 Reviewed-by: mhaupt, hannesw Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, sundararajan.athijegannathan@oracle.com, erik.joelsson@oracle.com
author alanb
date Thu, 17 Mar 2016 19:04:35 +0000
parents 84eaea8d0574
children 22ae7151aae7
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
ihse@33535 31 include JarArchive.gmk
jlaskey@16198 32 include JavaCompilation.gmk
erikj@26892 33 include SetupJavaCompilers.gmk
ihse@34020 34 include TextFileProcessing.gmk
jlaskey@16198 35
ihse@32526 36 JDK_CLASSES := $(call PathList, $(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
attila@34447 37 java.base java.logging java.scripting jdk.dynalink)))
jlaskey@16198 38
chegar@27571 39 NASHORN_JAR := $(IMAGES_OUTPUTDIR)/nashorn.jar
jlaskey@16198 40
alanb@36517 41 MODULESOURCEPATH := $(NASHORN_TOPDIR)/src/*/share/classes
alanb@36517 42
attila@29134 43 # Need to use source and target 8 for nasgen to work.
ihse@20576 44 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
ihse@20576 45 JVM := $(JAVA), \
ihse@20576 46 JAVAC := $(NEW_JAVAC), \
alanb@36517 47 FLAGS := -g -source 9 -target 9 -upgrademodulepath "$(JDK_OUTPUTDIR)/modules/" \
alanb@36517 48 -system none -modulesourcepath "$(MODULESOURCEPATH)", \
ihse@20576 49 SERVER_DIR := $(SJAVAC_SERVER_DIR), \
ihse@20576 50 SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
jlaskey@16198 51
jlaskey@16198 52 # Build nashorn into intermediate directory
sundar@32152 53 # Name the compilation setup the same as the module, as is done in the global
sundar@32152 54 # CompileJavaModules.gmk, to make dependency checking with other modules work
sundar@32152 55 # seamlessly.
sundar@32152 56 $(eval $(call SetupJavaCompilation,jdk.scripting.nashorn, \
ihse@20576 57 SETUP := GENERATE_NEWBYTECODE_DEBUG, \
alanb@36517 58 MODULE := jdk.scripting.nashorn, \
chegar@25865 59 SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes, \
chegar@27571 60 EXCLUDE_FILES := META-INF/MANIFEST.MF, \
ihse@20576 61 COPY := .properties .js, \
alanb@36517 62 BIN := $(SUPPORT_OUTPUTDIR)/special_classes))
jlaskey@16198 63
alanb@16266 64 NASGEN_SRC := $(NASHORN_TOPDIR)/buildtools/nasgen/src
chegar@25865 65 ASM_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
sundar@16265 66
jlaskey@16198 67 # Build nasgen
ihse@20576 68 $(eval $(call SetupJavaCompilation,BUILD_NASGEN, \
erikj@26892 69 SETUP := GENERATE_OLDBYTECODE, \
ihse@20576 70 SRC := $(NASGEN_SRC) $(ASM_SRC), \
alanb@36517 71 BIN := $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes))
jlaskey@16198 72
chegar@25865 73 NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn
chegar@25865 74 NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run
chegar@25865 75
alanb@36517 76 ifeq ($(BOOT_JDK_MODULAR), true)
alanb@36517 77 NASGEN_OPTIONS := \
alanb@36517 78 -cp $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
alanb@36517 79 -Xpatch:$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
alanb@36517 80 -XaddExports:$(subst $(SPACE),$(COMMA),$(strip \
alanb@36517 81 java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
alanb@36517 82 java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED \
alanb@36517 83 ))
alanb@36517 84 else
alanb@36517 85 NASGEN_OPTIONS := \
alanb@36517 86 -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes
alanb@36517 87 endif
alanb@36517 88
jlaskey@16198 89 # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
alanb@36517 90 $(NASGEN_RUN_FILE): $(BUILD_NASGEN) $(jdk.scripting.nashorn)
jlaskey@16198 91 $(ECHO) Running nasgen
jlaskey@16198 92 $(MKDIR) -p $(@D)
jlaskey@16198 93 $(RM) -rf $(@D)/jdk $(@D)/netscape
alanb@36517 94 $(CP) -R -p $(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/* $(@D)/
alanb@36517 95 $(JAVA) $(NASGEN_OPTIONS) \
ihse@20576 96 jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
jlaskey@16198 97 $(TOUCH) $@
jlaskey@16198 98
jlaskey@16198 99 # Version file needs to be processed with version numbers
ihse@34020 100 $(eval $(call SetupTextFileProcessing, BUILD_VERSION_FILE, \
ihse@34020 101 SOURCE_FILES := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties.template, \
ihse@34020 102 OUTPUT_FILE := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn/jdk/nashorn/internal/runtime/resources/version.properties, \
ihse@34020 103 REPLACEMENTS := \
ihse@34020 104 @@VERSION_STRING@@ => $(VERSION_STRING) ; \
ihse@34020 105 @@VERSION_SHORT@@ => $(VERSION_SHORT) , \
ihse@34020 106 ))
ihse@20576 107
ihse@34020 108 # Version processing needs to happen after nasgen run since nasgen run deletes it
ihse@34020 109 $(BUILD_VERSION_FILE): $(NASGEN_RUN_FILE)
jlaskey@16198 110
jlaskey@16198 111
ihse@34020 112 MANIFEST_ATTRIBUTES := Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(VERSION_SHORT)
jlaskey@16198 113
jlaskey@16198 114 # Create nashorn.jar from the final classes dir
iris@34039 115 $(eval $(call SetupJarArchive,BUILD_NASHORN_JAR, \
ihse@34020 116 DEPENDENCIES := $(NASGEN_RUN_FILE) $(BUILD_VERSION_FILE), \
chegar@25865 117 SRCS := $(NASHORN_CLASSES_DIR), \
ihse@20576 118 SUFFIXES := .class .js .properties Factory, \
chegar@25865 119 MANIFEST := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/META-INF/MANIFEST.MF, \
ihse@20576 120 EXTRA_MANIFEST_ATTR := $(MANIFEST_ATTRIBUTES), \
ihse@20576 121 SKIP_METAINF := true, \
ihse@33535 122 JAR := $(NASHORN_JAR), \
ihse@33535 123 ))
jlaskey@16198 124
ihse@34020 125 compile: $(NASHORN_RUN_FILE) $(BUILD_VERSION_FILE)
jlaskey@16198 126 all: $(NASHORN_JAR)
ihse@20576 127
chegar@25865 128 .PHONY: compile all