make/BuildNashorn.gmk

changeset 703
39a3e5a4d6d4
parent 676
779e155419b8
child 767
f6f637d883bd
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/BuildNashorn.gmk	Thu Dec 05 16:37:35 2013 +0400
     1.3 @@ -0,0 +1,112 @@
     1.4 +#
     1.5 +# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Oracle designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Oracle in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 +# or visit www.oracle.com if you need additional information or have any
    1.26 +# questions.
    1.27 +#
    1.28 +
    1.29 +# This must be the first rule
    1.30 +default: all
    1.31 +
    1.32 +-include $(SPEC)
    1.33 +include MakeBase.gmk
    1.34 +include JavaCompilation.gmk
    1.35 +
    1.36 +JDK_CLASSES := $(JDK_OUTPUTDIR)/classes
    1.37 +
    1.38 +NASHORN_JAR := $(NASHORN_DIST)/nashorn.jar
    1.39 +NASHORN_VERSION := $(JDK_VERSION)
    1.40 +NASHORN_FULL_VERSION := $(FULL_VERSION)
    1.41 +
    1.42 +ifdef MILESTONE
    1.43 +  ifeq ($(MILESTONE), internal)
    1.44 +    NASHORN_VERSION = $(FULL_VERSION)
    1.45 +  endif
    1.46 +endif
    1.47 +
    1.48 +# Need to use source and target 7 for nasgen to work.
    1.49 +$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
    1.50 +    JVM := $(JAVA), \
    1.51 +    JAVAC := $(NEW_JAVAC), \
    1.52 +    FLAGS := -g -source 7 -target 7 -bootclasspath $(JDK_CLASSES), \
    1.53 +    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
    1.54 +    SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
    1.55 +
    1.56 +# Build nashorn into intermediate directory
    1.57 +$(eval $(call SetupJavaCompilation,BUILD_NASHORN, \
    1.58 +    SETUP := GENERATE_NEWBYTECODE_DEBUG, \
    1.59 +    SRC := $(NASHORN_TOPDIR)/src, \
    1.60 +    COPY := .properties .js, \
    1.61 +    BIN := $(NASHORN_OUTPUTDIR)/nashorn_classes))
    1.62 +
    1.63 +NASGEN_SRC := $(NASHORN_TOPDIR)/buildtools/nasgen/src
    1.64 +ASM_SRC := $(JDK_TOPDIR)/src/share/classes/jdk/internal/org/objectweb/asm
    1.65 +
    1.66 +# Build nasgen
    1.67 +$(eval $(call SetupJavaCompilation,BUILD_NASGEN, \
    1.68 +    SETUP := GENERATE_NEWBYTECODE_DEBUG, \
    1.69 +    SRC := $(NASGEN_SRC) $(ASM_SRC), \
    1.70 +    BIN := $(NASHORN_OUTPUTDIR)/nasgen_classes, \
    1.71 +    ADD_JAVAC_FLAGS := -cp $(NASHORN_OUTPUTDIR)/nashorn_classes))
    1.72 +
    1.73 +# Nasgen needs nashorn classes
    1.74 +$(BUILD_NASGEN): $(BUILD_NASHORN)
    1.75 +
    1.76 +# Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
    1.77 +$(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run: $(BUILD_NASGEN)
    1.78 +	$(ECHO) Running nasgen
    1.79 +	$(MKDIR) -p $(@D)
    1.80 +	$(RM) -rf $(@D)/jdk $(@D)/netscape
    1.81 +	$(CP) -R -p $(NASHORN_OUTPUTDIR)/nashorn_classes/* $(@D)/
    1.82 +	$(FIXPATH) $(JAVA) \
    1.83 +	    -cp "$(NASHORN_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes" \
    1.84 +	    jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
    1.85 +	$(TOUCH) $@
    1.86 +
    1.87 +# Version file needs to be processed with version numbers
    1.88 +VERSION_FILE := $(NASHORN_OUTPUTDIR)/classes/jdk/nashorn/internal/runtime/resources/version.properties
    1.89 +
    1.90 +# Needs to happen after nasgen run since nasgen run deletes it
    1.91 +$(VERSION_FILE): $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run
    1.92 +$(VERSION_FILE): $(NASHORN_TOPDIR)/src/jdk/nashorn/internal/runtime/resources/version.properties-template
    1.93 +	$(ECHO) Creating version.properties
    1.94 +	$(MKDIR) -p $(@D)
    1.95 +	$(CAT) $< | $(SED) -e 's/$$(FULL_VERSION)/$(NASHORN_FULL_VERSION)/g' \
    1.96 +	    -e 's/$$(RELEASE)/$(NASHORN_VERSION)/g' \
    1.97 +	    -e '/^#.*$$/d' -e '/^$$/d'  > $@
    1.98 +
    1.99 +
   1.100 +MANIFEST_ATTRIBUTES := Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(NASHORN_FULL_VERSION)
   1.101 +
   1.102 +# Create nashorn.jar from the final classes dir
   1.103 +$(eval $(call SetupArchive,BUILD_NASHORN_JAR, \
   1.104 +    $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run \
   1.105 +    $(VERSION_FILE), \
   1.106 +    SRCS := $(NASHORN_OUTPUTDIR)/classes, \
   1.107 +    SUFFIXES := .class .js .properties Factory, \
   1.108 +    MANIFEST := $(NASHORN_TOPDIR)/src/META-INF/MANIFEST.MF, \
   1.109 +    EXTRA_MANIFEST_ATTR := $(MANIFEST_ATTRIBUTES), \
   1.110 +    SKIP_METAINF := true, \
   1.111 +    JAR := $(NASHORN_JAR)))
   1.112 +
   1.113 +all: $(NASHORN_JAR)
   1.114 +
   1.115 +.PHONY: all

mercurial