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