Makefile revision 87
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews#
205c10066a0acfeac52d1a135671f41d207b8557Automatic Updater# Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
205c10066a0acfeac52d1a135671f41d207b8557Automatic Updater# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater#
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# This code is free software; you can redistribute it and/or modify it
2bb3422dc683c013db7042f5736240de6b86f182Automatic Updater# under the terms of the GNU General Public License version 2 only, as
75b70a68aefaa17ac4e768d5ed85d2f50d471490Automatic Updater# published by the Free Software Foundation. Sun designates this
2ec4ab21838e218863d052ebfa3e106e04f50820Evan Hunt# particular file as subject to the "Classpath" exception as provided
ea854b585041ad19f70f7af15e08144ef2c2bd1bMark Andrews# by Sun in the LICENSE file that accompanied this code.
78cb74fab4665da2e2641ba909c6f59f74cc4193Automatic Updater#
c89d02f2fb4c06168236d600e86831cff324f763Mark Andrews# This code is distributed in the hope that it will be useful, but WITHOUT
90ff38a0d8deaf5f9c2aa5916d99b2e572d28738Automatic Updater# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# version 2 for more details (a copy is included in the LICENSE file that
6c6a121295b30772cbf3dd75a51fb9d883051a0eAutomatic Updater# accompanied this code).
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington#
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater# You should have received a copy of the GNU General Public License version
bc0a53583d92309bebcf93c408e2f3247ebd3d3cAutomatic Updater# 2 along with this work; if not, write to the Free Software Foundation,
56874aef380a64a2c183b7c282c3e7a361d67fa1Automatic Updater# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews#
96713299d08c0735c18ebe8772dd2cc1ecd4356aAutomatic Updater# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
3cc98b8ecedcbc8465f1cf2740b966b315662430Automatic Updater# CA 95054 USA or visit www.sun.com if you need additional information or
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# have any questions.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews#
96713299d08c0735c18ebe8772dd2cc1ecd4356aAutomatic Updater
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater# Makefile wrapper around Ant build.xml file
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater#
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# On Solaris, the 'make' utility from Sun will not work with these makefiles.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# This little rule is only understood by Sun's make, and is harmless
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# when seen by the GNU make tool. If using Sun's make, this causes the
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# make command to fail.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater#
91216cff91b34c9ff6e846dc23f248219cafe660Andreas GustafssonSUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterifdef QUIET
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater ANT_OPTIONS += -quiet
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Huntendif
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterifdef VERBOSE
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt ANT_OPTIONS += -verbose
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterendif
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterifeq ($(VARIANT), OPT)
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt ifneq ($(DEBUG_CLASSFILES), true)
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updater ANT_OPTIONS += -Djavac.debug=false
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updater endif
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Huntendif
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# and the somewhat misnamed CLASS_VERSION (-target NN)
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterifdef TARGET_CLASS_VERSION
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updaterelse
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater ifdef JAVAC_TARGET_ARG
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater endif
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterendif
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrewsifdef SOURCE_LANGUAGE_VERSION
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrewselse
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington ifdef JAVAC_SOURCE_ARG
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews endif
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updaterendif
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Figure out the platform we are using
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater_SYSTEM_UNAME := $(shell uname)
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews_PLATFORM_KIND = unix
db5b7e2cdf150c46e8242d3e2e3ad3f5c7300258Automatic Updaterifeq ($(_SYSTEM_UNAME), Windows_NT)
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater _PLATFORM_KIND = windows
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsendif
1a06700908f5a1d9f4a8d51285a0fd971e2f9117Automatic Updaterifneq (,$(findstring CYGWIN,$(_SYSTEM_UNAME)))
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews _PLATFORM_KIND = windows
db5b7e2cdf150c46e8242d3e2e3ad3f5c7300258Automatic Updaterendif
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Where is /java in case we need it
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterifdef ALT_SLASH_JAVA
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson _SLASHJAVA = $(ALT_SLASH_JAVA)
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterelse
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater ifeq ($(_PLATFORM_KIND), windows)
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews _SLASHJAVA=J:/
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater else
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson _SLASHJAVA=/java
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater endif
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterendif
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# Where is /java/devtools in case we need it
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updaterifdef ALT_JDK_DEVTOOLS_DIR
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater _DEVTOOLS = $(ALT_JDK_DEVTOOLS_DIR)
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updaterelse
55e03fc54708d97917bf26639b987f759bdc1f44Automatic Updater _DEVTOOLS = $(_SLASHJAVA)/devtools
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updaterendif
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updater
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont# Add in path to devtools
52367885450d8f61d4f2d63292beb15ba8f39ac7Automatic UpdaterANT_OPTIONS += -Ddevtools=$(_DEVTOOLS)
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater
2a31bd531072824ef252c18303859d6af7451b00Francis Dupontifdef ALT_OUTPUTDIR
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews OUTPUTDIR = $(ALT_OUTPUTDIR)
52367885450d8f61d4f2d63292beb15ba8f39ac7Automatic Updater ANT_OPTIONS += -Doutput.dir=$(ALT_OUTPUTDIR)
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updaterelse
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews OUTPUTDIR = ..
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updaterendif
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updaterifdef ALT_LANGTOOLS_DIST
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater ifdef ALT_BOOTDIR
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
b29e5c56eb74a6de1a84c29879afc90ffc6b1436Automatic Updater endif
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updaterelse
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews ifdef ALT_JDK_IMPORT_PATH
0977f3f39ef6728516be7976452b9122c8f5607aAutomatic Updater ANT_JAVA_HOME = JAVA_HOME=$(ALT_JDK_IMPORT_PATH)
ae7e54b14c946e0984c191554db9abb4893f9349Automatic Updater endif
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsendif
ae7e54b14c946e0984c191554db9abb4893f9349Automatic Updater
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updaterifdef ANT_HOME
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater ANT = $(ANT_HOME)/bin/ant
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater ifneq ($(shell test -x $(ANT); echo $$?), 0)
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater $(error "$(ANT) not found; please update ANT_HOME")
fe80a4909bf62b602feaf246866e9d29f7654194Automatic Updater endif
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterelse
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater ANT = ant
fe80a4909bf62b602feaf246866e9d29f7654194Automatic Updater ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0)
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater $(error "\"ant\" not found; please set ANT_HOME or put \"ant\" on your PATH")
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater endif
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssonendif
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# Default target and expected 'do everything' target
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssondefault: all
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater# All ant targets of interest
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic UpdaterANT_TARGETS = all source build dist clobber clean sanity
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater# Create a make target for each
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater$(ANT_TARGETS):
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater cd .. && $(ANT_JAVA_HOME) $(ANT) -version
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater
4104e236f71eb5108fcfda6711878a97f6f4a8e7Automatic Updater# Help target
0df8ead472f207020f8da22a185fe4b945248ab8Automatic Updaterdefine helpenvline
e8c7dc2a5ce48f11c07a67c9923eeb8f419ff19fEvan Hunt@echo " $1";echo " $2"
0ce87e5749aabb8eef1e0a37e4bd6e6ffa1d7196Automatic Updaterendef
0ce87e5749aabb8eef1e0a37e4bd6e6ffa1d7196Automatic Updaterhelp:
0df8ead472f207020f8da22a185fe4b945248ab8Automatic Updater @echo "----------------------------------------------------------"
2bb3422dc683c013db7042f5736240de6b86f182Automatic Updater @echo " "
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater @echo "Help information for this Makefile:"
0df8ead472f207020f8da22a185fe4b945248ab8Automatic Updater @echo " "
3b6e4c84a525b0b3fc9e8affd8bb9fa5c000345fAutomatic Updater @echo " Targets (see ant project information for descriptions):"
19b3dc94bce93fa76bd7e066f9298630dbc9dcb4Automatic Updater @echo " $(ANT_TARGETS)"
d145b64cacc8d9cda51f9924ec70cd4661c3e2cfAutomatic Updater @echo " "
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater @echo " Environment or command line variables (all optional):"
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater $(call helpenvline, ALT_BOOTDIR,\
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater "JAVA_HOME to use when running ant")
c243d779731a410f8dc2d2feeed20c15f299b6e3Automatic Updater $(call helpenvline, ALT_LANGTOOLS_DIST,\
0df8ead472f207020f8da22a185fe4b945248ab8Automatic Updater "path to langtools repository dist directory")
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater $(call helpenvline, ALT_OUTPUTDIR,\
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater "path to root of output")
bc0a53583d92309bebcf93c408e2f3247ebd3d3cAutomatic Updater $(call helpenvline, DEBUG_CLASSFILES,\
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater "if set makes sure ant property javac.debug is true")
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater $(call helpenvline, JAVAC_SOURCE_ARG,\
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater "if SOURCE_LANGUAGE_VERSION not set uses this to set ant property javac.source")
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater $(call helpenvline, JAVAC_TARGET_ARG,\
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater "if TARGET_CLASS_VERSION not set uses this to set ant property javac.target")
7f79131f9a8e804b93c57f3c679065cce878b726Automatic Updater $(call helpenvline, SOURCE_LANGUAGE_VERSION,\
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater "if set uses this to set ant property javac.source")
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater $(call helpenvline, QUIET,\
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater "if set will pass -quiet to ant")
7f94d9a8162c9a96b56e66176702b66e79d8e1a2Automatic Updater $(call helpenvline, TARGET_CLASS_VERSION,\
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater "JAVA_HOME to use when running ant")
19b3dc94bce93fa76bd7e066f9298630dbc9dcb4Automatic Updater $(call helpenvline, VARIANT,\
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater "if set to OPT means optimized build will set javac.debug to false")
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater $(call helpenvline, VERBOSE,\
7f94d9a8162c9a96b56e66176702b66e79d8e1a2Automatic Updater "if set will pass -verbose to ant")
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater @echo " "
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater @echo "----------------------------------------------------------"
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater @echo " "
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater @echo "Ant project file help information:"
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater @echo " "
71bd43eebd9d6e42dbcae62b730f5b6508d5acd8Automatic Updater @$(ANT_JAVA_HOME) cd .. && $(ANT) $(ANT_OPTIONS) -p
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater @echo " "
7262eb86f2b465822206122921e2f357218f0cfdAutomatic Updater @echo "----------------------------------------------------------"
96ea71632887c58a9d00f47eb318bf76b35903c3Mark Andrews
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# Targets for Sun's internal JPRT build system
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic UpdaterJPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip
bbb069be941f649228760edcc241122933c066d2Automatic Updaterjprt_build_product jprt_build_debug jprt_build_fastdebug: all
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater $(RM) $(JPRT_ARCHIVE_BUNDLE)
4cda4fd158d6ded5586bacea8c388445d99611eaAutomatic Updater ( cd $(OUTPUTDIR)/dist && \
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews zip -q -r $(JPRT_ARCHIVE_BUNDLE) . )
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater# Declare these phony (not filenames)
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews.PHONY: $(ANT_TARGETS) \
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater jprt_build_product jprt_build_debug jprt_build_fastdebug
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater