jlaskey@54: # jlaskey@54: # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. jlaskey@54: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jlaskey@54: # jlaskey@54: # This code is free software; you can redistribute it and/or modify it jlaskey@54: # under the terms of the GNU General Public License version 2 only, as jlaskey@54: # published by the Free Software Foundation. Oracle designates this jlaskey@54: # particular file as subject to the "Classpath" exception as provided jlaskey@54: # by Oracle in the LICENSE file that accompanied this code. jlaskey@54: # jlaskey@54: # This code is distributed in the hope that it will be useful, but WITHOUT jlaskey@54: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jlaskey@54: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jlaskey@54: # version 2 for more details (a copy is included in the LICENSE file that jlaskey@54: # accompanied this code). jlaskey@54: # jlaskey@54: # You should have received a copy of the GNU General Public License version jlaskey@54: # 2 along with this work; if not, write to the Free Software Foundation, jlaskey@54: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jlaskey@54: # jlaskey@54: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jlaskey@54: # or visit www.oracle.com if you need additional information or have any jlaskey@54: # questions. jlaskey@54: # jlaskey@54: jlaskey@54: # This must be the first rule jlaskey@54: default: all jlaskey@54: jlaskey@54: -include $(SPEC) jlaskey@54: include MakeBase.gmk jlaskey@54: include JavaCompilation.gmk jlaskey@54: jlaskey@54: JDK_CLASSES := $(JDK_OUTPUTDIR)/classes jlaskey@54: jlaskey@54: NASHORN_JAR := $(NASHORN_DIST)/nashorn.jar jlaskey@56: NASHORN_VERSION := $(JDK_VERSION) jlaskey@56: NASHORN_FULL_VERSION := $(FULL_VERSION) jlaskey@56: jlaskey@56: ifdef MILESTONE ihse@599: ifeq ($(MILESTONE), internal) jlaskey@56: NASHORN_VERSION = $(FULL_VERSION) jlaskey@56: endif jlaskey@56: endif jlaskey@54: jlaskey@54: # Need to use source and target 7 for nasgen to work. ihse@599: $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \ ihse@599: JVM := $(JAVA), \ ihse@599: JAVAC := $(NEW_JAVAC), \ ihse@599: FLAGS := -g -source 7 -target 7 -bootclasspath $(JDK_CLASSES), \ ihse@599: SERVER_DIR := $(SJAVAC_SERVER_DIR), \ ihse@599: SERVER_JVM := $(SJAVAC_SERVER_JAVA))) jlaskey@54: jlaskey@54: # Build nashorn into intermediate directory ihse@599: $(eval $(call SetupJavaCompilation,BUILD_NASHORN, \ ihse@599: SETUP := GENERATE_NEWBYTECODE_DEBUG, \ ihse@599: SRC := $(NASHORN_TOPDIR)/src, \ ihse@599: COPY := .properties .js, \ ihse@599: BIN := $(NASHORN_OUTPUTDIR)/nashorn_classes)) jlaskey@54: alanb@122: NASGEN_SRC := $(NASHORN_TOPDIR)/buildtools/nasgen/src alanb@122: ASM_SRC := $(JDK_TOPDIR)/src/share/classes/jdk/internal/org/objectweb/asm sundar@121: jlaskey@54: # Build nasgen ihse@599: $(eval $(call SetupJavaCompilation,BUILD_NASGEN, \ ihse@599: SETUP := GENERATE_NEWBYTECODE_DEBUG, \ ihse@599: SRC := $(NASGEN_SRC) $(ASM_SRC), \ ihse@599: BIN := $(NASHORN_OUTPUTDIR)/nasgen_classes, \ erikj@1033: ADD_JAVAC_FLAGS := -bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes")) jlaskey@54: jlaskey@54: # Nasgen needs nashorn classes jlaskey@54: $(BUILD_NASGEN): $(BUILD_NASHORN) jlaskey@54: jlaskey@54: # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package jlaskey@54: $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run: $(BUILD_NASGEN) jlaskey@54: $(ECHO) Running nasgen jlaskey@54: $(MKDIR) -p $(@D) jlaskey@54: $(RM) -rf $(@D)/jdk $(@D)/netscape jlaskey@54: $(CP) -R -p $(NASHORN_OUTPUTDIR)/nashorn_classes/* $(@D)/ sundar@121: $(FIXPATH) $(JAVA) \ simonis@767: -Xbootclasspath/p:"$(NASHORN_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes" \ ihse@599: jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D) jlaskey@54: $(TOUCH) $@ jlaskey@54: jlaskey@54: # Version file needs to be processed with version numbers jlaskey@54: VERSION_FILE := $(NASHORN_OUTPUTDIR)/classes/jdk/nashorn/internal/runtime/resources/version.properties ihse@599: jlaskey@54: # Needs to happen after nasgen run since nasgen run deletes it jlaskey@54: $(VERSION_FILE): $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run jlaskey@54: $(VERSION_FILE): $(NASHORN_TOPDIR)/src/jdk/nashorn/internal/runtime/resources/version.properties-template jlaskey@54: $(ECHO) Creating version.properties jlaskey@54: $(MKDIR) -p $(@D) jlaskey@56: $(CAT) $< | $(SED) -e 's/$$(FULL_VERSION)/$(NASHORN_FULL_VERSION)/g' \ ihse@599: -e 's/$$(RELEASE)/$(NASHORN_VERSION)/g' \ ihse@599: -e '/^#.*$$/d' -e '/^$$/d' > $@ jlaskey@54: jlaskey@54: ihse@599: MANIFEST_ATTRIBUTES := Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(NASHORN_FULL_VERSION) jlaskey@54: jlaskey@54: # Create nashorn.jar from the final classes dir ihse@599: $(eval $(call SetupArchive,BUILD_NASHORN_JAR, \ jlaskey@54: $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run \ ihse@599: $(VERSION_FILE), \ ihse@599: SRCS := $(NASHORN_OUTPUTDIR)/classes, \ ihse@599: SUFFIXES := .class .js .properties Factory, \ ihse@599: MANIFEST := $(NASHORN_TOPDIR)/src/META-INF/MANIFEST.MF, \ ihse@599: EXTRA_MANIFEST_ATTR := $(MANIFEST_ATTRIBUTES), \ ihse@599: SKIP_METAINF := true, \ ihse@599: JAR := $(NASHORN_JAR))) jlaskey@54: jlaskey@54: all: $(NASHORN_JAR) ihse@599: jlaskey@54: .PHONY: all