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