Makefile revision 99
906N/A#
906N/A# Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
906N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
906N/A#
906N/A# This code is free software; you can redistribute it and/or modify it
906N/A# under the terms of the GNU General Public License version 2 only, as
906N/A# published by the Free Software Foundation. Sun designates this
906N/A# particular file as subject to the "Classpath" exception as provided
906N/A# by Sun in the LICENSE file that accompanied this code.
906N/A#
906N/A# This code is distributed in the hope that it will be useful, but WITHOUT
906N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
906N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
906N/A# version 2 for more details (a copy is included in the LICENSE file that
906N/A# accompanied this code).
906N/A#
906N/A# You should have received a copy of the GNU General Public License version
906N/A# 2 along with this work; if not, write to the Free Software Foundation,
906N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
906N/A#
906N/A# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2321N/A# CA 95054 USA or visit www.sun.com if you need additional information or
906N/A# have any questions.
906N/A#
906N/A
906N/A# Makefile wrapper around Ant build.xml file
906N/A
2410N/A#
1799N/A# On Solaris, the 'make' utility from Sun will not work with these makefiles.
1799N/A# This little rule is only understood by Sun's make, and is harmless
906N/A# when seen by the GNU make tool. If using Sun's make, this causes the
906N/A# make command to fail.
2410N/A#
1799N/ASUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
1799N/A
906N/Aifdef QUIET
2232N/A ANT_OPTIONS += -quiet
1389N/Aendif
1389N/A
2410N/Aifdef VERBOSE
906N/A ANT_OPTIONS += -verbose
906N/Aendif
906N/A
906N/Aifeq ($(VARIANT), OPT)
906N/A ifneq ($(DEBUG_CLASSFILES), true)
1389N/A ANT_OPTIONS += -Djavac.debug=false
906N/A endif
1799N/Aendif
1799N/A
1799N/A# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
1799N/A# and the somewhat misnamed CLASS_VERSION (-target NN)
1799N/Aifdef TARGET_CLASS_VERSION
906N/A ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
906N/Aelse
906N/A ifdef JAVAC_TARGET_ARG
906N/A ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
1389N/A endif
1389N/Aendif
1389N/A
906N/Aifdef SOURCE_LANGUAGE_VERSION
1389N/A ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
906N/Aelse
906N/A ifdef JAVAC_SOURCE_ARG
1389N/A ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
1799N/A endif
906N/Aendif
906N/A
906N/A# Figure out the platform we are using
2061N/A_SYSTEM_UNAME := $(shell uname)
2121N/A_PLATFORM_KIND = unix
906N/Aifeq ($(_SYSTEM_UNAME), Windows_NT)
2494N/A _PLATFORM_KIND = windows
2494N/Aendif
906N/Aifneq (,$(findstring CYGWIN,$(_SYSTEM_UNAME)))
906N/A _PLATFORM_KIND = windows
906N/Aendif
906N/A
2494N/A# Where is /java in case we need it
2494N/Aifdef ALT_SLASH_JAVA
906N/A _SLASHJAVA = $(ALT_SLASH_JAVA)
906N/Aelse
906N/A ifeq ($(_PLATFORM_KIND), windows)
906N/A _SLASHJAVA=J:/
906N/A else
906N/A _SLASHJAVA=/java
endif
endif
# Do we have the drops already downloaded?
# Check ALT_DROPS_DIR for a full path first,
# before trying to use the devtools path,
# either via ALT_JDK_DEVTOOLS_DIR or /java/devtools.
ifdef ALT_DROPS_DIR
DROPS_DIR = $(ALT_DROPS_DIR)
else
ifdef ALT_JDK_DEVTOOLS_DIR
DROPS_DIR = $(ALT_JDK_DEVTOOLS_DIR)/share/jdk7-drops
else
DROPS_DIR = $(_SLASHJAVA)/devtools/share/jdk7-drops
endif
endif
# Add in path to drops already downloaded
ANT_OPTIONS += -Ddrops.dir=$(DROPS_DIR)
ifdef ALT_OUTPUTDIR
OUTPUTDIR = $(ALT_OUTPUTDIR)
ANT_OPTIONS += -Doutput.dir=$(ALT_OUTPUTDIR)
else
OUTPUTDIR = ..
endif
ifdef ALT_LANGTOOLS_DIST
ifdef ALT_BOOTDIR
ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
ANT_OPTIONS += -Djdk.home=$(ALT_BOOTDIR)
endif
ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap
else
ifdef ALT_JDK_IMPORT_PATH
ANT_JAVA_HOME = JAVA_HOME=$(ALT_JDK_IMPORT_PATH)
ANT_OPTIONS += -Djdk.home=$(ALT_JDK_IMPORT_PATH)
endif
endif
ifdef ANT_HOME
ANT = $(ANT_HOME)/bin/ant
ifneq ($(shell test -x $(ANT); echo $$?), 0)
$(error "$(ANT) not found; please update ANT_HOME")
endif
else
ANT = ant
ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0)
$(error "\"ant\" not found; please set ANT_HOME or put \"ant\" on your PATH")
endif
endif
# Default target and expected 'do everything' target
default: all
# All ant targets of interest
ANT_TARGETS = all source drop_included build dist clobber clean sanity
# Create a make target for each
$(ANT_TARGETS):
cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) -version
cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@
# Help target
define helpenvline
@echo " $1";echo " $2"
endef
help:
@echo "----------------------------------------------------------"
@echo " "
@echo "Help information for this Makefile:"
@echo " "
@echo " Targets (see ant project information for descriptions):"
@echo " $(ANT_TARGETS)"
@echo " "
@echo " Environment or command line variables (all optional):"
$(call helpenvline, ALT_BOOTDIR,\
"JAVA_HOME to use when running ant")
$(call helpenvline, ALT_LANGTOOLS_DIST,\
"path to langtools repository dist directory")
$(call helpenvline, ALT_OUTPUTDIR,\
"path to root of output")
$(call helpenvline, DEBUG_CLASSFILES,\
"if set makes sure ant property javac.debug is true")
$(call helpenvline, JAVAC_SOURCE_ARG,\
"if SOURCE_LANGUAGE_VERSION not set uses this to set ant property javac.source")
$(call helpenvline, JAVAC_TARGET_ARG,\
"if TARGET_CLASS_VERSION not set uses this to set ant property javac.target")
$(call helpenvline, SOURCE_LANGUAGE_VERSION,\
"if set uses this to set ant property javac.source")
$(call helpenvline, QUIET,\
"if set will pass -quiet to ant")
$(call helpenvline, TARGET_CLASS_VERSION,\
"JAVA_HOME to use when running ant")
$(call helpenvline, VARIANT,\
"if set to OPT means optimized build will set javac.debug to false")
$(call helpenvline, VERBOSE,\
"if set will pass -verbose to ant")
@echo " "
@echo "----------------------------------------------------------"
@echo " "
@echo "Ant project file help information:"
@echo " "
@$(ANT_JAVA_HOME) cd .. && $(ANT) $(ANT_OPTIONS) -p
@echo " "
@echo "----------------------------------------------------------"
# Targets for Sun's internal JPRT build system
JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip
jprt_build_product jprt_build_debug jprt_build_fastdebug: all
$(RM) $(JPRT_ARCHIVE_BUNDLE)
( cd $(OUTPUTDIR)/dist && \
zip -q -r $(JPRT_ARCHIVE_BUNDLE) . )
# Declare these phony (not filenames)
.PHONY: $(ANT_TARGETS) \
jprt_build_product jprt_build_debug jprt_build_fastdebug