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