annotate nashorn/make/BuildNashorn.gmk @ 41240:1c5f97d2d3fb

8166965: Some small java build tools are still running with big JVM configuration Reviewed-by: ihse
author erikj
date Tue, 04 Oct 2016 13:41:52 +0200
parents ba60b24b1308
children 08dc0d412096
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
erikj@41240 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, \
erikj@41240 45 JVM := $(JAVA_JAVAC), \
ihse@20576 46 JAVAC := $(NEW_JAVAC), \
mchung@40286 47 FLAGS := -g -source 9 -target 9 --upgrade-module-path "$(JDK_OUTPUTDIR)/modules/" \
mchung@40286 48 --system none --module-source-path "$(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 \
mchung@40286 79 --patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
mchung@40286 80 --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
mchung@40286 81 --add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED \
alanb@37827 82 #
alanb@36517 83 else
alanb@36517 84 NASGEN_OPTIONS := \
alanb@36517 85 -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes
alanb@36517 86 endif
alanb@36517 87
jlaskey@16198 88 # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
alanb@36517 89 $(NASGEN_RUN_FILE): $(BUILD_NASGEN) $(jdk.scripting.nashorn)
jlaskey@16198 90 $(ECHO) Running nasgen
jlaskey@16198 91 $(MKDIR) -p $(@D)
jlaskey@16198 92 $(RM) -rf $(@D)/jdk $(@D)/netscape
alanb@36517 93 $(CP) -R -p $(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/* $(@D)/
erikj@41240 94 $(JAVA_SMALL) $(NASGEN_OPTIONS) \
ihse@20576 95 jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
jlaskey@16198 96 $(TOUCH) $@
jlaskey@16198 97
jlaskey@16198 98 # Version file needs to be processed with version numbers
ihse@34020 99 $(eval $(call SetupTextFileProcessing, BUILD_VERSION_FILE, \
ihse@34020 100 SOURCE_FILES := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties.template, \
ihse@34020 101 OUTPUT_FILE := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn/jdk/nashorn/internal/runtime/resources/version.properties, \
ihse@34020 102 REPLACEMENTS := \
ihse@34020 103 @@VERSION_STRING@@ => $(VERSION_STRING) ; \
ihse@34020 104 @@VERSION_SHORT@@ => $(VERSION_SHORT) , \
ihse@34020 105 ))
ihse@20576 106
ihse@34020 107 # Version processing needs to happen after nasgen run since nasgen run deletes it
ihse@34020 108 $(BUILD_VERSION_FILE): $(NASGEN_RUN_FILE)
jlaskey@16198 109
jlaskey@16198 110
ihse@34020 111 MANIFEST_ATTRIBUTES := Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(VERSION_SHORT)
jlaskey@16198 112
jlaskey@16198 113 # Create nashorn.jar from the final classes dir
iris@34039 114 $(eval $(call SetupJarArchive,BUILD_NASHORN_JAR, \
ihse@34020 115 DEPENDENCIES := $(NASGEN_RUN_FILE) $(BUILD_VERSION_FILE), \
chegar@25865 116 SRCS := $(NASHORN_CLASSES_DIR), \
ihse@20576 117 SUFFIXES := .class .js .properties Factory, \
chegar@25865 118 MANIFEST := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/META-INF/MANIFEST.MF, \
ihse@20576 119 EXTRA_MANIFEST_ATTR := $(MANIFEST_ATTRIBUTES), \
ihse@20576 120 SKIP_METAINF := true, \
ihse@33535 121 JAR := $(NASHORN_JAR), \
ihse@33535 122 ))
jlaskey@16198 123
ihse@34020 124 compile: $(NASHORN_RUN_FILE) $(BUILD_VERSION_FILE)
jlaskey@16198 125 all: $(NASHORN_JAR)
ihse@20576 126
chegar@25865 127 .PHONY: compile all