[2] | 1 | #
|
---|
[278] | 2 | # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
---|
[2] | 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
|
---|
[278] | 7 | # published by the Free Software Foundation. Oracle designates this
|
---|
[2] | 8 | # particular file as subject to the "Classpath" exception as provided
|
---|
[278] | 9 | # by Oracle in the LICENSE file that accompanied this code.
|
---|
[2] | 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 | #
|
---|
[278] | 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.
|
---|
[2] | 24 | #
|
---|
| 25 |
|
---|
| 26 | # Makefile wrapper around Ant build.xml file
|
---|
| 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 |
|
---|
| 44 | ifeq ($(VARIANT), OPT)
|
---|
| 45 | ifneq ($(DEBUG_CLASSFILES), true)
|
---|
| 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
|
---|
| 58 | endif
|
---|
| 59 |
|
---|
| 60 | ifdef SOURCE_LANGUAGE_VERSION
|
---|
| 61 | ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
|
---|
| 62 | else
|
---|
[72] | 63 | ifdef JAVAC_SOURCE_ARG
|
---|
[2] | 64 | ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
|
---|
| 65 | endif
|
---|
[72] | 66 | endif
|
---|
[2] | 67 |
|
---|
[278] | 68 | # If downloads are allowed
|
---|
| 69 | ifeq ($(ALLOW_DOWNLOADS),true)
|
---|
| 70 | ANT_OPTIONS += -Dallow.downloads=true
|
---|
| 71 | endif
|
---|
| 72 |
|
---|
[2] | 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
|
---|
| 78 | endif
|
---|
| 79 | ifneq (,$(findstring CYGWIN,$(_SYSTEM_UNAME)))
|
---|
| 80 | _PLATFORM_KIND = windows
|
---|
| 81 | endif
|
---|
[72] | 82 | ifeq ($(_SYSTEM_UNAME), OS/2)
|
---|
| 83 | _PLATFORM_KIND = os2
|
---|
| 84 | endif
|
---|
[2] | 85 |
|
---|
| 86 | # Where is /java in case we need it
|
---|
| 87 | ifdef ALT_SLASH_JAVA
|
---|
| 88 | _SLASHJAVA = $(ALT_SLASH_JAVA)
|
---|
| 89 | else
|
---|
[72] | 90 | ifeq ($(filter-out windows os2, $(_PLATFORM_KIND)),)
|
---|
[2] | 91 | _SLASHJAVA=J:/
|
---|
| 92 | else
|
---|
| 93 | _SLASHJAVA=/java
|
---|
| 94 | endif
|
---|
| 95 | endif
|
---|
| 96 |
|
---|
| 97 | # Do we have the drops already downloaded?
|
---|
| 98 | # Check ALT_DROPS_DIR for a full path first,
|
---|
| 99 | # before trying to use the devtools path,
|
---|
| 100 | # either via ALT_JDK_DEVTOOLS_DIR or /java/devtools.
|
---|
| 101 | ifdef ALT_DROPS_DIR
|
---|
| 102 | DROPS_DIR = $(ALT_DROPS_DIR)
|
---|
| 103 | else
|
---|
| 104 | ifdef ALT_JDK_DEVTOOLS_DIR
|
---|
| 105 | DROPS_DIR = $(ALT_JDK_DEVTOOLS_DIR)/share/jdk6-drops
|
---|
| 106 | else
|
---|
| 107 | DROPS_DIR = $(_SLASHJAVA)/devtools/share/jdk6-drops
|
---|
| 108 | endif
|
---|
| 109 | endif
|
---|
| 110 |
|
---|
| 111 | # Add in path to drops already downloaded
|
---|
| 112 | ANT_OPTIONS += -Ddrops.dir=$(DROPS_DIR)
|
---|
| 113 |
|
---|
| 114 | ifdef ALT_OUTPUTDIR
|
---|
| 115 | OUTPUTDIR = $(ALT_OUTPUTDIR)
|
---|
| 116 | ANT_OPTIONS += -Doutput.dir=$(ALT_OUTPUTDIR)
|
---|
| 117 | else
|
---|
| 118 | OUTPUTDIR = ..
|
---|
| 119 | endif
|
---|
| 120 |
|
---|
| 121 | ifdef ALT_LANGTOOLS_DIST
|
---|
| 122 | ifdef ALT_BOOTDIR
|
---|
| 123 | ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
|
---|
| 124 | ANT_OPTIONS += -Djdk.home=$(ALT_BOOTDIR)
|
---|
| 125 | endif
|
---|
| 126 | ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap
|
---|
| 127 | else
|
---|
| 128 | ifdef ALT_JDK_IMPORT_PATH
|
---|
| 129 | ANT_JAVA_HOME = JAVA_HOME=$(ALT_JDK_IMPORT_PATH)
|
---|
| 130 | ANT_OPTIONS += -Djdk.home=$(ALT_JDK_IMPORT_PATH)
|
---|
| 131 | endif
|
---|
| 132 | endif
|
---|
| 133 |
|
---|
| 134 | ifdef ANT_HOME
|
---|
[72] | 135 | ifeq ($(PLATFORM), windows)
|
---|
| 136 | ANT = $(subst \,/,$(ANT_HOME))/bin/ant.bat
|
---|
| 137 | else
|
---|
| 138 | ifeq ($(PLATFORM), os2)
|
---|
| 139 | ANT = $(subst \,/,$(ANT_HOME))/bin/ant.cmd
|
---|
| 140 | else
|
---|
| 141 | ANT = $(ANT_HOME)/bin/ant
|
---|
| 142 | endif
|
---|
| 143 | endif
|
---|
[2] | 144 | ifneq ($(shell test -x $(ANT); echo $$?), 0)
|
---|
[72] | 145 | $(error $(ANT) not found -- please update ANT_HOME)
|
---|
[2] | 146 | endif
|
---|
| 147 | else
|
---|
| 148 | ANT = ant
|
---|
| 149 | ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0)
|
---|
[72] | 150 | $(error 'ant' not found -- please set ANT_HOME or put 'ant' on your PATH)
|
---|
[2] | 151 | endif
|
---|
| 152 | endif
|
---|
| 153 |
|
---|
| 154 | # Default target and expected 'do everything' target
|
---|
| 155 | default: all
|
---|
| 156 |
|
---|
| 157 | # All ant targets of interest
|
---|
| 158 | ANT_TARGETS = all source drop_included build dist clobber clean sanity
|
---|
| 159 |
|
---|
| 160 | # Create a make target for each
|
---|
| 161 | $(ANT_TARGETS):
|
---|
| 162 | cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) -version
|
---|
| 163 | cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@
|
---|
| 164 |
|
---|
| 165 | # Help target
|
---|
| 166 | define helpenvline
|
---|
| 167 | @echo " $1";echo " $2"
|
---|
| 168 | endef
|
---|
| 169 | help:
|
---|
| 170 | @echo "----------------------------------------------------------"
|
---|
| 171 | @echo " "
|
---|
| 172 | @echo "Help information for this Makefile:"
|
---|
| 173 | @echo " "
|
---|
| 174 | @echo " Targets (see ant project information for descriptions):"
|
---|
| 175 | @echo " $(ANT_TARGETS)"
|
---|
| 176 | @echo " "
|
---|
| 177 | @echo " Environment or command line variables (all optional):"
|
---|
[278] | 178 | $(call helpenvline, ALT_DROPS_DIR,\
|
---|
| 179 | "Directory that contains the drop source bundles i.e. drops.dir")
|
---|
[2] | 180 | $(call helpenvline, ALT_BOOTDIR,\
|
---|
| 181 | "JAVA_HOME to use when running ant")
|
---|
| 182 | $(call helpenvline, ALT_LANGTOOLS_DIST,\
|
---|
| 183 | "path to langtools repository dist directory")
|
---|
| 184 | $(call helpenvline, ALT_OUTPUTDIR,\
|
---|
| 185 | "path to root of output")
|
---|
| 186 | $(call helpenvline, DEBUG_CLASSFILES,\
|
---|
| 187 | "if set makes sure ant property javac.debug is true")
|
---|
| 188 | $(call helpenvline, JAVAC_SOURCE_ARG,\
|
---|
| 189 | "if SOURCE_LANGUAGE_VERSION not set uses this to set ant property javac.source")
|
---|
| 190 | $(call helpenvline, JAVAC_TARGET_ARG,\
|
---|
| 191 | "if TARGET_CLASS_VERSION not set uses this to set ant property javac.target")
|
---|
| 192 | $(call helpenvline, SOURCE_LANGUAGE_VERSION,\
|
---|
| 193 | "if set uses this to set ant property javac.source")
|
---|
| 194 | $(call helpenvline, QUIET,\
|
---|
| 195 | "if set will pass -quiet to ant")
|
---|
| 196 | $(call helpenvline, TARGET_CLASS_VERSION,\
|
---|
| 197 | "JAVA_HOME to use when running ant")
|
---|
| 198 | $(call helpenvline, VARIANT,\
|
---|
| 199 | "if set to OPT means optimized build will set javac.debug to false")
|
---|
| 200 | $(call helpenvline, VERBOSE,\
|
---|
| 201 | "if set will pass -verbose to ant")
|
---|
| 202 | @echo " "
|
---|
| 203 | @echo "----------------------------------------------------------"
|
---|
| 204 | @echo " "
|
---|
| 205 | @echo "Ant project file help information:"
|
---|
| 206 | @echo " "
|
---|
| 207 | @$(ANT_JAVA_HOME) cd .. && $(ANT) $(ANT_OPTIONS) -p
|
---|
| 208 | @echo " "
|
---|
| 209 | @echo "----------------------------------------------------------"
|
---|
| 210 |
|
---|
| 211 | # Targets for Sun's internal JPRT build system
|
---|
| 212 | JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip
|
---|
| 213 | jprt_build_product jprt_build_debug jprt_build_fastdebug: all
|
---|
| 214 | $(RM) $(JPRT_ARCHIVE_BUNDLE)
|
---|
| 215 | ( cd $(OUTPUTDIR)/dist && \
|
---|
| 216 | zip -q -r $(JPRT_ARCHIVE_BUNDLE) . )
|
---|
| 217 |
|
---|
| 218 | # Declare these phony (not filenames)
|
---|
| 219 | .PHONY: $(ANT_TARGETS) \
|
---|
| 220 | jprt_build_product jprt_build_debug jprt_build_fastdebug
|
---|