1 # 2 # Copyright (c) 2005, 2010, Oracle and/or its affiliates. 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. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle 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 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. 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 # VS2010 introduced a large number of security warnings that are off by 38 # default but will be turned back on with SHOW_ALL_WARNINGS=true. 39 ifndef COMPILER_WARNING_LEVEL 40 COMPILER_WARNING_LEVEL=3 41 endif 42 ifndef COMPILER_WARNINGS_FATAL 43 COMPILER_WARNINGS_FATAL=false 44 endif 45 ifndef SHOW_ALL_WARNINGS 46 SHOW_ALL_WARNINGS = false 47 endif 48 49 # Windows should use parallel compilation for best build times 50 ifndef COMPILE_APPROACH 51 COMPILE_APPROACH = normal 52 endif 53 54 # Indication that we are doing an incremental build. 55 # This may trigger the creation of make depend files. 56 # (This may not be working on windows yet, always force to false.) 57 override INCREMENTAL_BUILD = false 58 59 # WARNING: This is extremely touch stuff, between CYGWIN vs. MKS and all 60 # variations of MKS and CYGWIN releases, and 32bit vs 64bit, 61 # this file can give you nightmares. 62 # 63 # Notes: 64 # Keep all paths in the windows "mixed" style except CYGWIN UNXIXCOMMAND_PATH. 65 # Use of PrefixPath is critical, some variables must end with / (see NOTE). 66 # Use of quotes is critical due to possible spaces in paths coming from 67 # the environment variables, be careful. 68 # First convert \ to / with subst, keep it quoted due to blanks, then 69 # use cygpath -s or dosname -s to get the short non-blank name. 70 # If the MKS is old and doesn't have a dosname -s, you will be forced 71 # to set ALT variables with the short non-space directory names. 72 # If dosname doesn't appear to work, we won't use it. 73 # The dosname utility also wants to accept stdin if it is not supplied 74 # any path on the command line, this is really dangerous when using 75 # make variables that can easily become empty, so I use: 76 # echo $1 | dosname -s instead of dosname -s $1 77 # to prevent dosname from hanging up the make process when $1 is empty. 78 # The cygpath utility does not have this problem. 79 # The ALT values should never really have spaces or use \. 80 # Suspect these environment variables to have spaces and/or \ characters: 81 # SYSTEMROOT, SystemRoot, WINDIR, windir, PROGRAMFILES, ProgramFiles, 82 # DXSDK_DIR, MSTOOLS, Mstools, MSSDK, MSSdk, VCnnCOMNTOOLS, 83 # MSVCDIR, MSVCDir. 84 # So use $(subst \,/,) on them first adding quotes and placing them in 85 # their own variable assigned with :=, then use FullPath. 86 # 87 88 ifdef USING_CYGWIN 89 # Macro to effectively do a toupper without an exec 90 define ToUpper 91 $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,\ 92 $(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,\ 93 $(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,\ 94 $(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,\ 95 $(subst y,Y,$(subst z,Z,$1)))))))))))))))))))))))))) 96 endef 97 # All possible drive letters 98 drives=a b c d e f g h i j k l m n o p q r s t v u w x y z 99 # Convert /cygdrive/ paths to the mixed style without an exec of cygpath 100 # Must be a path with no spaces. /cygdrive/letter is always lowercase 101 # and letter:/ is always uppercase coming from cygpath. 102 define MixedPath 103 $(patsubst /%,$(CYGWIN_HOME)/%,$(sort $(filter-out /cygdrive/%,$(foreach drive,$(drives),$(patsubst /cygdrive/$(drive)/%,$(call ToUpper,$(drive)):/%,$1))))) 104 endef 105 # Use FullPath to get C:/ style non-spaces path. Never ends with a /! 106 # We assume cygpath is available in the search path 107 # NOTE: Use of 'pwd' with CYGWIN will not get you a mixed style path! 108 define FullPath 109 $(if $(word 2,$1),$(shell $(CYGPATH_CMD) $1 2> $(DEV_NULL)),$(call MixedPath,$(realpath $(subst ",,$1)))) 110 endef 111 define OptFullPath 112 $(shell if [ "$1" != "" -a -d "$1" ]; then $(CYGPATH_CMD) "$1" 2> $(DEV_NULL); else echo "$1"; fi) 113 endef 114 else 115 # Temporary until we upgrade to MKS 8.7, MKS pwd returns mixed mode path 116 define FullPath 117 $(shell cd $1 2> $(DEV_NULL) && pwd) 118 endef 119 define OptFullPath 120 $(shell if [ "$1" != "" -a -d "$1" ]; then (cd $1 && pwd); else echo "$1"; fi) 121 endef 122 endif 123 124 # System drive 125 ifdef SYSTEMDRIVE 126 _system_drive =$(SYSTEMDRIVE) 127 else 128 ifdef SystemDrive 129 _system_drive =$(SystemDrive) 130 endif 131 endif 132 _system_drive:=$(call CheckValue,_system_drive,C:) 133 134 # UNIXCOMMAND_PATH: path to where the most common Unix commands are. 135 # NOTE: Must end with / so that it could be empty, allowing PATH usage. 136 # With cygwin, just use this as is don't use FullPath on it. 137 ifdef ALT_UNIXCOMMAND_PATH 138 ifdef USING_CYGWIN 139 UNIXCOMMAND_PATH :=$(call PrefixPath,$(ALT_UNIXCOMMAND_PATH)) 140 else 141 xALT_UNIXCOMMAND_PATH :="$(subst \,/,$(ALT_UNIXCOMMAND_PATH))" 142 fxALT_UNIXCOMMAND_PATH :=$(call FullPath,$(xALT_UNIXCOMMAND_PATH)) 143 UNIXCOMMAND_PATH :=$(call PrefixPath,$(fxALT_UNIXCOMMAND_PATH)) 144 endif 145 else 146 ifdef USING_CYGWIN 147 UNIXCOMMAND_PATH :=$(call PrefixPath,/usr/bin) 148 else 149 ifdef ROOTDIR 150 xROOTDIR :="$(subst \,/,$(ROOTDIR))" 151 _rootdir :=$(call FullPath,$(xROOTDIR)) 152 else 153 xROOTDIR :="$(_system_drive)/mksnt" 154 _rootdir :=$(call FullPath,$(xROOTDIR)) 155 endif 156 ifneq ($(_rootdir),) 157 UNIXCOMMAND_PATH :=$(call PrefixPath,$(_rootdir)/mksnt) 158 endif 159 endif 160 endif 161 UNIXCOMMAND_PATH:=$(call AltCheckSpaces,UNIXCOMMAND_PATH) 162 163 # Get version of MKS or CYGWIN 164 ifndef USING_CYGWIN 165 _MKS_VER :=$(shell $(MKSINFO) 2>&1 | $(GREP) Release | $(TAIL) -1 | $(SED) -e 's@.*\(Release.*\)@\1@') 166 MKS_VER :=$(call GetVersion,$(_MKS_VER)) 167 # At this point, we can re-define FullPath to use DOSNAME_CMD 168 CHECK_MKS87:=$(call CheckVersions,$(MKS_VER),8.7) 169 TRY_DOSNAME:=false 170 ifeq ($(CHECK_MKS87),same) 171 TRY_DOSNAME:=true 172 endif 173 # Newer should be ok 174 ifeq ($(CHECK_MKS87),newer) 175 TRY_DOSNAME:=true 176 endif 177 ifeq ($(TRY_DOSNAME),true) 178 ifeq ($(shell $(UNIXCOMMAND_PATH)dosname -s $(_system_drive)/ 2> $(DEV_NULL)),$(_system_drive)/) 179 _DOSNAME=$(UNIXCOMMAND_PATH)dosname 180 DOSNAME_CMD:=$(_DOSNAME) -s 181 define FullPath 182 $(subst //,/,$(shell echo $1 | $(DOSNAME_CMD) 2> $(DEV_NULL))) 183 endef 184 endif # test dosname -s 185 endif # TRY_DOSNAME 186 endif # MKS 187 188 # We try to get references to what we need via the default component 189 # environment variables, or what was used historically. 190 191 # Process Windows values into FullPath values, these paths may have \ chars 192 193 # System root 194 ifdef SYSTEMROOT 195 xSYSTEMROOT :="$(subst \,/,$(SYSTEMROOT))" 196 _system_root :=$(call FullPath,$(xSYSTEMROOT)) 197 else 198 ifdef SystemRoot 199 xSYSTEMROOT :="$(subst \,/,$(SystemRoot))" 200 _system_root :=$(call FullPath,$(xSYSTEMROOT)) 201 else 202 ifdef WINDIR 203 xWINDIR :="$(subst \,/,$(WINDIR))" 204 _system_root :=$(call FullPath,$(xWINDIR)) 205 else 206 ifdef windir 207 xWINDIR :="$(subst \,/,$(windir))" 208 _system_root :=$(call FullPath,$(xWINDIR)) 209 endif 210 endif 211 endif 212 endif 213 _system_root:=$(call CheckValue,_system_root,$(_system_drive)/WINNT) 214 215 # Program Files directory 216 ifdef PROGRAMFILES 217 xPROGRAMFILES :="$(subst \,/,$(PROGRAMFILES))" 218 else 219 ifeq ($(ARCH_DATA_MODEL), 32) 220 xPROGRAMFILES :="$(_system_drive)/Program Files" 221 else 222 xPROGRAMFILES :="$(_system_drive)/Program Files (x86)" 223 endif 224 endif 225 ifeq ($(ARCH_DATA_MODEL), 32) 226 _program_files :=$(call FullPath,$(xPROGRAMFILES)) 227 _program_files32 :=$(_program_files) 228 else 229 ifdef PROGRAMW6432 230 xPROGRAMW6432 :="$(subst \,/,$(PROGRAMW6432))" 231 else 232 xPROGRAMW6432 :="$(_system_drive)/Program Files" 233 endif 234 _program_files :=$(call FullPath,$(xPROGRAMW6432)) 235 _program_files32 :=$(call FullPath,$(xPROGRAMFILES)) 236 ifneq ($(word 1,$(_program_files32)),$(_program_files32)) 237 _program_files32:= 238 endif 239 endif 240 ifneq ($(word 1,$(_program_files)),$(_program_files)) 241 _program_files:= 242 endif 243 244 # DirectX SDK 245 ifdef ALT_DXSDK_DRIVE 246 _dx_sdk_dir =$(ALT_DXSDK_DRIVE):/DXSDK 247 else 248 ifdef DXSDK_DIR 249 xDXSDK_DIR :="$(subst \,/,$(DXSDK_DIR))" 250 else 251 xDXSDK_DIR :="$(_system_drive)/DXSDK" 252 endif 253 _dx_sdk_dir :=$(call FullPath,$(xDXSDK_DIR)) 254 endif 255 256 # Use of the Visual Studio compilers requires certain env variables be set: 257 # PATH should include the path to cl.exe 258 # INCLUDE should be defined 259 # LIB should be defined 260 # LIBPATH should be defined 261 # VS100COMNTOOLS should be defined 262 # WINDOWSSDKDIR should be defined 263 # The 7.0a path is from VS2010 Pro, the 7.1 path is the standalone SDK. 264 # For 64bit either will work for us. 265 # If a developer chooses to install the standalone SDK in some other 266 # location, then they need to set WINDOWSSDKDIR. 267 # 268 # Compilers for 64bit may be from the free SDK, or Visual Studio Professional. 269 # The free Express compilers don't contain 64 bit compilers, which is why 270 # you instead need the SDK. 271 # Release enginering will use VS2010 Pro, so the frequency of testing of 272 # SDK based builds will depend entirely on individual usage. 273 274 # We only need to do this once 275 ifndef VS2010_EXISTS 276 # The 2 key paths we need are WINDOWSSDKDIR and VS100COMNTOOLS. 277 # If not defined try to see if default location exists. 278 # If defined make sure that the path has no spaces. 279 # Finally, export path with no spaces so logic minimizes FullPath calls. 280 ifndef WINDOWSSDKDIR 281 # The 7.0a SDK is the second choice. 282 xWINDOWSSDKDIR :="$(_program_files32)/Microsoft SDKs/Windows/v7.0a/" 283 fWINDOWSSDKDIR :=$(call FullPath,$(xWINDOWSSDKDIR)) 284 # The 7.1 SDK is the second choice. 285 ifeq ($(fWINDOWSSDKDIR),) 286 xWINDOWSSDKDIR :="$(_program_files32)/Microsoft SDKs/Windows/v7.1/" 287 fWINDOWSSDKDIR :=$(call FullPath,$(xWINDOWSSDKDIR)) 288 endif 289 else 290 ifneq ($(word 2,$(WINDOWSSDKDIR)),) 291 xWINDOWSSDKDIR :="$(subst \,/,$(WINDOWSSDKDIR))" 292 fWINDOWSSDKDIR :=$(call FullPath,$(xWINDOWSSDKDIR)) 293 else 294 fWINDOWSSDKDIR :=$(WINDOWSSDKDIR) 295 endif 296 endif 297 ifneq ($(fWINDOWSSDKDIR),) 298 WINDOWSSDKDIR :=$(fWINDOWSSDKDIR)/ 299 endif 300 ifndef VS100COMNTOOLS 301 xVS100COMNTOOLS :="$(_program_files32)/Microsoft Visual Studio 10.0/Common7/Tools/" 302 fVS100COMNTOOLS :=$(call FullPath,$(xVS100COMNTOOLS)) 303 else 304 xVS100COMNTOOLS :="$(subst \,/,$(VS100COMNTOOLS))" 305 ifneq ($(word 2,$(VS100COMNTOOLS)),) 306 fVS100COMNTOOLS :=$(call FullPath,$(xVS100COMNTOOLS)) 307 else 308 fVS100COMNTOOLS :=$(xVS100COMNTOOLS) 309 endif 310 endif 311 ifneq ($(fVS100COMNTOOLS),) 312 VS100COMNTOOLS :=$(fVS100COMNTOOLS)/ 313 endif 314 # Check to see that both exist 315 ifeq ($(WINDOWSSDKDIR),) 316 _vs2010_message := No WINDOWSSDKDIR found on system. $(_vs2010_message) 317 VS2010_EXISTS := false 318 endif 319 ifeq ($(VS100COMNTOOLS),) 320 _vs2010_message := No VS100COMNTOOLS found on system. $(_vs2010_message) 321 VS2010_EXISTS := false 322 endif 323 ifeq ($(VS2010_EXISTS),false) 324 x:=$(warning WARNING: No VS2010 available. $(_vs2010_message)) 325 VS100COMNTOOLS := 326 WINDOWSSDKDIR := 327 else 328 VS2010_EXISTS := true 329 _msvc_dir :=$(VS100COMNTOOLS)/../../Vc 330 endif 331 export VS2010_EXISTS 332 export VS100COMNTOOLS 333 export WINDOWSSDKDIR 334 endif 335 336 ifneq ($(VS2010_EXISTS),true) 337 x:=$(error ERROR: No VS2010 found on system.) 338 endif 339 340 # VS2010 Compiler root directory 341 _msvc_dir :=$(VS100COMNTOOLS)/../../Vc 342 # SDK root directory 343 _ms_sdk :=$(WINDOWSSDKDIR) 344 # Compiler bin directory and redist directory 345 ifeq ($(ARCH_DATA_MODEL), 32) 346 _compiler_bin :=$(_msvc_dir)/Bin 347 _redist_sdk :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC100.CRT) 348 endif 349 ifeq ($(ARCH_DATA_MODEL), 64) 350 _compiler_bin :=$(_msvc_dir)/bin/amd64 351 _redist_sdk :=$(call FullPath,$(_msvc_dir)/redist/x64/Microsoft.VC100.CRT) 352 endif 353 ifeq ($(_redist_sdk),) 354 _redist_sdk :=$(_system_root)/system32 355 endif 356 357 # Location on system where jdk installs might be 358 ifneq ($(_program_files),) 359 USRJDKINSTANCES_PATH =$(_program_files)/Java 360 else 361 USRJDKINSTANCES_PATH =$(_system_drive)/ 362 endif 363 364 # SLASH_JAVA: location of all network accessable files 365 # NOTE: Do not use FullPath on this because it's often a drive letter and 366 # plain drive letters are ambiguous, so just use this 'as is'. 367 ifdef ALT_SLASH_JAVA 368 xALT_SLASH_JAVA :="$(subst \,/,$(ALT_SLASH_JAVA))" 369 SLASH_JAVA :=$(xALT_SLASH_JAVA) 370 else 371 ifdef ALT_JDK_JAVA_DRIVE 372 SLASH_JAVA =$(JDK_JAVA_DRIVE) 373 else 374 SLASH_JAVA =J: 375 endif 376 endif 377 SLASH_JAVA:=$(call AltCheckSpaces,SLASH_JAVA) 378 SLASH_JAVA:=$(call AltCheckValue,SLASH_JAVA) 379 380 # JDK_DEVTOOLS_DIR: common path for all the java devtools 381 ifdef ALT_JDK_DEVTOOLS_DIR 382 xALT_JDK_DEVTOOLS_DIR :="$(subst \,/,$(ALT_JDK_DEVTOOLS_DIR))" 383 JDK_DEVTOOLS_DIR :=$(call FullPath,$(xALT_JDK_DEVTOOLS_DIR)) 384 else 385 JDK_DEVTOOLS_DIR =$(SLASH_JAVA)/devtools 386 endif 387 JDK_DEVTOOLS_DIR:=$(call AltCheckSpaces,JDK_DEVTOOLS_DIR) 388 JDK_DEVTOOLS_DIR:=$(call AltCheckValue,JDK_DEVTOOLS_DIR) 389 390 # COMPILER_PATH: path to where the compiler and tools are installed. 391 # NOTE: Must end with / so that it could be empty, allowing PATH usage. 392 ifdef ALT_COMPILER_PATH 393 xALT_COMPILER_PATH :="$(subst \,/,$(ALT_COMPILER_PATH))" 394 fxALT_COMPILER_PATH :=$(call FullPath,$(xALT_COMPILER_PATH)) 395 COMPILER_PATH :=$(call PrefixPath,$(fxALT_COMPILER_PATH)) 396 else 397 COMPILER_PATH :=$(call PrefixPath,$(_compiler_bin)) 398 endif 399 COMPILER_PATH :=$(call AltCheckSpaces,COMPILER_PATH) 400 401 # MSDEVTOOLS_PATH: path to where the additional MS Compiler tools are. 402 # NOTE: Must end with / so that it could be empty, allowing PATH usage. 403 ifdef ALT_MSDEVTOOLS_PATH 404 xALT_MSDEVTOOLS_PATH :="$(subst \,/,$(ALT_MSDEVTOOLS_PATH))" 405 fxALT_MSDEVTOOLS_PATH :=$(call FullPath,$(xALT_MSDEVTOOLS_PATH)) 406 MSDEVTOOLS_PATH :=$(call PrefixPath,$(fxALT_MSDEVTOOLS_PATH)) 407 else 408 ifeq ($(ARCH_DATA_MODEL), 64) 409 ifdef MSTOOLS 410 xMSTOOLS :="$(subst \,/,$(MSTOOLS))" 411 _ms_tools :=$(call FullPath,$(xMSTOOLS)) 412 else 413 ifdef Mstools 414 xMSTOOLS :="$(subst \,/,$(Mstools))" 415 _ms_tools :=$(call FullPath,$(xMSTOOLS)) 416 else 417 _ms_tools := 418 endif 419 endif 420 ifneq ($(_ms_tools),) 421 _ms_tools_bin :=$(_ms_tools)/Bin 422 else 423 # Assumes compiler bin is .../Bin/win64/x86/AMD64, rc.exe is 3 levels up 424 _ms_tools_bin :=$(_compiler_bin)/../../.. 425 endif 426 else 427 _ms_tools_bin :=$(_compiler_bin) 428 endif 429 MSDEVTOOLS_PATH :=$(call PrefixPath,$(_ms_tools_bin)) 430 endif 431 MSDEVTOOLS_PATH:=$(call AltCheckSpaces,MSDEVTOOLS_PATH) 432 433 # DEVTOOLS_PATH: for other tools required for building (such as zip, etc.) 434 # NOTE: Must end with / so that it could be empty, allowing PATH usage. 435 ifdef ALT_DEVTOOLS_PATH 436 xALT_DEVTOOLS_PATH :="$(subst \,/,$(ALT_DEVTOOLS_PATH))" 437 fxALT_DEVTOOLS_PATH :=$(call FullPath,$(xALT_DEVTOOLS_PATH)) 438 DEVTOOLS_PATH :=$(call PrefixPath,$(fxALT_DEVTOOLS_PATH)) 439 else 440 ifdef USING_CYGWIN 441 DEVTOOLS_PATH :=$(UNIXCOMMAND_PATH) 442 else 443 xDEVTOOLS_PATH :="$(_system_drive)/utils" 444 fxDEVTOOLS_PATH :=$(call FullPath,$(xDEVTOOLS_PATH)) 445 DEVTOOLS_PATH :=$(call PrefixPath,$(fxDEVTOOLS_PATH)) 446 endif 447 endif 448 DEVTOOLS_PATH:=$(call AltCheckSpaces,DEVTOOLS_PATH) 449 450 # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK. 451 # _BOOTDIR2: Second choice 452 # The _BOOTDIR3 is defind optionally. 453 ifndef ALT_BOOTDIR 454 _BOOTDIR1 =$(_system_drive)/jdk$(PREVIOUS_JDK_VERSION) 455 _BOOTDIR2 =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION) 456 _BOOTDIR3 =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH) 457 endif 458 459 # Everybody needs the MSVCRNN runtime starting with VS2010 460 _NEEDS_MSVCRNN = true 461 462 ifeq ($(_NEEDS_MSVCRNN), true) 463 # MSVCRNN_DLL_PATH: location of msvcrnn.dll that will be re-distributed 464 ifdef ALT_MSVCRNN_DLL_PATH 465 xALT_MSVCRNN_DLL_PATH :="$(subst \,/,$(ALT_MSVCRNN_DLL_PATH))" 466 MSVCRNN_DLL_PATH :=$(call FullPath,$(xALT_MSVCRNN_DLL_PATH)) 467 else 468 MSVCRNN_DLL_PATH :=$(_redist_sdk) 469 endif 470 MSVCRNN_DLL_PATH :=$(call AltCheckSpaces,MSVCRNN_DLL_PATH) 471 MSVCRNN_DLL_PATH:=$(call AltCheckValue,MSVCRNN_DLL_PATH) 472 endif 473 474 # DXSDK_PATH: path to Microsoft DirectX SDK Include and Lib 475 ifdef ALT_DXSDK_PATH 476 xALT_DXSDK_PATH :="$(subst \,/,$(ALT_DXSDK_PATH))" 477 DXSDK_PATH :=$(call FullPath,$(xALT_DXSDK_PATH)) 478 else 479 _DXSDK_PATH1 :=$(_dx_sdk_dir) 480 _DXSDK_PATH2 :=$(JDK_DEVTOOLS_DIR)/windows/dxsdk 481 DXSDK_PATH :=$(call DirExists,$(_DXSDK_PATH1),$(_DXSDK_PATH2),$(_dx_sdk_dir)) 482 endif 483 DXSDK_PATH :=$(call AltCheckSpaces,DXSDK_PATH) 484 DXSDK_PATH:=$(call AltCheckValue,DXSDK_PATH) 485 486 # DXSDK_INCLUDE_PATH: path to Microsoft DirectX SDK Include 487 ifdef ALT_DXSDK_INCLUDE_PATH 488 xALT_DXSDK_INCLUDE_PATH :="$(subst \,/,$(ALT_DXSDK_INCLUDE_PATH))" 489 DXSDK_INCLUDE_PATH :=$(call FullPath,$(xALT_DXSDK_INCLUDE_PATH)) 490 else 491 DXSDK_INCLUDE_PATH =$(subst //,/,$(DXSDK_PATH)/Include) 492 endif 493 494 # DXSDK_LIB_PATH: path to Microsoft DirectX SDK Lib 495 ifdef ALT_DXSDK_LIB_PATH 496 xALT_DXSDK_LIB_PATH :="$(subst \,/,$(ALT_DXSDK_LIB_PATH))" 497 DXSDK_LIB_PATH :=$(call FullPath,$(xALT_DXSDK_LIB_PATH)) 498 else 499 ifeq ($(ARCH_DATA_MODEL), 64) 500 # 64bit libs are located in "Lib/x64" subdir 501 DXSDK_LIB_PATH =$(subst //,/,$(DXSDK_PATH)/Lib/x64) 502 else 503 DXSDK_LIB_PATH =$(subst //,/,$(DXSDK_PATH)/Lib) 504 endif 505 endif 506 507 # DEPLOY_MSSDK: Microsoft SDK for this platform (for deploy) 508 ifdef ALT_DEPLOY_MSSDK 509 xALT_DEPLOY_MSSDK :="$(subst \,/,$(ALT_DEPLOY_MSSDK))" 510 DEPLOY_MSSDK :=$(call FullPath,$(xALT_DEPLOY_MSSDK)) 511 else 512 DEPLOY_MSSDK :=$(_ms_sdk) 513 endif 514 DEPLOY_MSSDK:=$(call AltCheckSpaces,DEPLOY_MSSDK) 515 516 # INSTALL_MSSDK: Microsoft Installer SDK for this platform (for install) 517 ifdef ALT_INSTALL_MSSDK 518 xALT_INSTALL_MSSDK :="$(subst \,/,$(ALT_INSTALL_MSSDK))" 519 INSTALL_MSSDK :=$(call FullPath,$(xALT_INSTALL_MSSDK)) 520 else 521 INSTALL_MSSDK :=$(_ms_sdk) 522 endif 523 INSTALL_MSSDK:=$(call AltCheckSpaces,INSTALL_MSSDK) 524 525 # WSCRIPT: path to wscript.exe (used in creating install bundles) 526 ifdef ALT_WSCRIPT 527 xALT_WSCRIPT :="$(subst \,/,$(ALT_WSCRIPT))" 528 WSCRIPT =$(xALT_WSCRIPT) 529 else 530 _WSCRIPT1 :=$(_system_root)/system32/wscript.exe 531 _WSCRIPT2 :=$(DEVTOOLS_PATH)wscript.exe 532 WSCRIPT :=$(call FileExists,$(_WSCRIPT1),$(_WSCRIPT2)) 533 endif 534 WSCRIPT:=$(call AltCheckSpaces,WSCRIPT) 535 # batch mode no modal dialogs on errors, please. 536 WSCRIPT += -B 537 538 # CSCRIPT: path to cscript.exe (used in creating install bundles) 539 ifdef ALT_CSCRIPT 540 xALT_CSCRIPT :="$(subst \,/,$(ALT_CSCRIPT))" 541 CSCRIPT =$(xALT_CSCRIPT) 542 else 543 _CSCRIPT1 :=$(_system_root)/system32/cscript.exe 544 _CSCRIPT2 :=$(DEVTOOLS_PATH)cscript.exe 545 CSCRIPT :=$(call FileExists,$(_CSCRIPT1),$(_CSCRIPT2)) 546 endif 547 CSCRIPT:=$(call AltCheckSpaces,CSCRIPT) 548 549 # CABARC: path to cabarc.exe (used in creating install bundles) 550 ifdef ALT_CABARC 551 xALT_CABARC :="$(subst \,/,$(ALT_CABARC))" 552 CABARC =$(xALT_CABARC) 553 else 554 _CABARC1 :=$(_system_root)/system32/cabarc.exe 555 _CABARC2 :=$(DEVTOOLS_PATH)cabarc.exe 556 CABARC :=$(call FileExists,$(_CABARC1),$(_CABARC2)) 557 endif 558 CABARC:=$(call AltCheckSpaces,CABARC) 559 560 # MSICERT: path to msicert.exe (used in creating install bundles) 561 ifdef ALT_MSICERT 562 xALT_MSICERT :="$(subst \,/,$(ALT_MSICERT))" 563 MSICERT =$(xALT_MSICERT) 564 else 565 _MSICERT1 :=$(INSTALL_MSSDK)/Bin/msicert.exe 566 _MSICERT2 :=$(DEVTOOLS_PATH)msicert.exe 567 MSICERT :=$(call FileExists,$(_MSICERT1),$(_MSICERT2)) 568 endif 569 MSICERT:=$(call AltCheckSpaces,MSICERT) 570 571 # Import JDK images allow for partial builds, components not built are 572 # imported (or copied from) these import areas when needed. 573 574 # BUILD_JDK_IMPORT_PATH: location of JDK install trees to import for 575 # multiple platforms, e.g. windows-i586, solaris-sparc, linux-586, etc. 576 ifdef ALT_BUILD_JDK_IMPORT_PATH 577 BUILD_JDK_IMPORT_PATH :=$(call FullPath,$(ALT_BUILD_JDK_IMPORT_PATH)) 578 else 579 BUILD_JDK_IMPORT_PATH = $(PROMOTED_BUILD_BINARIES) 580 endif 581 BUILD_JDK_IMPORT_PATH:=$(call AltCheckSpaces,BUILD_JDK_IMPORT_PATH) 582 BUILD_JDK_IMPORT_PATH:=$(call AltCheckValue,BUILD_JDK_IMPORT_PATH) 583 584 # JDK_IMPORT_PATH: location of previously built JDK (this version) to import 585 ifdef ALT_JDK_IMPORT_PATH 586 JDK_IMPORT_PATH :=$(call FullPath,$(ALT_JDK_IMPORT_PATH)) 587 else 588 JDK_IMPORT_PATH = $(BUILD_JDK_IMPORT_PATH)/$(PLATFORM)-$(ARCH)$(_JDK_IMPORT_VARIANT) 589 endif 590 JDK_IMPORT_PATH:=$(call AltCheckSpaces,JDK_IMPORT_PATH) 591 JDK_IMPORT_PATH:=$(call AltCheckValue,JDK_IMPORT_PATH) 592 593 # HOTSPOT_IMPORT_PATH: location of hotspot pre-built files 594 ifdef ALT_HOTSPOT_IMPORT_PATH 595 HOTSPOT_IMPORT_PATH :=$(call FullPath,$(ALT_HOTSPOT_IMPORT_PATH)) 596 else 597 # Default locations include the current $OUTPUTDIR, RE Promotions, 598 # and a JDK. Please be aware the JDK does not include a Kernel VM. 599 _HOTSPOT_IMPORT_PATH1 = $(OUTPUTDIR)/hotspot/import 600 _HOTSPOT_IMPORT_PATH2 = $(PROMOTED_BUILD_DISTDIR)/hotspot/import 601 _HOTSPOT_IMPORT_PATH3 = $(JDK_IMPORT_PATH) 602 HOTSPOT_IMPORT_PATH := $(call DirExists,$(_HOTSPOT_IMPORT_PATH1),$(_HOTSPOT_IMPORT_PATH2),$(_HOTSPOT_IMPORT_PATH3)) 603 endif 604 HOTSPOT_IMPORT_PATH:=$(call AltCheckSpaces,HOTSPOT_IMPORT_PATH) 605 HOTSPOT_IMPORT_PATH:=$(call AltCheckValue,HOTSPOT_IMPORT_PATH) 606 607 # HOTSPOT_CLIENT_PATH: location of client jvm library file. 608 ifeq ($(ARCH_DATA_MODEL), 32) 609 ifdef ALT_HOTSPOT_CLIENT_PATH 610 HOTSPOT_CLIENT_PATH :=$(call FullPath,$(ALT_HOTSPOT_CLIENT_PATH)) 611 else 612 HOTSPOT_CLIENT_PATH =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/client 613 endif 614 HOTSPOT_CLIENT_PATH:=$(call AltCheckSpaces,HOTSPOT_CLIENT_PATH) 615 HOTSPOT_CLIENT_PATH:=$(call AltCheckValue,HOTSPOT_CLIENT_PATH) 616 endif 617 618 # HOTSPOT_SERVER_PATH: location of server jvm library file. 619 ifdef ALT_HOTSPOT_SERVER_PATH 620 HOTSPOT_SERVER_PATH :=$(call FullPath,$(ALT_HOTSPOT_SERVER_PATH)) 621 else 622 HOTSPOT_SERVER_PATH =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/server 623 endif 624 HOTSPOT_SERVER_PATH:=$(call AltCheckSpaces,HOTSPOT_SERVER_PATH) 625 HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH) 626 627 # HOTSPOT_LIB_PATH: location of jvm.lib file. 628 ifdef ALT_HOTSPOT_LIB_PATH 629 xALT_HOTSPOT_LIB_PATH :="$(subst \,/,$(ALT_HOTSPOT_LIB_PATH))" 630 HOTSPOT_LIB_PATH :=$(call FullPath,$(xALT_HOTSPOT_LIB_PATH)) 631 else 632 HOTSPOT_LIB_PATH =$(HOTSPOT_IMPORT_PATH)/lib 633 endif 634 HOTSPOT_LIB_PATH:=$(call AltCheckSpaces,HOTSPOT_LIB_PATH) 635 HOTSPOT_LIB_PATH:=$(call AltCheckValue,HOTSPOT_LIB_PATH) 636 637 # Special define for checking the binaries 638 639 # All windows dll and exe files should have been built with /NXCOMPAT 640 # and be setup for dynamic base addresses. 641 # In addition, we should not be dependent on certain dll files that 642 # we do not or cannot redistribute. 643 644 # List of filenames we should NOT be dependent on 645 ifeq ($(MFC_DEBUG),true) 646 BANNED_DLLS=msvcp100[.]dll 647 else 648 BANNED_DLLS=msvcp100[.]dll|msvcr100d[.]dll|msvcrtd[.]dll 649 endif 650 651 # Check for /safeseh (only used on 32bit) 652 define binary_file_safeseh_verification # binary_file 653 ( \ 654 $(ECHO) "Checking for /SAFESEH usage in: $1" && \ 655 if [ "`$(DUMPBIN) /loadconfig $1 | $(EGREP) -i 'Safe Exception Handler Table'`" = "" ] ; then \ 656 $(ECHO) "ERROR: Did not find 'Safe Exception Handler Table' in loadconfig: $1" ; \ 657 $(DUMPBIN) /loadconfig $1 ; \ 658 exit 6 ; \ 659 fi ; \ 660 ) 661 endef 662 663 # Check for /NXCOMPAT usage 664 define binary_file_nxcompat_verification # binary_file 665 ( \ 666 $(ECHO) "Checking for /NXCOMPAT usage in: $1" && \ 667 if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'NX compatible'`" = "" ] ; then \ 668 $(ECHO) "ERROR: Did not find 'NX compatible' in headers: $1" ; \ 669 $(DUMPBIN) /headers $1 ; \ 670 exit 7 ; \ 671 fi ; \ 672 ) 673 endef 674 675 # Check for /DYNAMICBASE usage 676 define binary_file_dynamicbase_verification # binary_file 677 ( \ 678 $(ECHO) "Checking for /DYNAMICBASE usage in: $1" && \ 679 if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'Dynamic base'`" = "" ] ; then \ 680 $(ECHO) "ERROR: Did not find 'Dynamic base' in headers: $1" ; \ 681 $(DUMPBIN) /headers $1 ; \ 682 exit 8 ; \ 683 fi ; \ 684 ) 685 endef 686 687 # Check for banned dll usage 688 define binary_file_dll_verification # binary_file 689 ( \ 690 $(ECHO) "Checking for banned dependencies in: $1" && \ 691 if [ "`$(DUMPBIN) /dependents $1 | $(EGREP) -i '$(BANNED_DLLS)'`" != "" ] ; then \ 692 $(ECHO) "ERROR: Found use of $(BANNED_DLLS)"; \ 693 $(DUMPBIN) /dependents $1 ; \ 694 exit 9 ; \ 695 fi ; \ 696 ) 697 endef 698 699 # Macro to check it's input file for properly built executables. 700 # Relies on process exit code. Different for 32bit vs 64bit. 701 ifeq ($(ARCH_DATA_MODEL),32) 702 define binary_file_verification # binary_file 703 ( \ 704 $(call binary_file_safeseh_verification,$1); \ 705 $(call binary_file_nxcompat_verification,$1); \ 706 $(call binary_file_dynamicbase_verification,$1); \ 707 $(call binary_file_dll_verification,$1); \ 708 ) 709 endef 710 else 711 define binary_file_verification # binary_file 712 ( \ 713 $(call binary_file_nxcompat_verification,$1); \ 714 $(call binary_file_dynamicbase_verification,$1); \ 715 $(call binary_file_dll_verification,$1); \ 716 ) 717 endef 718 endif 719