J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 1 | # |
Kelly O'Hair | 502320f | 2011-04-06 20:15:38 -0700 | [diff] [blame] | 2 | # Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | # |
| 5 | # This code is free software; you can redistribute it and/or modify it |
| 6 | # under the terms of the GNU General Public License version 2 only, as |
Kelly O'Hair | 149a47c | 2010-05-25 15:52:44 -0700 | [diff] [blame] | 7 | # published by the Free Software Foundation. Oracle designates this |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 8 | # particular file as subject to the "Classpath" exception as provided |
Kelly O'Hair | 149a47c | 2010-05-25 15:52:44 -0700 | [diff] [blame] | 9 | # by Oracle in the LICENSE file that accompanied this code. |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 10 | # |
| 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | # version 2 for more details (a copy is included in the LICENSE file that |
| 15 | # accompanied this code). |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License version |
| 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | # |
Kelly O'Hair | 149a47c | 2010-05-25 15:52:44 -0700 | [diff] [blame] | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 22 | # or visit www.oracle.com if you need additional information or have any |
| 23 | # questions. |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 24 | # |
| 25 | |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 26 | # Makefile wrapper around Ant build.xml file |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 27 | |
| 28 | # |
| 29 | # On Solaris, the 'make' utility from Sun will not work with these makefiles. |
| 30 | # This little rule is only understood by Sun's make, and is harmless |
| 31 | # when seen by the GNU make tool. If using Sun's make, this causes the |
| 32 | # make command to fail. |
| 33 | # |
| 34 | SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33 |
| 35 | |
| 36 | ifdef QUIET |
| 37 | ANT_OPTIONS += -quiet |
| 38 | endif |
| 39 | |
| 40 | ifdef VERBOSE |
| 41 | ANT_OPTIONS += -verbose |
| 42 | endif |
| 43 | |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 44 | ifeq ($(VARIANT), OPT) |
| 45 | ifneq ($(DEBUG_CLASSFILES), true) |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 46 | ANT_OPTIONS += -Djavac.debug=false |
| 47 | endif |
| 48 | endif |
| 49 | |
| 50 | # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN) |
| 51 | # and the somewhat misnamed CLASS_VERSION (-target NN) |
| 52 | ifdef TARGET_CLASS_VERSION |
| 53 | ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION) |
| 54 | else |
| 55 | ifdef JAVAC_TARGET_ARG |
| 56 | ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG) |
| 57 | endif |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 58 | endif |
Jonathan Gibbons | 3cba287 | 2009-05-20 13:45:44 -0700 | [diff] [blame] | 59 | |
| 60 | ifdef SOURCE_LANGUAGE_VERSION |
| 61 | ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION) |
| 62 | else |
| 63 | ifdef JAVAC_SOURCE_ARG |
| 64 | ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG) |
| 65 | endif |
| 66 | endif |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 67 | |
Kelly O'Hair | cafa9bd | 2010-06-17 10:50:14 -0700 | [diff] [blame] | 68 | # If downloads are allowed |
| 69 | ifeq ($(ALLOW_DOWNLOADS),true) |
| 70 | ANT_OPTIONS += -Dallow.downloads=true |
| 71 | endif |
| 72 | |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 73 | # Figure out the platform we are using |
| 74 | _SYSTEM_UNAME := $(shell uname) |
| 75 | _PLATFORM_KIND = unix |
| 76 | ifeq ($(_SYSTEM_UNAME), Windows_NT) |
| 77 | _PLATFORM_KIND = windows |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 78 | endif |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 79 | ifneq (,$(findstring CYGWIN,$(_SYSTEM_UNAME))) |
| 80 | _PLATFORM_KIND = windows |
| 81 | endif |
| 82 | |
| 83 | # Where is /java in case we need it |
| 84 | ifdef ALT_SLASH_JAVA |
| 85 | _SLASHJAVA = $(ALT_SLASH_JAVA) |
| 86 | else |
| 87 | ifeq ($(_PLATFORM_KIND), windows) |
| 88 | _SLASHJAVA=J:/ |
| 89 | else |
| 90 | _SLASHJAVA=/java |
| 91 | endif |
| 92 | endif |
| 93 | |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 94 | ifdef ALT_OUTPUTDIR |
| 95 | OUTPUTDIR = $(ALT_OUTPUTDIR) |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 96 | ANT_OPTIONS += -Doutput.dir=$(ALT_OUTPUTDIR) |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 97 | else |
| 98 | OUTPUTDIR = .. |
| 99 | endif |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 100 | |
| 101 | ifdef ALT_LANGTOOLS_DIST |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 102 | ifdef ALT_BOOTDIR |
| 103 | ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR) |
Kelly O'Hair | 59ea6ab | 2009-11-11 11:17:51 -0800 | [diff] [blame] | 104 | ANT_OPTIONS += -Djdk.home=$(ALT_BOOTDIR) |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 105 | endif |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 106 | ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 107 | else |
| 108 | ifdef ALT_JDK_IMPORT_PATH |
| 109 | ANT_JAVA_HOME = JAVA_HOME=$(ALT_JDK_IMPORT_PATH) |
Kelly O'Hair | 59ea6ab | 2009-11-11 11:17:51 -0800 | [diff] [blame] | 110 | ANT_OPTIONS += -Djdk.home=$(ALT_JDK_IMPORT_PATH) |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 111 | endif |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 112 | endif |
| 113 | |
| 114 | ifdef ANT_HOME |
| 115 | ANT = $(ANT_HOME)/bin/ant |
| 116 | ifneq ($(shell test -x $(ANT); echo $$?), 0) |
| 117 | $(error "$(ANT) not found; please update ANT_HOME") |
| 118 | endif |
| 119 | else |
| 120 | ANT = ant |
| 121 | ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0) |
Kelly O'Hair | 07f4c19 | 2011-03-10 13:21:59 -0800 | [diff] [blame] | 122 | $(error "'ant' not found; please set ANT_HOME or put 'ant' on your PATH") |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 123 | endif |
| 124 | endif |
| 125 | |
| 126 | # Default target and expected 'do everything' target |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 127 | default: all |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 128 | |
| 129 | # All ant targets of interest |
Kelly O'Hair | 13c4ad8 | 2012-03-04 11:55:34 -0800 | [diff] [blame] | 130 | ANT_TARGETS = all build dist clobber clean sanity |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 131 | |
| 132 | # Create a make target for each |
| 133 | $(ANT_TARGETS): |
Kelly O'Hair | 59ea6ab | 2009-11-11 11:17:51 -0800 | [diff] [blame] | 134 | cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) -version |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 135 | cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@ |
| 136 | |
Kelly O'Hair | 13c4ad8 | 2012-03-04 11:55:34 -0800 | [diff] [blame] | 137 | # Just for compat reasons, delete in future. |
| 138 | drop_included: |
| 139 | source: |
| 140 | |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 141 | # Help target |
| 142 | define helpenvline |
| 143 | @echo " $1";echo " $2" |
| 144 | endef |
| 145 | help: |
| 146 | @echo "----------------------------------------------------------" |
| 147 | @echo " " |
| 148 | @echo "Help information for this Makefile:" |
| 149 | @echo " " |
| 150 | @echo " Targets (see ant project information for descriptions):" |
| 151 | @echo " $(ANT_TARGETS)" |
| 152 | @echo " " |
| 153 | @echo " Environment or command line variables (all optional):" |
| 154 | $(call helpenvline, ALT_BOOTDIR,\ |
| 155 | "JAVA_HOME to use when running ant") |
| 156 | $(call helpenvline, ALT_LANGTOOLS_DIST,\ |
| 157 | "path to langtools repository dist directory") |
| 158 | $(call helpenvline, ALT_OUTPUTDIR,\ |
| 159 | "path to root of output") |
| 160 | $(call helpenvline, DEBUG_CLASSFILES,\ |
| 161 | "if set makes sure ant property javac.debug is true") |
| 162 | $(call helpenvline, JAVAC_SOURCE_ARG,\ |
| 163 | "if SOURCE_LANGUAGE_VERSION not set uses this to set ant property javac.source") |
| 164 | $(call helpenvline, JAVAC_TARGET_ARG,\ |
| 165 | "if TARGET_CLASS_VERSION not set uses this to set ant property javac.target") |
| 166 | $(call helpenvline, SOURCE_LANGUAGE_VERSION,\ |
| 167 | "if set uses this to set ant property javac.source") |
| 168 | $(call helpenvline, QUIET,\ |
| 169 | "if set will pass -quiet to ant") |
| 170 | $(call helpenvline, TARGET_CLASS_VERSION,\ |
| 171 | "JAVA_HOME to use when running ant") |
| 172 | $(call helpenvline, VARIANT,\ |
| 173 | "if set to OPT means optimized build will set javac.debug to false") |
| 174 | $(call helpenvline, VERBOSE,\ |
| 175 | "if set will pass -verbose to ant") |
| 176 | @echo " " |
| 177 | @echo "----------------------------------------------------------" |
| 178 | @echo " " |
| 179 | @echo "Ant project file help information:" |
| 180 | @echo " " |
| 181 | @$(ANT_JAVA_HOME) cd .. && $(ANT) $(ANT_OPTIONS) -p |
| 182 | @echo " " |
| 183 | @echo "----------------------------------------------------------" |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 184 | |
| 185 | # Targets for Sun's internal JPRT build system |
Kelly O'Hair | 12028b6 | 2008-03-04 10:58:04 -0800 | [diff] [blame] | 186 | JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 187 | jprt_build_product jprt_build_debug jprt_build_fastdebug: all |
Kelly O'Hair | 12028b6 | 2008-03-04 10:58:04 -0800 | [diff] [blame] | 188 | $(RM) $(JPRT_ARCHIVE_BUNDLE) |
| 189 | ( cd $(OUTPUTDIR)/dist && \ |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 190 | zip -q -r $(JPRT_ARCHIVE_BUNDLE) . ) |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 191 | |
| 192 | # Declare these phony (not filenames) |
Kelly O'Hair | 31015d2 | 2009-09-21 13:54:55 -0700 | [diff] [blame] | 193 | .PHONY: $(ANT_TARGETS) \ |
J. Duke | 74f4779 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 194 | jprt_build_product jprt_build_debug jprt_build_fastdebug |