author | ohair |
Tue, 25 May 2010 15:52:11 -0700 | |
changeset 5555 | b2b5ed3f0d0d |
parent 3871 | 3d528461f61d |
child 6551 | 476ed8653670 |
permissions | -rw-r--r-- |
4 | 1 |
# |
5555 | 2 |
# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. |
4 | 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 |
|
5555 | 7 |
# published by the Free Software Foundation. Oracle designates this |
4 | 8 |
# particular file as subject to the "Classpath" exception as provided |
5555 | 9 |
# by Oracle in the LICENSE file that accompanied this code. |
4 | 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 |
# |
|
5555 | 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. |
|
4 | 24 |
# |
25 |
||
26 |
# |
|
27 |
# Defnitions for all platforms. |
|
28 |
# |
|
29 |
# Normally the convention is that these alternate definitions of |
|
30 |
# primary make variables are never defined inside the Makefiles anywhere |
|
31 |
# but are defined via environment variables or set on the make command |
|
32 |
# line. So you should never see an ALT_* variable defined in any |
|
33 |
# makefiles, just used. This is the convention and there are some |
|
34 |
# exceptions, either mistakes or unusual circumstances. |
|
35 |
# |
|
36 |
# The naming convention for the default value of one of these variables |
|
37 |
# that has an ALT_* override capability is to name the default value with a |
|
38 |
# leading underscore (_). So for XXX you would have: |
|
39 |
# _XXX default value |
|
40 |
# ALT_XXX any override the user is providing if any |
|
41 |
# XXX the final value, either the default _XXX or the ALT_XXX value. |
|
42 |
# |
|
43 |
||
44 |
# On Directory names. In very rare cases should the Windows directory |
|
45 |
# names use the backslash, please use the C:/ style of windows paths. |
|
46 |
# Avoid duplicating the // characters in paths, this has known to cause |
|
47 |
# strange problems with jar and other utilities, e.g. /a//b/ != /a/b/. |
|
48 |
# Some of these variables have an explicit trailing / character, but in |
|
49 |
# general, they should NOT have the trailing / character. |
|
50 |
||
51 |
# Get shared system utilities macros defined |
|
52 |
include $(BUILDDIR)/common/shared/Defs-utils.gmk |
|
53 |
||
54 |
# Assumes ARCH, PLATFORM, ARCH_VM_SUBDIR, etc. have been defined. |
|
55 |
||
56 |
# Simple pwd path |
|
57 |
define PwdPath |
|
58 |
$(shell cd $1 2> $(DEV_NULL) && pwd) |
|
59 |
endef |
|
60 |
||
61 |
# Checks an ALT value for spaces (should be one word), |
|
62 |
# warns and returns Check_ALT_$1 if spaces |
|
63 |
define AltCheckSpaces |
|
64 |
$(if $(word 2,$($1)),$(warning "WARNING: Value of $1 contains a space: '$($1)', check or set ALT_$1")Check_ALT_$1,$($1)) |
|
65 |
endef |
|
66 |
||
67 |
# Checks an ALT value for empty, warns and returns Check_ALT_$1 if empty |
|
68 |
define AltCheckValue |
|
69 |
$(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, check or set ALT_$1")Check_ALT_$1) |
|
70 |
endef |
|
71 |
||
72 |
# Checks any value for empty, warns and returns $2 if empty |
|
73 |
define CheckValue |
|
74 |
$(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, will use '$2'")$2) |
|
75 |
endef |
|
76 |
||
77 |
# Prefix for a utility prefix path, if empty leave alone, otherwise end with a / |
|
78 |
define PrefixPath |
|
79 |
$(if $1,$(subst //,/,$1/),) |
|
80 |
endef |
|
81 |
||
82 |
# Select a directory if it exists, or the alternate 2 or the alternate 3 |
|
83 |
define DirExists |
|
84 |
$(shell \ |
|
85 |
if [ -d "$1" ]; then \ |
|
86 |
echo "$1"; \ |
|
87 |
elif [ -d "$2" ]; then \ |
|
88 |
echo "$2"; \ |
|
89 |
else \ |
|
90 |
echo "$3"; \ |
|
91 |
fi) |
|
92 |
endef |
|
93 |
||
94 |
# Select a writable directory if it exists and is writable, or the alternate |
|
95 |
define WriteDirExists |
|
96 |
$(shell \ |
|
97 |
if [ -d "$1" -a -w "$1" ]; then \ |
|
98 |
echo "$1"; \ |
|
99 |
else \ |
|
100 |
echo "$2"; \ |
|
101 |
fi) |
|
102 |
endef |
|
103 |
||
104 |
# Select a file if it exists, or the alternate 1, or the alternate 2 |
|
105 |
define FileExists |
|
106 |
$(shell \ |
|
107 |
if [ -r "$1" ]; then \ |
|
108 |
echo "$1"; \ |
|
109 |
elif [ -r "$2" ]; then \ |
|
110 |
echo "$2"; \ |
|
111 |
else \ |
|
112 |
echo "NO_FILE_EXISTS"; \ |
|
113 |
fi) |
|
114 |
endef |
|
115 |
||
116 |
# Given a line of text, get the major.minor version number from it |
|
117 |
define GetVersion |
|
118 |
$(shell echo $1 | sed -e 's@[^1-9]*\([1-9][0-9]*\.[0-9][0-9]*\).*@\1@' ) |
|
119 |
endef |
|
120 |
||
121 |
# Given a major.minor.micro version, return the major, minor, or micro number |
|
122 |
define MajorVersion |
|
123 |
$(if $(word 1, $(subst ., ,$1)),$(word 1, $(subst ., ,$1)),0) |
|
124 |
endef |
|
125 |
define MinorVersion |
|
126 |
$(if $(word 2, $(subst ., ,$1)),$(word 2, $(subst ., ,$1)),0) |
|
127 |
endef |
|
128 |
define MicroVersion |
|
129 |
$(if $(word 3, $(subst ., ,$1)),$(word 3, $(subst ., ,$1)),0) |
|
130 |
endef |
|
131 |
||
132 |
# Macro that returns missing, same, newer, or older $1=version $2=required |
|
133 |
# (currently does not check the micro number) |
|
134 |
define CheckVersions |
|
135 |
$(shell \ |
|
136 |
if [ "$1" = "" -o "$2" = "" ]; then \ |
|
137 |
echo missing; \ |
|
138 |
else \ |
|
139 |
if [ "$1" = "$2" ]; then \ |
|
140 |
echo same; \ |
|
141 |
else \ |
|
142 |
if [ $(call MajorVersion,$1) -lt $(call MajorVersion,$2) ] ; then \ |
|
143 |
echo older; \ |
|
144 |
else \ |
|
145 |
if [ $(call MajorVersion,$1) -eq $(call MajorVersion,$2) -a \ |
|
146 |
$(call MinorVersion,$1) -lt $(call MinorVersion,$2) ]; then \ |
|
147 |
echo older; \ |
|
148 |
else \ |
|
149 |
echo newer; \ |
|
150 |
fi; \ |
|
151 |
fi; \ |
|
152 |
fi; \ |
|
153 |
fi) |
|
154 |
endef |
|
155 |
||
156 |
# Make sure certain variables are non-empty at this point |
|
157 |
_check_values:=\ |
|
158 |
$(call CheckValue,ARCH,),\ |
|
159 |
$(call CheckValue,ARCH_DATA_MODEL,),\ |
|
160 |
$(call CheckValue,ARCH_VM_SUBDIR,),\ |
|
161 |
$(call CheckValue,VARIANT,),\ |
|
162 |
$(call CheckValue,PLATFORM,) |
|
163 |
||
164 |
# Misc common settings for all workspaces |
|
165 |
# This determines the version of the product, and the previous version or boot |
|
166 |
ifndef JDK_MAJOR_VERSION |
|
167 |
JDK_MAJOR_VERSION = 1 |
|
168 |
PREVIOUS_MAJOR_VERSION = 1 |
|
169 |
endif |
|
170 |
||
171 |
ifndef JDK_MINOR_VERSION |
|
172 |
JDK_MINOR_VERSION = 7 |
|
173 |
PREVIOUS_MINOR_VERSION = 6 |
|
174 |
endif |
|
175 |
||
176 |
ifndef JDK_MICRO_VERSION |
|
177 |
JDK_MICRO_VERSION = 0 |
|
178 |
PREVIOUS_MICRO_VERSION = 0 |
|
179 |
endif |
|
180 |
||
181 |
ifndef MILESTONE |
|
182 |
MILESTONE = internal |
|
183 |
endif |
|
184 |
||
185 |
ifndef BUILD_NUMBER |
|
186 |
JDK_BUILD_NUMBER = b00 |
|
187 |
else |
|
188 |
ifndef JDK_BUILD_NUMBER |
|
189 |
JDK_BUILD_NUMBER = $(BUILD_NUMBER) |
|
190 |
endif |
|
191 |
endif |
|
192 |
||
193 |
# Default variant is the optimized version of everything |
|
194 |
# can be OPT or DBG, default is OPT |
|
195 |
# Determine the extra pattern to add to the release name for debug/fastdebug. |
|
196 |
# Determine the JDK_IMPORT_VARIANT, so we get the right VM files copied over. |
|
197 |
# Determine suffix for obj directory or OBJDIR, for .o files. |
|
198 |
# (by keeping .o files separate, just .o files, they don't clobber each |
|
199 |
# other, however, the library files will clobber each other). |
|
200 |
# |
|
201 |
ifeq ($(VARIANT), DBG) |
|
202 |
BUILD_VARIANT_RELEASE=-debug |
|
203 |
OBJDIRNAME_SUFFIX=_g |
|
204 |
else |
|
205 |
BUILD_VARIANT_RELEASE= |
|
206 |
OBJDIRNAME_SUFFIX= |
|
207 |
endif |
|
208 |
ifeq ($(FASTDEBUG), true) |
|
209 |
VARIANT=DBG |
|
210 |
BUILD_VARIANT_RELEASE=-fastdebug |
|
211 |
OBJDIRNAME_SUFFIX=_gO |
|
212 |
_JDK_IMPORT_VARIANT=/fastdebug |
|
213 |
endif |
|
214 |
||
215 |
# Depending on the flavor of the build, add a -debug or -fastdebug to the name |
|
216 |
ifdef DEBUG_NAME |
|
217 |
BUILD_VARIANT_RELEASE=-$(DEBUG_NAME) |
|
218 |
endif |
|
219 |
||
220 |
JDK_VERSION = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION) |
|
221 |
JDK_UNDERSCORE_VERSION = $(subst .,_,$(JDK_VERSION)) |
|
222 |
||
223 |
# RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set |
|
224 |
ifneq ($(MILESTONE),fcs) |
|
225 |
RELEASE = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE) |
|
226 |
else |
|
227 |
RELEASE = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE) |
|
228 |
endif |
|
229 |
||
230 |
# FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set |
|
3871
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
2192
diff
changeset
|
231 |
ifndef FULL_VERSION |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
2192
diff
changeset
|
232 |
ifdef BUILD_NUMBER |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
2192
diff
changeset
|
233 |
FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
2192
diff
changeset
|
234 |
else |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
2192
diff
changeset
|
235 |
BUILD_NUMBER = b00 |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
2192
diff
changeset
|
236 |
USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
2192
diff
changeset
|
237 |
FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
2192
diff
changeset
|
238 |
endif |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
2192
diff
changeset
|
239 |
export FULL_VERSION |
4 | 240 |
endif |
241 |
||
242 |
# Promoted build location |
|
243 |
PROMOTED_RE_AREA = $(SLASH_JAVA)/re/jdk/$(JDK_VERSION)/promoted |
|
244 |
PROMOTED_BUILD_LATEST = latest |
|
245 |
PROMOTED_BUILD_BASEDIR = $(PROMOTED_RE_AREA)/$(PROMOTED_BUILD_LATEST) |
|
246 |
PROMOTED_BUILD_BINARIES = $(PROMOTED_BUILD_BASEDIR)/binaries |
|
247 |
||
248 |
# OPT: Changes what the optimizations settings (in _OPT) |
|
249 |
POPT = $(_OPT$(ALT_OPT))$(ALT_OPT) |
|
250 |
||
251 |
# PARALLEL_COMPILE_JOBS: is the number of compiles done in parallel. |
|
252 |
# If the user sets ALT_PARALLEL_COMPILE_JOBS, then COMPILE_APPROACH is set |
|
253 |
# to parallel. |
|
254 |
# |
|
255 |
# Recommended setting: 2 seems to be ideal for single cpu machines, |
|
256 |
# 2 times the number of CPU's is a basic formula, |
|
257 |
# but probably not more than 4 if the machine is |
|
258 |
# being shared by others, or the machine is limited |
|
259 |
# in RAM or swap. |
|
260 |
# |
|
261 |
ifdef ALT_PARALLEL_COMPILE_JOBS |
|
262 |
PARALLEL_COMPILE_JOBS=$(ALT_PARALLEL_COMPILE_JOBS) |
|
263 |
else |
|
264 |
PARALLEL_COMPILE_JOBS=2 |
|
265 |
endif |
|
266 |
||
267 |
# Previous JDK release (version of BOOTDIR version) |
|
268 |
ifdef ALT_PREVIOUS_JDK_VERSION |
|
269 |
PREVIOUS_JDK_VERSION = $(ALT_PREVIOUS_JDK_VERSION) |
|
270 |
else |
|
271 |
PREVIOUS_JDK_VERSION = $(PREVIOUS_MAJOR_VERSION).$(PREVIOUS_MINOR_VERSION).$(PREVIOUS_MICRO_VERSION) |
|
272 |
endif |
|
273 |
export PREVIOUS_JDK_VERSION |
|
274 |
PREVIOUS_JDK_VERSION:=$(call AltCheckSpaces,PREVIOUS_JDK_VERSION) |
|
275 |
PREVIOUS_JDK_VERSION:=$(call AltCheckValue,PREVIOUS_JDK_VERSION) |
|
276 |
||
277 |
# Version with _ instead of . in number |
|
278 |
ifeq ($(PREVIOUS_MINOR_VERSION),5) |
|
279 |
PREVIOUS_JDK_UNDERSCORE_VERSION = $(subst .,_,$(PREVIOUS_JDK_VERSION)) |
|
280 |
else |
|
281 |
PREVIOUS_JDK_UNDERSCORE_VERSION = $(PREVIOUS_MINOR_VERSION) |
|
282 |
endif |
|
283 |
||
284 |
# Get platform specific settings |
|
285 |
include $(BUILDDIR)/common/shared/Defs-$(PLATFORM).gmk |
|
286 |
||
148 | 287 |
# Components |
288 |
ifdef ALT_LANGTOOLS_DIST |
|
289 |
LANGTOOLS_DIST :=$(call FullPath,$(ALT_LANGTOOLS_DIST)) |
|
290 |
else |
|
291 |
LANGTOOLS_DIST = |
|
292 |
endif |
|
293 |
||
4 | 294 |
# These are the same on all platforms but require the above platform include 1st |
295 |
||
296 |
# BOOTDIR: Bootstrap JDK, previous released JDK. |
|
297 |
# _BOOTDIR1 and _BOOTDIR2 picked by platform |
|
298 |
ifdef ALT_BOOTDIR |
|
299 |
BOOTDIR =$(ALT_BOOTDIR) |
|
300 |
else |
|
301 |
BOOTDIR :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR) |
|
302 |
endif |
|
303 |
export BOOTDIR |
|
304 |
BOOTDIR:=$(call AltCheckSpaces,BOOTDIR) |
|
305 |
BOOTDIR:=$(call AltCheckValue,BOOTDIR) |
|
306 |
||
307 |
# OUTPUTDIR: Location of all output for the build |
|
308 |
_BACKUP_OUTPUTDIR = $(TEMP_DISK)/$(USER)/jdk-outputdir |
|
309 |
ifdef ALT_OUTPUTDIR |
|
310 |
_POSSIBLE_OUTPUTDIR =$(subst \,/,$(ALT_OUTPUTDIR)) |
|
311 |
else |
|
312 |
ifndef _OUTPUTDIR |
|
313 |
_OUTPUTDIR = $(_BACKUP_OUTPUTDIR) |
|
314 |
endif |
|
315 |
_POSSIBLE_OUTPUTDIR =$(_OUTPUTDIR) |
|
316 |
endif |
|
317 |
_create_outputdir1:=$(shell mkdir -p $(_POSSIBLE_OUTPUTDIR) > $(DEV_NULL) 2>&1) |
|
318 |
OUTPUTDIR:=$(call WriteDirExists,$(_POSSIBLE_OUTPUTDIR),$(_BACKUP_OUTPUTDIR)) |
|
319 |
_create_outputdir2:=$(shell mkdir -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1) |
|
320 |
ifeq "$(OUTPUTDIR)" "$(_BACKUP_OUTPUTDIR)" |
|
321 |
_outputdir_warning:=$(warning "WARNING: OUTPUTDIR '$(_POSSIBLE_OUTPUTDIR)' not writable, will use '$(_BACKUP_OUTPUTDIR)'") |
|
322 |
endif |
|
323 |
OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR) |
|
324 |
OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR) |
|
325 |
||
326 |
# Bin directory |
|
327 |
# NOTE: ISA_DIR is usually empty, on Solaris it might be /sparcv9 or /amd64 |
|
328 |
BINDIR = $(OUTPUTDIR)/bin$(ISA_DIR) |
|
329 |
||
330 |
# Absolute path to output directory |
|
331 |
ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR)) |
|
332 |
||
333 |
# Get shared compiler settings |
|
334 |
include $(BUILDDIR)/common/shared/Compiler.gmk |
|
335 |