jlaskey@3: # jlaskey@7: # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. jlaskey@3: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jlaskey@3: # jlaskey@3: # This code is free software; you can redistribute it and/or modify it jlaskey@3: # under the terms of the GNU General Public License version 2 only, as jlaskey@3: # published by the Free Software Foundation. Oracle designates this jlaskey@3: # particular file as subject to the "Classpath" exception as provided jlaskey@3: # by Oracle in the LICENSE file that accompanied this code. jlaskey@3: # jlaskey@3: # This code is distributed in the hope that it will be useful, but WITHOUT jlaskey@3: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jlaskey@3: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jlaskey@3: # version 2 for more details (a copy is included in the LICENSE file that jlaskey@3: # accompanied this code). jlaskey@3: # jlaskey@3: # You should have received a copy of the GNU General Public License version jlaskey@3: # 2 along with this work; if not, write to the Free Software Foundation, jlaskey@3: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jlaskey@3: # jlaskey@3: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jlaskey@3: # or visit www.oracle.com if you need additional information or have any jlaskey@3: # questions. jlaskey@3: # jlaskey@3: jlaskey@3: # Makefile for nashorn: wrapper around Ant build.xml file jlaskey@3: jlaskey@3: # jlaskey@3: # On Solaris, the standard 'make' utility will not work with these makefiles. jlaskey@3: # This little rule is only understood by Solaris make, and is harmless jlaskey@3: # when seen by the GNU make tool. If using Solaris make, this causes the jlaskey@3: # make command to fail. jlaskey@3: # jlaskey@3: SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33 jlaskey@3: jlaskey@3: # jlaskey@3: # Minimal platform defs jlaskey@3: # Need FullPath because we can't rely on gnumake abspath, until we use v3.81 jlaskey@3: # jlaskey@3: jlaskey@3: SYSTEM_UNAME := $(shell uname) jlaskey@3: jlaskey@3: # Where is unwanted output to be delivered? jlaskey@3: # On Windows, MKS uses the special file "NUL", cygwin uses the customary unix file. jlaskey@3: ifeq ($(SYSTEM_UNAME), Windows_NT) jlaskey@3: DEV_NULL = NUL jlaskey@3: else jlaskey@3: DEV_NULL = /dev/null jlaskey@3: endif jlaskey@3: jlaskey@3: ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME))) jlaskey@3: USING_CYGWIN = true jlaskey@3: endif jlaskey@3: jlaskey@3: ifdef USING_CYGWIN jlaskey@3: define FullPath jlaskey@3: $(shell cygpath -a -s -m $1 2> $(DEV_NULL)) jlaskey@3: endef jlaskey@3: else jlaskey@3: define FullPath jlaskey@3: $(shell cd $1 2> $(DEV_NULL) && pwd) jlaskey@3: endef jlaskey@3: endif jlaskey@3: jlaskey@3: # jlaskey@3: # Makefile args jlaskey@3: # jlaskey@3: jlaskey@3: ifdef QUIET jlaskey@3: ANT_OPTIONS += -quiet jlaskey@3: endif jlaskey@3: jlaskey@3: ifdef VERBOSE jlaskey@3: ANT_OPTIONS += -verbose -debug jlaskey@3: endif jlaskey@3: jlaskey@3: ifdef JDK_VERSION jlaskey@3: ANT_OPTIONS += -Djdk.version=$(JDK_VERSION) jlaskey@3: endif jlaskey@3: jlaskey@3: ifdef FULL_VERSION jlaskey@3: ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces jlaskey@3: endif jlaskey@3: jlaskey@3: ifdef MILESTONE jlaskey@3: ifneq ($(MILESTONE),fcs) jlaskey@3: ANT_OPTIONS += -Dmilestone=$(MILESTONE) jlaskey@3: else jlaskey@3: ANT_OPTIONS += -Drelease=$(JDK_VERSION) jlaskey@3: endif jlaskey@3: endif jlaskey@3: jlaskey@3: ifdef BUILD_NUMBER jlaskey@3: ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER) jlaskey@3: else jlaskey@3: ifdef JDK_BUILD_NUMBER jlaskey@3: ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER) jlaskey@3: endif jlaskey@3: endif jlaskey@3: jlaskey@3: ifeq ($(VARIANT), DBG) jlaskey@3: ANT_OPTIONS += -Djavac.debug=true jlaskey@3: else jlaskey@3: ifeq ($(VARIANT), OPT) jlaskey@3: ANT_OPTIONS += -Djavac.debug=false jlaskey@3: endif jlaskey@3: endif jlaskey@3: jlaskey@3: ifeq ($(DEBUG_CLASSFILES), true) jlaskey@3: ANT_OPTIONS += -Djavac.debug=true jlaskey@3: ANT_OPTIONS += -Ddebug.classfiles=true jlaskey@3: endif jlaskey@3: jlaskey@3: # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN) jlaskey@3: # and the somewhat misnamed CLASS_VERSION (-target NN) jlaskey@3: ifdef TARGET_CLASS_VERSION jlaskey@3: ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION) jlaskey@3: else jlaskey@3: ifdef JAVAC_TARGET_ARG jlaskey@3: ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG) jlaskey@3: endif jlaskey@3: endif jlaskey@3: jlaskey@3: ifdef SOURCE_LANGUAGE_VERSION jlaskey@3: ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION) jlaskey@3: else jlaskey@3: ifdef JAVAC_SOURCE_ARG jlaskey@3: ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG) jlaskey@3: endif jlaskey@3: endif jlaskey@3: jlaskey@3: # To facilitate bootstrapping, much of langtools can be compiled with (just) jlaskey@3: # a boot JDK. However, some source files need to be compiled against jlaskey@3: # new JDK API. In a bootstrap build, an import JDK may not be available, jlaskey@3: # so build.xml can also build against the source files in a jdk repo, jlaskey@3: # in which case it will automatically generate stub files for the new JDK API. jlaskey@3: ifdef JDK_TOPDIR jlaskey@3: ANT_OPTIONS += -Dimport.jdk=$(JDK_TOPDIR) jlaskey@3: else jlaskey@3: ifdef ALT_JDK_TOPDIR jlaskey@3: ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_TOPDIR) jlaskey@3: else jlaskey@3: ifdef ALT_JDK_IMPORT_PATH jlaskey@3: ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_IMPORT_PATH) jlaskey@3: endif jlaskey@3: endif jlaskey@3: endif jlaskey@3: jlaskey@3: ifdef ALT_OUTPUTDIR jlaskey@3: OUTPUTDIR = $(ALT_OUTPUTDIR) jlaskey@3: ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build jlaskey@3: ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist jlaskey@3: else jlaskey@3: OUTPUTDIR = .. jlaskey@3: endif jlaskey@3: #ABS_OUTPUTDIR = $(abspath $(OUTPUTDIR)) jlaskey@3: ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR)) jlaskey@3: jlaskey@3: ANT_TMPDIR = $(ABS_OUTPUTDIR)/build/ant-tmp jlaskey@3: ANT_OPTS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)' jlaskey@3: jlaskey@3: ifdef FINDBUGS_HOME jlaskey@3: ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME) jlaskey@3: endif jlaskey@3: jlaskey@3: ifdef ANT_HOME jlaskey@3: ANT = $(ANT_HOME)/bin/ant jlaskey@3: ifneq ($(shell test -x $(ANT) && echo OK), OK) jlaskey@3: $(error $(ANT) not found -- please update ANT_HOME) jlaskey@3: endif jlaskey@3: else jlaskey@3: ANT = ant jlaskey@3: ifneq ($(shell test -x "`which $(ANT)`" && echo OK), OK) jlaskey@3: $(error 'ant' not found -- please set ANT_HOME or put 'ant' on your PATH) jlaskey@3: endif jlaskey@3: endif jlaskey@3: jlaskey@3: # Default target and expected 'do everything' target sundar@82: all: test jlaskey@3: jlaskey@3: # Standard make clobber target jlaskey@3: clobber: clean jlaskey@3: jlaskey@3: # All ant targets of interest sundar@26: ANT_TARGETS = clean externals update-externals jar javadoc shelldoc docs test test262 test262parallel octane sunspider perf alltests jlaskey@3: jlaskey@3: # Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1) jlaskey@3: $(OUTPUTDIR)/build/ant-diagnostics.log: jlaskey@3: @mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR) jlaskey@3: @$(RM) $@ jlaskey@3: $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@ ; \ jlaskey@3: $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@ jlaskey@3: jlaskey@3: # Create a make target for each jlaskey@3: $(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log jlaskey@3: @ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR) jlaskey@3: $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@ jlaskey@3: jlaskey@3: #------------------------------------------------------------------- jlaskey@3: # jlaskey@3: # Targets for Oracle's internal JPRT build system jlaskey@3: jlaskey@3: CD = cd jlaskey@3: ZIP = zip jlaskey@3: jlaskey@3: JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip jlaskey@3: jlaskey@3: jprt_build_product jprt_build_debug jprt_build_fastdebug: all jlaskey@3: ( $(CD) $(OUTPUTDIR) && \ jlaskey@3: $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist ) jlaskey@3: jlaskey@3: #------------------------------------------------------------------- jlaskey@3: jlaskey@3: # Declare these phony (not filenames) jlaskey@3: .PHONY: $(ANT_TARGETS) all clobber \ jlaskey@3: jprt_build_product jprt_build_debug jprt_build_fastdebug