|
1 # |
|
2 # Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. |
|
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 |
|
7 # published by the Free Software Foundation. Sun designates this |
|
8 # particular file as subject to the "Classpath" exception as provided |
|
9 # by Sun in the LICENSE file that accompanied this code. |
|
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 # |
|
21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 # CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 # have any questions. |
|
24 # |
|
25 |
|
26 # |
|
27 # Definitions for Windows. |
|
28 # |
|
29 |
|
30 # Default for COMPILER_WARNINGS_FATAL on Windows (C++ compiler warnings) |
|
31 # Level: Default is 3, 0 means none, 4 is the most but may be unreliable |
|
32 # Some makefiles may have set this to 0 to turn off warnings completely, |
|
33 # which also effectively creates a COMPILER_WARNINGS_FATAL=false situation. |
|
34 # Program.gmk may turn this down to 2 (building .exe's). |
|
35 # Windows 64bit platforms are less likely to be warning free. |
|
36 # Historically, Windows 32bit builds should be mostly warning free. |
|
37 ifndef COMPILER_WARNING_LEVEL |
|
38 COMPILER_WARNING_LEVEL=3 |
|
39 endif |
|
40 ifndef COMPILER_WARNINGS_FATAL |
|
41 COMPILER_WARNINGS_FATAL=false |
|
42 endif |
|
43 |
|
44 # Windows should use parallel compilation for best build times |
|
45 ifndef COMPILE_APPROACH |
|
46 COMPILE_APPROACH = normal |
|
47 endif |
|
48 |
|
49 # Indication that we are doing an incremental build. |
|
50 # This may trigger the creation of make depend files. |
|
51 # (This may not be working on windows yet, always force to false.) |
|
52 override INCREMENTAL_BUILD = false |
|
53 |
|
54 # WARNING: This is extremely touch stuff, between CYGWIN vs. MKS and all |
|
55 # variations of MKS and CYGWIN releases, and 32bit vs 64bit, |
|
56 # this file can give you nightmares. |
|
57 # |
|
58 # Notes: |
|
59 # Keep all paths in the windows "mixed" style except CYGWIN UNXIXCOMMAND_PATH. |
|
60 # Use of PrefixPath is critical, some variables must end with / (see NOTE). |
|
61 # Use of quotes is critical due to possible spaces in paths coming from |
|
62 # the environment variables, be careful. |
|
63 # First convert \ to / with subst, keep it quoted due to blanks, then |
|
64 # use cygpath -s or dosname -s to get the short non-blank name. |
|
65 # If the MKS is old and doesn't have a dosname -s, you will be forced |
|
66 # to set ALT variables with the short non-space directory names. |
|
67 # If dosname doesn't appear to work, we won't use it. |
|
68 # The dosname utility also wants to accept stdin if it is not supplied |
|
69 # any path on the command line, this is really dangerous when using |
|
70 # make variables that can easily become empty, so I use: |
|
71 # echo $1 | dosname -s instead of dosname -s $1 |
|
72 # to prevent dosname from hanging up the make process when $1 is empty. |
|
73 # The cygpath utility does not have this problem. |
|
74 # The ALT values should never really have spaces or use \. |
|
75 # Suspect these environment variables to have spaces and/or \ characters: |
|
76 # SYSTEMROOT, SystemRoot, WINDIR, windir, PROGRAMFILES, ProgramFiles, |
|
77 # MSTOOLS, Mstools, MSSDK, MSSdk, VC71COMNTOOLS, |
|
78 # MSVCDIR, MSVCDir. |
|
79 # So use $(subst \,/,) on them first adding quotes and placing them in |
|
80 # their own variable assigned with :=, then use FullPath. |
|
81 # |
|
82 |
|
83 # Use FullPath to get C:/ style non-spaces path. Never ends with a /! |
|
84 ifdef USING_CYGWIN |
|
85 # We assume cygpath is available in the search path |
|
86 # NOTE: Use of 'pwd' with CYGWIN will not get you a mixed style path! |
|
87 CYGPATH_CMD=cygpath -a -s -m |
|
88 define FullPath |
|
89 $(shell $(CYGPATH_CMD) $1 2> $(DEV_NULL)) |
|
90 endef |
|
91 define OptFullPath |
|
92 $(shell if [ "$1" != "" -a -d "$1" ]; then $(CYGPATH_CMD) "$1"; else echo "$1"; fi) |
|
93 endef |
|
94 else |
|
95 # Temporary until we upgrade to MKS 8.7, MKS pwd returns mixed mode path |
|
96 define FullPath |
|
97 $(shell cd $1 2> $(DEV_NULL) && pwd) |
|
98 endef |
|
99 define OptFullPath |
|
100 $(shell if [ "$1" != "" -a -d "$1" ]; then (cd $1 && pwd); else echo "$1"; fi) |
|
101 endef |
|
102 endif |
|
103 |
|
104 # System drive |
|
105 ifdef SYSTEMDRIVE |
|
106 _system_drive =$(SYSTEMDRIVE) |
|
107 else |
|
108 ifdef SystemDrive |
|
109 _system_drive =$(SystemDrive) |
|
110 endif |
|
111 endif |
|
112 _system_drive:=$(call CheckValue,_system_drive,C:) |
|
113 |
|
114 # UNIXCOMMAND_PATH: path to where the most common Unix commands are. |
|
115 # NOTE: Must end with / so that it could be empty, allowing PATH usage. |
|
116 ifdef ALT_UNIXCOMMAND_PATH |
|
117 xALT_UNIXCOMMAND_PATH :="$(subst \,/,$(ALT_UNIXCOMMAND_PATH))" |
|
118 fxALT_UNIXCOMMAND_PATH :=$(call FullPath,$(xALT_UNIXCOMMAND_PATH)) |
|
119 UNIXCOMMAND_PATH :=$(call PrefixPath,$(fxALT_UNIXCOMMAND_PATH)) |
|
120 else |
|
121 ifdef USING_CYGWIN |
|
122 UNIXCOMMAND_PATH :=$(call PrefixPath,/usr/bin) |
|
123 else |
|
124 ifdef ROOTDIR |
|
125 xROOTDIR :="$(subst \,/,$(ROOTDIR))" |
|
126 _rootdir :=$(call FullPath,$(xROOTDIR)) |
|
127 else |
|
128 xROOTDIR :="$(_system_drive)/mksnt" |
|
129 _rootdir :=$(call FullPath,$(xROOTDIR)) |
|
130 endif |
|
131 ifneq ($(_rootdir),) |
|
132 UNIXCOMMAND_PATH :=$(call PrefixPath,$(_rootdir)/mksnt) |
|
133 endif |
|
134 endif |
|
135 endif |
|
136 UNIXCOMMAND_PATH:=$(call AltCheckSpaces,UNIXCOMMAND_PATH) |
|
137 |
|
138 # Get version of MKS or CYGWIN |
|
139 ifdef USING_CYGWIN |
|
140 _CYGWIN_VER :=$(shell $(UNAME)) |
|
141 CYGWIN_VER :=$(call GetVersion,$(_CYGWIN_VER)) |
|
142 else # MKS |
|
143 _MKS_VER :=$(shell $(MKSINFO) 2>&1 | $(GREP) Release | $(TAIL) -1 | $(SED) -e 's@.*\(Release.*\)@\1@') |
|
144 MKS_VER :=$(call GetVersion,$(_MKS_VER)) |
|
145 # At this point, we can re-define FullPath to use DOSNAME_CMD |
|
146 CHECK_MKS87:=$(call CheckVersions,$(MKS_VER),8.7) |
|
147 TRY_DOSNAME:=false |
|
148 ifeq ($(CHECK_MKS87),same) |
|
149 TRY_DOSNAME:=true |
|
150 endif |
|
151 # Newer should be ok |
|
152 ifeq ($(CHECK_MKS87),newer) |
|
153 TRY_DOSNAME:=true |
|
154 endif |
|
155 ifeq ($(TRY_DOSNAME),true) |
|
156 ifeq ($(shell $(UNIXCOMMAND_PATH)dosname -s $(_system_drive)/ 2> $(DEV_NULL)),$(_system_drive)/) |
|
157 _DOSNAME=$(UNIXCOMMAND_PATH)dosname |
|
158 DOSNAME_CMD:=$(_DOSNAME) -s |
|
159 define FullPath |
|
160 $(subst //,/,$(shell echo $1 | $(DOSNAME_CMD) 2> $(DEV_NULL))) |
|
161 endef |
|
162 endif # test dosname -s |
|
163 endif # TRY_DOSNAME |
|
164 endif # MKS |
|
165 |
|
166 # We try to get references to what we need via the default component |
|
167 # environment variables, or what was used historically. |
|
168 |
|
169 # Process Windows values into FullPath values, these paths may have \ chars |
|
170 |
|
171 # System root |
|
172 ifdef SYSTEMROOT |
|
173 xSYSTEMROOT :="$(subst \,/,$(SYSTEMROOT))" |
|
174 _system_root :=$(call FullPath,$(xSYSTEMROOT)) |
|
175 else |
|
176 ifdef SystemRoot |
|
177 xSYSTEMROOT :="$(subst \,/,$(SystemRoot))" |
|
178 _system_root :=$(call FullPath,$(xSYSTEMROOT)) |
|
179 else |
|
180 ifdef WINDIR |
|
181 xWINDIR :="$(subst \,/,$(WINDIR))" |
|
182 _system_root :=$(call FullPath,$(xWINDIR)) |
|
183 else |
|
184 ifdef windir |
|
185 xWINDIR :="$(subst \,/,$(windir))" |
|
186 _system_root :=$(call FullPath,$(xWINDIR)) |
|
187 endif |
|
188 endif |
|
189 endif |
|
190 endif |
|
191 _system_root:=$(call CheckValue,_system_root,$(_system_drive)/WINNT) |
|
192 |
|
193 # Program Files directory |
|
194 ifdef PROGRAMFILES |
|
195 xPROGRAMFILES :="$(subst \,/,$(PROGRAMFILES))" |
|
196 else |
|
197 ifeq ($(ARCH_DATA_MODEL), 32) |
|
198 xPROGRAMFILES :="$(_system_drive)/Program Files" |
|
199 else |
|
200 xPROGRAMFILES :="$(_system_drive)/Program Files (x86)" |
|
201 endif |
|
202 endif |
|
203 ifeq ($(ARCH_DATA_MODEL), 32) |
|
204 _program_files :=$(call FullPath,$(xPROGRAMFILES)) |
|
205 else |
|
206 ifdef PROGRAMW6432 |
|
207 xPROGRAMW6432 :="$(subst \,/,$(PROGRAMW6432))" |
|
208 else |
|
209 xPROGRAMW6432 :="$(_system_drive)/Program Files" |
|
210 endif |
|
211 _program_files :=$(call FullPath,$(xPROGRAMW6432)) |
|
212 _program_files32 :=$(call FullPath,$(xPROGRAMFILES)) |
|
213 ifneq ($(word 1,$(_program_files32)),$(_program_files32)) |
|
214 _program_files32:= |
|
215 endif |
|
216 endif |
|
217 ifneq ($(word 1,$(_program_files)),$(_program_files)) |
|
218 _program_files:= |
|
219 endif |
|
220 |
|
221 # Compilers, SDK, and Visual Studio (MSDEV) [32bit is different from 64bit] |
|
222 ifeq ($(ARCH_DATA_MODEL), 32) |
|
223 # Try looking in MSVCDIR or MSVCDir area first (set by vcvars32.bat) |
|
224 ifdef MSVCDIR |
|
225 xMSVCDIR :="$(subst \,/,$(MSVCDIR))" |
|
226 _msvc_dir :=$(call FullPath,$(xMSVCDIR)) |
|
227 else |
|
228 ifdef MSVCDir |
|
229 xMSVCDIR :="$(subst \,/,$(MSVCDir))" |
|
230 _msvc_dir :=$(call FullPath,$(xMSVCDIR)) |
|
231 else |
|
232 ifneq ($(_program_files),) |
|
233 xMSVCDIR :="$(_program_files)/Microsoft Visual Studio .NET 2003/Vc7" |
|
234 _msvc_dir :=$(call FullPath,$(xMSVCDIR)) |
|
235 endif |
|
236 endif |
|
237 endif |
|
238 ifneq ($(subst MSDev98,OLDOLDOLD,$(_msvc_dir)),$(_msvc_dir)) |
|
239 _msvc_dir := |
|
240 endif |
|
241 # If we still don't have it, look for VS71COMNTOOLS, setup by installer? |
|
242 ifeq ($(_msvc_dir),) |
|
243 ifdef VS71COMNTOOLS # /Common/Tools directory, use ../../Vc7 |
|
244 xVS71COMNTOOLS :="$(subst \,/,$(VS71COMNTOOLS))" |
|
245 _vs71tools :=$(call FullPath,$(xVS71COMNTOOLS)) |
|
246 endif |
|
247 ifneq ($(_vs71tools),) |
|
248 _msvc_dir :=$(_vs71tools)/../../Vc7 |
|
249 endif |
|
250 endif |
|
251 ifneq ($(_msvc_dir),) |
|
252 _compiler_bin :=$(_msvc_dir)/Bin |
|
253 _redist_sdk :=$(_msvc_dir)/../SDK/v1.1/Bin |
|
254 _ms_sdk :=$(_msvc_dir)/PlatformSDK |
|
255 endif |
|
256 endif |
|
257 |
|
258 # The Microsoft Platform SDK installed by itself |
|
259 ifneq ($(_program_files),) |
|
260 xPSDK :="$(_program_files)/Microsoft Platform SDK" |
|
261 _psdk :=$(call FullPath,$(xPSDK)) |
|
262 ifeq ($(_psdk),) |
|
263 xPSDK :="$(_program_files)/Microsoft SDK" |
|
264 _psdk :=$(call FullPath,$(xMSSDK)) |
|
265 endif |
|
266 endif |
|
267 |
|
268 # If no SDK found yet, look in other places |
|
269 ifeq ($(_ms_sdk),) |
|
270 ifdef MSSDK |
|
271 xMSSDK :="$(subst \,/,$(MSSDK))" |
|
272 _ms_sdk :=$(call FullPath,$(xMSSDK)) |
|
273 else |
|
274 ifdef MSSdk |
|
275 xMSSDK :="$(subst \,/,$(MSSdk))" |
|
276 _ms_sdk :=$(call FullPath,$(xMSSDK)) |
|
277 else |
|
278 _ms_sdk :=$(_psdk) |
|
279 endif |
|
280 endif |
|
281 endif |
|
282 |
|
283 # Compilers for 64bit are from SDK |
|
284 ifeq ($(ARCH_DATA_MODEL), 64) |
|
285 ifneq ($(_ms_sdk),) |
|
286 ifeq ($(ARCH), ia64) |
|
287 _compiler_bin :=$(_ms_sdk)/Bin/Win64 |
|
288 endif |
|
289 ifeq ($(ARCH), amd64) |
|
290 _compiler_bin :=$(_ms_sdk)/Bin/Win64/x86/$(ARCH) |
|
291 _redist_sdk :=$(_ms_sdk)/redist/win64/AMD64 |
|
292 endif |
|
293 endif |
|
294 endif |
|
295 |
|
296 # Location on system where jdk installs might be |
|
297 ifneq ($(_program_files),) |
|
298 USRJDKINSTANCES_PATH =$(_program_files)/Java |
|
299 else |
|
300 USRJDKINSTANCES_PATH =$(_system_drive)/ |
|
301 endif |
|
302 |
|
303 # SLASH_JAVA: location of all network accessable files |
|
304 ifdef ALT_SLASH_JAVA |
|
305 xALT_SLASH_JAVA :="$(subst \,/,$(ALT_SLASH_JAVA))" |
|
306 SLASH_JAVA :=$(call FullPath,$(xALT_SLASH_JAVA)) |
|
307 else |
|
308 ifdef ALT_JDK_JAVA_DRIVE |
|
309 SLASH_JAVA =$(JDK_JAVA_DRIVE) |
|
310 else |
|
311 SLASH_JAVA =J: |
|
312 endif |
|
313 endif |
|
314 SLASH_JAVA:=$(call AltCheckSpaces,SLASH_JAVA) |
|
315 SLASH_JAVA:=$(call AltCheckValue,SLASH_JAVA) |
|
316 |
|
317 # JDK_DEVTOOLS_DIR: common path for all the java devtools |
|
318 ifdef ALT_JDK_DEVTOOLS_DIR |
|
319 xALT_JDK_DEVTOOLS_DIR :="$(subst \,/,$(ALT_JDK_DEVTOOLS_DIR))" |
|
320 JDK_DEVTOOLS_DIR :=$(call FullPath,$(xALT_JDK_DEVTOOLS_DIR)) |
|
321 else |
|
322 JDK_DEVTOOLS_DIR =$(SLASH_JAVA)/devtools |
|
323 endif |
|
324 JDK_DEVTOOLS_DIR:=$(call AltCheckSpaces,JDK_DEVTOOLS_DIR) |
|
325 JDK_DEVTOOLS_DIR:=$(call AltCheckValue,JDK_DEVTOOLS_DIR) |
|
326 |
|
327 # COMPILER_PATH: path to where the compiler and tools are installed. |
|
328 # NOTE: Must end with / so that it could be empty, allowing PATH usage. |
|
329 ifdef ALT_COMPILER_PATH |
|
330 xALT_COMPILER_PATH :="$(subst \,/,$(ALT_COMPILER_PATH))" |
|
331 fxALT_COMPILER_PATH :=$(call FullPath,$(xALT_COMPILER_PATH)) |
|
332 COMPILER_PATH :=$(call PrefixPath,$(fxALT_COMPILER_PATH)) |
|
333 else |
|
334 COMPILER_PATH :=$(call PrefixPath,$(_compiler_bin)) |
|
335 endif |
|
336 COMPILER_PATH :=$(call AltCheckSpaces,COMPILER_PATH) |
|
337 |
|
338 # MSDEVTOOLS_PATH: path to where the additional MS Compiler tools are. |
|
339 # NOTE: Must end with / so that it could be empty, allowing PATH usage. |
|
340 ifdef ALT_MSDEVTOOLS_PATH |
|
341 xALT_MSDEVTOOLS_PATH :="$(subst \,/,$(ALT_MSDEVTOOLS_PATH))" |
|
342 fxALT_MSDEVTOOLS_PATH :=$(call FullPath,$(xALT_MSDEVTOOLS_PATH)) |
|
343 MSDEVTOOLS_PATH :=$(call PrefixPath,$(fxALT_MSDEVTOOLS_PATH)) |
|
344 else |
|
345 ifeq ($(ARCH_DATA_MODEL), 64) |
|
346 ifdef MSTOOLS |
|
347 xMSTOOLS :="$(subst \,/,$(MSTOOLS))" |
|
348 _ms_tools :=$(call FullPath,$(xMSTOOLS)) |
|
349 else |
|
350 ifdef Mstools |
|
351 xMSTOOLS :="$(subst \,/,$(Mstools))" |
|
352 _ms_tools :=$(call FullPath,$(xMSTOOLS)) |
|
353 else |
|
354 _ms_tools := |
|
355 endif |
|
356 endif |
|
357 ifneq ($(_ms_tools),) |
|
358 _ms_tools_bin :=$(_ms_tools)/Bin |
|
359 else |
|
360 # Assumes compiler bin is .../Bin/win64/x86/AMD64, rc.exe is 3 levels up |
|
361 _ms_tools_bin :=$(_compiler_bin)/../../.. |
|
362 endif |
|
363 else |
|
364 _ms_tools_bin :=$(_compiler_bin) |
|
365 endif |
|
366 MSDEVTOOLS_PATH :=$(call PrefixPath,$(_ms_tools_bin)) |
|
367 endif |
|
368 MSDEVTOOLS_PATH:=$(call AltCheckSpaces,MSDEVTOOLS_PATH) |
|
369 |
|
370 # DEVTOOLS_PATH: for other tools required for building (such as zip, etc.) |
|
371 # NOTE: Must end with / so that it could be empty, allowing PATH usage. |
|
372 ifdef ALT_DEVTOOLS_PATH |
|
373 xALT_DEVTOOLS_PATH :="$(subst \,/,$(ALT_DEVTOOLS_PATH))" |
|
374 fxALT_DEVTOOLS_PATH :=$(call FullPath,$(xALT_DEVTOOLS_PATH)) |
|
375 DEVTOOLS_PATH :=$(call PrefixPath,$(fxALT_DEVTOOLS_PATH)) |
|
376 else |
|
377 ifdef USING_CYGWIN |
|
378 DEVTOOLS_PATH :=$(UNIXCOMMAND_PATH) |
|
379 else |
|
380 xDEVTOOLS_PATH :="$(_system_drive)/utils" |
|
381 fxDEVTOOLS_PATH :=$(call FullPath,$(xDEVTOOLS_PATH)) |
|
382 DEVTOOLS_PATH :=$(call PrefixPath,$(fxDEVTOOLS_PATH)) |
|
383 endif |
|
384 endif |
|
385 DEVTOOLS_PATH:=$(call AltCheckSpaces,DEVTOOLS_PATH) |
|
386 |
|
387 # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK. |
|
388 # _BOOTDIR2: Second choice |
|
389 ifndef ALT_BOOTDIR |
|
390 _BOOTDIR1 =$(_system_drive)/jdk$(PREVIOUS_JDK_VERSION) |
|
391 _BOOTDIR2 =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION) |
|
392 endif |
|
393 |
|
394 # Import JDK images allow for partial builds, components not built are |
|
395 # imported (or copied from) these import areas when needed. |
|
396 |
|
397 # BUILD_JDK_IMPORT_PATH: location of JDK install trees to import for |
|
398 # multiple platforms, e.g. windows-i586, solaris-sparc, linux-586, etc. |
|
399 ifdef ALT_BUILD_JDK_IMPORT_PATH |
|
400 BUILD_JDK_IMPORT_PATH :=$(call FullPath,$(ALT_BUILD_JDK_IMPORT_PATH)) |
|
401 else |
|
402 BUILD_JDK_IMPORT_PATH = $(PROMOTED_BUILD_BINARIES) |
|
403 endif |
|
404 BUILD_JDK_IMPORT_PATH:=$(call AltCheckSpaces,BUILD_JDK_IMPORT_PATH) |
|
405 BUILD_JDK_IMPORT_PATH:=$(call AltCheckValue,BUILD_JDK_IMPORT_PATH) |
|
406 |
|
407 # JDK_IMPORT_PATH: location of previously built JDK (this version) to import |
|
408 ifdef ALT_JDK_IMPORT_PATH |
|
409 JDK_IMPORT_PATH :=$(call FullPath,$(ALT_JDK_IMPORT_PATH)) |
|
410 else |
|
411 JDK_IMPORT_PATH = $(BUILD_JDK_IMPORT_PATH)/$(PLATFORM)-$(ARCH)$(_JDK_IMPORT_VARIANT) |
|
412 endif |
|
413 JDK_IMPORT_PATH:=$(call AltCheckSpaces,JDK_IMPORT_PATH) |
|
414 JDK_IMPORT_PATH:=$(call AltCheckValue,JDK_IMPORT_PATH) |
|
415 |