duke@1: # ohair@194: # Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. duke@1: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: # duke@1: # This code is free software; you can redistribute it and/or modify it duke@1: # under the terms of the GNU General Public License version 2 only, as ohair@116: # published by the Free Software Foundation. Oracle designates this duke@1: # particular file as subject to the "Classpath" exception as provided ohair@116: # by Oracle in the LICENSE file that accompanied this code. duke@1: # duke@1: # This code is distributed in the hope that it will be useful, but WITHOUT duke@1: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: # version 2 for more details (a copy is included in the LICENSE file that duke@1: # accompanied this code). duke@1: # duke@1: # You should have received a copy of the GNU General Public License version duke@1: # 2 along with this work; if not, write to the Free Software Foundation, duke@1: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: # ohair@116: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@116: # or visit www.oracle.com if you need additional information or have any ohair@116: # questions. duke@1: # duke@1: ohair@85: # Makefile wrapper around Ant build.xml file duke@1: duke@1: # duke@1: # On Solaris, the 'make' utility from Sun will not work with these makefiles. duke@1: # This little rule is only understood by Sun's make, and is harmless duke@1: # when seen by the GNU make tool. If using Sun's make, this causes the duke@1: # make command to fail. duke@1: # duke@1: SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33 duke@1: duke@1: ifdef QUIET duke@1: ANT_OPTIONS += -quiet duke@1: endif duke@1: duke@1: ifdef VERBOSE duke@1: ANT_OPTIONS += -verbose duke@1: endif duke@1: ohair@85: ifeq ($(VARIANT), OPT) ohair@85: ifneq ($(DEBUG_CLASSFILES), true) duke@1: ANT_OPTIONS += -Djavac.debug=false duke@1: endif duke@1: endif duke@1: ohair@4: # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN) duke@1: # and the somewhat misnamed CLASS_VERSION (-target NN) duke@1: ifdef TARGET_CLASS_VERSION duke@1: ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION) duke@1: else duke@1: ifdef JAVAC_TARGET_ARG duke@1: ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG) duke@1: endif duke@1: endif duke@1: jjg@63: ifdef SOURCE_LANGUAGE_VERSION jjg@63: ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION) jjg@63: else jjg@63: ifdef JAVAC_SOURCE_ARG jjg@63: ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG) jjg@63: endif jjg@63: endif jjg@63: ohair@124: # If downloads are allowed ohair@124: ifeq ($(ALLOW_DOWNLOADS),true) ohair@124: ANT_OPTIONS += -Dallow.downloads=true ohair@124: endif ohair@124: ohair@85: # Figure out the platform we are using ohair@85: _SYSTEM_UNAME := $(shell uname) ohair@85: _PLATFORM_KIND = unix ohair@85: ifeq ($(_SYSTEM_UNAME), Windows_NT) ohair@85: _PLATFORM_KIND = windows duke@1: endif ohair@85: ifneq (,$(findstring CYGWIN,$(_SYSTEM_UNAME))) ohair@85: _PLATFORM_KIND = windows ohair@85: endif ohair@85: ohair@85: # Where is /java in case we need it ohair@85: ifdef ALT_SLASH_JAVA ohair@85: _SLASHJAVA = $(ALT_SLASH_JAVA) ohair@85: else ohair@85: ifeq ($(_PLATFORM_KIND), windows) ohair@85: _SLASHJAVA=J:/ ohair@85: else ohair@85: _SLASHJAVA=/java ohair@85: endif ohair@85: endif ohair@85: duke@1: ifdef ALT_OUTPUTDIR duke@1: OUTPUTDIR = $(ALT_OUTPUTDIR) ohair@85: ANT_OPTIONS += -Doutput.dir=$(ALT_OUTPUTDIR) duke@1: else duke@1: OUTPUTDIR = .. duke@1: endif duke@1: duke@1: ifdef ALT_LANGTOOLS_DIST ohair@85: ifdef ALT_BOOTDIR ohair@85: ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR) ohair@95: ANT_OPTIONS += -Djdk.home=$(ALT_BOOTDIR) ohair@85: endif duke@1: ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap ohair@85: else ohair@85: ifdef ALT_JDK_IMPORT_PATH ohair@85: ANT_JAVA_HOME = JAVA_HOME=$(ALT_JDK_IMPORT_PATH) ohair@95: ANT_OPTIONS += -Djdk.home=$(ALT_JDK_IMPORT_PATH) ohair@85: endif duke@1: endif duke@1: duke@1: ifdef ANT_HOME duke@1: ANT = $(ANT_HOME)/bin/ant duke@1: ifneq ($(shell test -x $(ANT); echo $$?), 0) duke@1: $(error "$(ANT) not found; please update ANT_HOME") duke@1: endif duke@1: else duke@1: ANT = ant duke@1: ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0) ohair@188: $(error "'ant' not found; please set ANT_HOME or put 'ant' on your PATH") duke@1: endif duke@1: endif duke@1: duke@1: # Default target and expected 'do everything' target ohair@85: default: all duke@1: duke@1: # All ant targets of interest ohair@286: ANT_TARGETS = all build dist clobber clean sanity duke@1: duke@1: # Create a make target for each duke@1: $(ANT_TARGETS): ohair@95: cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) -version ohair@85: cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@ ohair@85: ohair@286: # Just for compat reasons, delete in future. ohair@286: drop_included: ohair@286: source: ohair@286: ohair@85: # Help target ohair@85: define helpenvline ohair@85: @echo " $1";echo " $2" ohair@85: endef ohair@85: help: ohair@85: @echo "----------------------------------------------------------" ohair@85: @echo " " ohair@85: @echo "Help information for this Makefile:" ohair@85: @echo " " ohair@85: @echo " Targets (see ant project information for descriptions):" ohair@85: @echo " $(ANT_TARGETS)" ohair@85: @echo " " ohair@85: @echo " Environment or command line variables (all optional):" ohair@85: $(call helpenvline, ALT_BOOTDIR,\ ohair@85: "JAVA_HOME to use when running ant") ohair@85: $(call helpenvline, ALT_LANGTOOLS_DIST,\ ohair@85: "path to langtools repository dist directory") ohair@85: $(call helpenvline, ALT_OUTPUTDIR,\ ohair@85: "path to root of output") ohair@85: $(call helpenvline, DEBUG_CLASSFILES,\ ohair@85: "if set makes sure ant property javac.debug is true") ohair@85: $(call helpenvline, JAVAC_SOURCE_ARG,\ ohair@85: "if SOURCE_LANGUAGE_VERSION not set uses this to set ant property javac.source") ohair@85: $(call helpenvline, JAVAC_TARGET_ARG,\ ohair@85: "if TARGET_CLASS_VERSION not set uses this to set ant property javac.target") ohair@85: $(call helpenvline, SOURCE_LANGUAGE_VERSION,\ ohair@85: "if set uses this to set ant property javac.source") ohair@85: $(call helpenvline, QUIET,\ ohair@85: "if set will pass -quiet to ant") ohair@85: $(call helpenvline, TARGET_CLASS_VERSION,\ ohair@85: "JAVA_HOME to use when running ant") ohair@85: $(call helpenvline, VARIANT,\ ohair@85: "if set to OPT means optimized build will set javac.debug to false") ohair@85: $(call helpenvline, VERBOSE,\ ohair@85: "if set will pass -verbose to ant") ohair@85: @echo " " ohair@85: @echo "----------------------------------------------------------" ohair@85: @echo " " ohair@85: @echo "Ant project file help information:" ohair@85: @echo " " ohair@85: @$(ANT_JAVA_HOME) cd .. && $(ANT) $(ANT_OPTIONS) -p ohair@85: @echo " " ohair@85: @echo "----------------------------------------------------------" duke@1: duke@1: # Targets for Sun's internal JPRT build system ohair@4: JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip duke@1: jprt_build_product jprt_build_debug jprt_build_fastdebug: all ohair@4: $(RM) $(JPRT_ARCHIVE_BUNDLE) ohair@4: ( cd $(OUTPUTDIR)/dist && \ ohair@4: zip -q -r $(JPRT_ARCHIVE_BUNDLE) . ) duke@1: duke@1: # Declare these phony (not filenames) ohair@85: .PHONY: $(ANT_TARGETS) \ duke@1: jprt_build_product jprt_build_debug jprt_build_fastdebug