Makefile revision 123
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#
11e9368a226272085c337e9e74b79808c16fbdbaTinderbox User# Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater# This code is free software; you can redistribute it and/or modify it
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# under the terms of the GNU General Public License version 2 only, as
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# published by the Free Software Foundation. Oracle designates this
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# particular file as subject to the "Classpath" exception as provided
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# by Oracle in the LICENSE file that accompanied this code.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This code is distributed in the hope that it will be useful, but WITHOUT
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# version 2 for more details (a copy is included in the LICENSE file that
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# accompanied this code).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox User# You should have received a copy of the GNU General Public License version
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# 2 along with this work; if not, write to the Free Software Foundation,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# or visit www.oracle.com if you need additional information or have any
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# questions.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Makefile wrapper around Ant build.xml file
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# On Solaris, the 'make' utility from Sun will not work with these makefiles.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This little rule is only understood by Sun's make, and is harmless
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews# when seen by the GNU make tool. If using Sun's make, this causes the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# make command to fail.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinSUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinifdef QUIET
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ANT_OPTIONS += -quiet
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinendif
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinifdef VERBOSE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ANT_OPTIONS += -verbose
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinendif
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrewsifeq ($(VARIANT), OPT)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ifneq ($(DEBUG_CLASSFILES), true)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ANT_OPTIONS += -Djavac.debug=false
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein endif
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinendif
11e9368a226272085c337e9e74b79808c16fbdbaTinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
11e9368a226272085c337e9e74b79808c16fbdbaTinderbox User# and the somewhat misnamed CLASS_VERSION (-target NN)
11e9368a226272085c337e9e74b79808c16fbdbaTinderbox Userifdef TARGET_CLASS_VERSION
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinelse
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ifdef JAVAC_TARGET_ARG
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein endif
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinendif
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinifdef SOURCE_LANGUAGE_VERSION
9c6a5d1f22f972232d7a9fd5c5fa64f10bacbdffAutomatic Updater ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userelse
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ifdef JAVAC_SOURCE_ARG
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein endif
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userendif
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Figure out the platform we are using
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein_SYSTEM_UNAME := $(shell uname)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein_PLATFORM_KIND = unix
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinifeq ($(_SYSTEM_UNAME), Windows_NT)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein _PLATFORM_KIND = windows
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinendif
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinifneq (,$(findstring CYGWIN,$(_SYSTEM_UNAME)))
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein _PLATFORM_KIND = windows
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userendif
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Where is /java in case we need it
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinifdef ALT_SLASH_JAVA
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User _SLASHJAVA = $(ALT_SLASH_JAVA)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userelse
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ifeq ($(_PLATFORM_KIND), windows)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User _SLASHJAVA=J:/
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User else
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User _SLASHJAVA=/java
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User endif
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinendif
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater# Do we have the drops already downloaded?
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater# Check ALT_DROPS_DIR for a full path first,
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater# before trying to use the devtools path,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# either via ALT_JDK_DEVTOOLS_DIR or /java/devtools.
77dccf2a5d9327d16b4374a135cdb99bdd48620eAutomatic Updaterifdef ALT_DROPS_DIR
77dccf2a5d9327d16b4374a135cdb99bdd48620eAutomatic Updater DROPS_DIR = $(ALT_DROPS_DIR)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewselse
47012ae6dbf18a2503d7b33c1c9583dc38625cb7Mark Andrews ifdef ALT_JDK_DEVTOOLS_DIR
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater DROPS_DIR = $(ALT_JDK_DEVTOOLS_DIR)/share/jdk7-drops
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater else
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews DROPS_DIR = $(_SLASHJAVA)/devtools/share/jdk7-drops
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce endif
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luceendif
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# Add in path to drops already downloaded
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric LuceANT_OPTIONS += -Ddrops.dir=$(DROPS_DIR)
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luceifdef ALT_OUTPUTDIR
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce OUTPUTDIR = $(ALT_OUTPUTDIR)
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce ANT_OPTIONS += -Doutput.dir=$(ALT_OUTPUTDIR)
47012ae6dbf18a2503d7b33c1c9583dc38625cb7Mark Andrewselse
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce OUTPUTDIR = ..
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luceendif
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luceifdef ALT_LANGTOOLS_DIST
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce ifdef ALT_BOOTDIR
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ANT_OPTIONS += -Djdk.home=$(ALT_BOOTDIR)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User endif
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userelse
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ifdef ALT_JDK_IMPORT_PATH
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ANT_JAVA_HOME = JAVA_HOME=$(ALT_JDK_IMPORT_PATH)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ANT_OPTIONS += -Djdk.home=$(ALT_JDK_IMPORT_PATH)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User endif
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userendif
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userifdef ANT_HOME
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ANT = $(ANT_HOME)/bin/ant
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ifneq ($(shell test -x $(ANT); echo $$?), 0)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(error "$(ANT) not found; please update ANT_HOME")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User endif
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userelse
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ANT = ant
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(error "\"ant\" not found; please set ANT_HOME or put \"ant\" on your PATH")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User endif
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userendif
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User# Default target and expected 'do everything' target
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userdefault: all
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User# All ant targets of interest
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox UserANT_TARGETS = all source drop_included build dist clobber clean sanity
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User# Create a make target for each
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User$(ANT_TARGETS):
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) -version
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User# Help target
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userdefine helpenvline
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User@echo " $1";echo " $2"
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userendef
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userhelp:
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo "----------------------------------------------------------"
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo " "
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo "Help information for this Makefile:"
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo " "
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo " Targets (see ant project information for descriptions):"
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo " $(ANT_TARGETS)"
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo " "
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo " Environment or command line variables (all optional):"
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, ALT_BOOTDIR,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "JAVA_HOME to use when running ant")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, ALT_LANGTOOLS_DIST,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "path to langtools repository dist directory")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, ALT_OUTPUTDIR,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "path to root of output")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, DEBUG_CLASSFILES,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "if set makes sure ant property javac.debug is true")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, JAVAC_SOURCE_ARG,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "if SOURCE_LANGUAGE_VERSION not set uses this to set ant property javac.source")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, JAVAC_TARGET_ARG,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "if TARGET_CLASS_VERSION not set uses this to set ant property javac.target")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, SOURCE_LANGUAGE_VERSION,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "if set uses this to set ant property javac.source")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, QUIET,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "if set will pass -quiet to ant")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, TARGET_CLASS_VERSION,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "JAVA_HOME to use when running ant")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, VARIANT,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "if set to OPT means optimized build will set javac.debug to false")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(call helpenvline, VERBOSE,\
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User "if set will pass -verbose to ant")
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo " "
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo "----------------------------------------------------------"
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo " "
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo "Ant project file help information:"
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo " "
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @$(ANT_JAVA_HOME) cd .. && $(ANT) $(ANT_OPTIONS) -p
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo " "
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User @echo "----------------------------------------------------------"
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User# Targets for Sun's internal JPRT build system
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox UserJPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox Userjprt_build_product jprt_build_debug jprt_build_fastdebug: all
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User $(RM) $(JPRT_ARCHIVE_BUNDLE)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User ( cd $(OUTPUTDIR)/dist && \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User zip -q -r $(JPRT_ARCHIVE_BUNDLE) . )
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User# Declare these phony (not filenames)
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User.PHONY: $(ANT_TARGETS) \
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User jprt_build_product jprt_build_debug jprt_build_fastdebug
aa1905addf2f33d90aa020080e4e77a8651e829aTinderbox User