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