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 # Setup for VS2010 is simple, others logic is historic
 337 ifeq ($(VS2010_EXISTS),true)
 338   
 339   # VS2010 Compiler root directory
 340   _msvc_dir :=$(VS100COMNTOOLS)/../../Vc
 341   # SDK root directory
 342   _ms_sdk   :=$(WINDOWSSDKDIR)
 343   # Compiler bin directory and redist directory
 344   ifeq ($(ARCH_DATA_MODEL), 32)
 345     _compiler_bin :=$(_msvc_dir)/Bin
 346     _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC100.CRT)
 347   endif
 348   ifeq ($(ARCH_DATA_MODEL), 64)
 349     _compiler_bin :=$(_msvc_dir)/bin/amd64
 350     _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x64/Microsoft.VC100.CRT)
 351   endif
 352   ifeq ($(_redist_sdk),)
 353     _redist_sdk   :=$(_system_root)/system32
 354   endif
 355 
 356 else # Not VS2010
 357 
 358   # Compilers, SDK, and Visual Studio (MSDEV) [32bit is different from 64bit]
 359   ifeq ($(ARCH_DATA_MODEL), 32)
 360 
 361     # Try looking in MSVCDIR or MSVCDir area first 
 362     # (set by vcvars32.bat for VC .NET, not defined in the VC 2008/2010)
 363     ifdef MSVCDIR
 364       xMSVCDIR  :="$(subst \,/,$(MSVCDIR))"
 365       _msvc_dir :=$(call FullPath,$(xMSVCDIR))
 366     else
 367       ifdef MSVCDir
 368         xMSVCDIR  :="$(subst \,/,$(MSVCDir))"
 369         _msvc_dir :=$(call FullPath,$(xMSVCDIR))
 370       endif
 371     endif
 372     # If we still don't have it, look for VSnnCOMNTOOLS (newest first),
 373     # set by installer?
 374     ifeq ($(_msvc_dir),)
 375       ifdef VS90COMNTOOLS  # /Common/Tools directory, use ../../Vc
 376         xVS90COMNTOOLS :="$(subst \,/,$(VS90COMNTOOLS))"
 377         _vs90tools     :=$(call FullPath,$(xVS90COMNTOOLS))
 378       endif
 379       ifneq ($(_vs90tools),)
 380         _msvc_dir   :=$(_vs90tools)/../../Vc
 381       else
 382         ifdef VS80COMNTOOLS  # /Common/Tools directory, use ../../Vc
 383           xVS80COMNTOOLS :="$(subst \,/,$(VS80COMNTOOLS))"
 384           _vs80tools     :=$(call FullPath,$(xVS80COMNTOOLS))
 385         endif
 386         ifneq ($(_vs80tools),)
 387           _msvc_dir   :=$(_vs80tools)/../../Vc
 388         else
 389           ifdef VS71COMNTOOLS  # /Common/Tools directory, use ../../Vc7
 390             xVS71COMNTOOLS :="$(subst \,/,$(VS71COMNTOOLS))"
 391             _vs71tools     :=$(call FullPath,$(xVS71COMNTOOLS))
 392           endif
 393           ifneq ($(_vs71tools),)
 394             _msvc_dir   :=$(_vs71tools)/../../Vc7
 395           endif
 396         endif
 397       endif
 398     endif
 399   
 400     ifneq ($(_msvc_dir),)
 401       _compiler_bin :=$(_msvc_dir)/Bin
 402       # Assume PlatformSDK is in VS71 (will be empty if VS90)
 403       _ms_sdk       :=$(call FullPath,$(_msvc_dir)/PlatformSDK)
 404       _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC90.CRT)
 405       ifeq ($(_redist_sdk),)
 406         _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC80.CRT)
 407         ifeq ($(_redist_sdk),)
 408           _redist_sdk   :=$(call FullPath,$(_msvc_dir)/../SDK/v1.1/Bin)
 409         endif
 410       endif
 411     endif
 412   endif
 413 
 414   # The Microsoft Platform SDK installed by itself
 415   ifneq ($(_program_files),)
 416     _PSDK :="$(_program_files)/Microsoft SDKs/Windows/v6.1/"
 417     _psdk :=$(call FullPath,$(xMSSDK61))
 418     ifeq ($(_psdk),)
 419       xPSDK  :="$(_program_files)/Microsoft Platform SDK"
 420       _psdk  :=$(call FullPath,$(xPSDK))
 421       ifeq ($(_psdk),)
 422         xPSDK  :="$(_program_files)/Microsoft SDK"
 423         _psdk :=$(call FullPath,$(xMSSDK))
 424       endif
 425     endif
 426   endif
 427 
 428   # If no SDK found yet, look in other places
 429   ifeq ($(_ms_sdk),)
 430     ifdef MSSDK
 431     xMSSDK  :="$(subst \,/,$(MSSDK))"
 432     _ms_sdk :=$(call FullPath,$(xMSSDK))
 433   else
 434     ifdef MSSdk
 435       xMSSDK  :="$(subst \,/,$(MSSdk))"
 436       _ms_sdk :=$(call FullPath,$(xMSSDK))
 437     else
 438         _ms_sdk :=$(_psdk)
 439       endif
 440     endif
 441   endif
 442   
 443   # Compilers for 64bit may be from the free SDK, or Visual Studio Professional.
 444   ifeq ($(ARCH_DATA_MODEL), 64)
 445     xVS2008 :="$(_program_files32)/Microsoft Visual Studio 9.0/"
 446     VS2008 :=$(call FullPath,$(xVS2008))
 447     ifneq ($(VS2008),)
 448       _compiler_bin :=$(VS2008)/VC/Bin/$(ARCH)
 449       xMSSDK61      :="$(_program_files)/Microsoft SDKs/Windows/v6.1/"
 450       MSSDK61       :=$(call FullPath,$(xMSSDK61))
 451       _redist_sdk   :=$(VS2008)/VC/redist/x64/Microsoft.VC90.CRT
 452     else
 453       ifneq ($(_ms_sdk),)
 454         ifeq ($(ARCH), ia64)
 455           _compiler_bin :=$(_ms_sdk)/Bin/Win64
 456         endif
 457         ifeq ($(ARCH), amd64)
 458           _compiler_bin :=$(_ms_sdk)/Bin/Win64/x86/$(ARCH)
 459           _redist_sdk   :=$(_ms_sdk)/redist/win64/AMD64
 460         endif
 461       endif
 462     endif
 463   endif
 464 
 465 endif # VS2010_EXISTS
 466 
 467 # Location on system where jdk installs might be
 468 ifneq ($(_program_files),)
 469   USRJDKINSTANCES_PATH =$(_program_files)/Java
 470 else
 471   USRJDKINSTANCES_PATH =$(_system_drive)/
 472 endif
 473 
 474 # SLASH_JAVA: location of all network accessable files
 475 # NOTE: Do not use FullPath on this because it's often a drive letter and
 476 #       plain drive letters are ambiguous, so just use this 'as is'.
 477 ifdef ALT_SLASH_JAVA
 478   xALT_SLASH_JAVA :="$(subst \,/,$(ALT_SLASH_JAVA))"
 479   SLASH_JAVA      :=$(xALT_SLASH_JAVA)
 480 else
 481   ifdef ALT_JDK_JAVA_DRIVE
 482     SLASH_JAVA  =$(JDK_JAVA_DRIVE)
 483   else
 484     SLASH_JAVA  =J:
 485   endif
 486 endif
 487 SLASH_JAVA:=$(call AltCheckSpaces,SLASH_JAVA)
 488 SLASH_JAVA:=$(call AltCheckValue,SLASH_JAVA)
 489 
 490 # JDK_DEVTOOLS_DIR: common path for all the java devtools
 491 ifdef ALT_JDK_DEVTOOLS_DIR
 492   xALT_JDK_DEVTOOLS_DIR :="$(subst \,/,$(ALT_JDK_DEVTOOLS_DIR))"
 493   JDK_DEVTOOLS_DIR      :=$(call FullPath,$(xALT_JDK_DEVTOOLS_DIR))
 494 else
 495   JDK_DEVTOOLS_DIR =$(SLASH_JAVA)/devtools
 496 endif
 497 JDK_DEVTOOLS_DIR:=$(call AltCheckSpaces,JDK_DEVTOOLS_DIR)
 498 JDK_DEVTOOLS_DIR:=$(call AltCheckValue,JDK_DEVTOOLS_DIR)
 499 
 500 # COMPILER_PATH: path to where the compiler and tools are installed.
 501 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
 502 ifdef ALT_COMPILER_PATH
 503   xALT_COMPILER_PATH  :="$(subst \,/,$(ALT_COMPILER_PATH))"
 504   fxALT_COMPILER_PATH :=$(call FullPath,$(xALT_COMPILER_PATH))
 505   COMPILER_PATH       :=$(call PrefixPath,$(fxALT_COMPILER_PATH))
 506 else
 507   COMPILER_PATH :=$(call PrefixPath,$(_compiler_bin))
 508 endif
 509 COMPILER_PATH :=$(call AltCheckSpaces,COMPILER_PATH)
 510 
 511 # MSDEVTOOLS_PATH: path to where the additional MS Compiler tools are.
 512 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
 513 ifdef ALT_MSDEVTOOLS_PATH
 514   xALT_MSDEVTOOLS_PATH  :="$(subst \,/,$(ALT_MSDEVTOOLS_PATH))"
 515   fxALT_MSDEVTOOLS_PATH :=$(call FullPath,$(xALT_MSDEVTOOLS_PATH))
 516   MSDEVTOOLS_PATH       :=$(call PrefixPath,$(fxALT_MSDEVTOOLS_PATH))
 517 else
 518   ifeq ($(ARCH_DATA_MODEL), 64)
 519     ifdef MSTOOLS
 520       xMSTOOLS  :="$(subst \,/,$(MSTOOLS))"
 521       _ms_tools :=$(call FullPath,$(xMSTOOLS))
 522     else
 523       ifdef Mstools
 524         xMSTOOLS  :="$(subst \,/,$(Mstools))"
 525         _ms_tools :=$(call FullPath,$(xMSTOOLS))
 526       else
 527         _ms_tools :=
 528       endif
 529     endif
 530     ifneq ($(_ms_tools),)
 531       _ms_tools_bin :=$(_ms_tools)/Bin
 532     else
 533       # Assumes compiler bin is .../Bin/win64/x86/AMD64, rc.exe is 3 levels up
 534       _ms_tools_bin :=$(_compiler_bin)/../../..
 535     endif
 536   else
 537     _ms_tools_bin :=$(_compiler_bin)
 538   endif
 539   MSDEVTOOLS_PATH :=$(call PrefixPath,$(_ms_tools_bin))
 540 endif
 541 MSDEVTOOLS_PATH:=$(call AltCheckSpaces,MSDEVTOOLS_PATH)
 542 
 543 # DEVTOOLS_PATH: for other tools required for building (such as zip, etc.)
 544 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
 545 ifdef ALT_DEVTOOLS_PATH
 546   xALT_DEVTOOLS_PATH  :="$(subst \,/,$(ALT_DEVTOOLS_PATH))"
 547   fxALT_DEVTOOLS_PATH :=$(call FullPath,$(xALT_DEVTOOLS_PATH))
 548   DEVTOOLS_PATH       :=$(call PrefixPath,$(fxALT_DEVTOOLS_PATH))
 549 else
 550   ifdef USING_CYGWIN
 551     DEVTOOLS_PATH :=$(UNIXCOMMAND_PATH)
 552   else
 553     xDEVTOOLS_PATH  :="$(_system_drive)/utils"
 554     fxDEVTOOLS_PATH :=$(call FullPath,$(xDEVTOOLS_PATH))
 555     DEVTOOLS_PATH  :=$(call PrefixPath,$(fxDEVTOOLS_PATH))
 556   endif
 557 endif
 558 DEVTOOLS_PATH:=$(call AltCheckSpaces,DEVTOOLS_PATH)
 559 
 560 # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
 561 # _BOOTDIR2: Second choice
 562 # The _BOOTDIR3 is defind optionally.
 563 ifndef ALT_BOOTDIR
 564   _BOOTDIR1  =$(_system_drive)/jdk$(PREVIOUS_JDK_VERSION)
 565   _BOOTDIR2  =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION)
 566   _BOOTDIR3  =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
 567 endif
 568 
 569 # 32bit always needs the MSVCRNN runtime, 64bit does when using VS2008
 570 ifeq ($(ARCH_DATA_MODEL), 32)
 571   _NEEDS_MSVCRNN = true
 572 else
 573   ifeq ($(VS2010_EXISTS),true)
 574     _NEEDS_MSVCRNN = true
 575   else 
 576     ifneq ($(VS2008),)
 577       _NEEDS_MSVCRNN = true
 578     else
 579       _NEEDS_MSVCRNN = false
 580     endif
 581   endif
 582 endif
 583 
 584 ifeq ($(_NEEDS_MSVCRNN), true)
 585   # MSVCRNN_DLL_PATH: location of msvcrnn.dll that will be re-distributed
 586   ifdef ALT_MSVCRNN_DLL_PATH
 587     xALT_MSVCRNN_DLL_PATH :="$(subst \,/,$(ALT_MSVCRNN_DLL_PATH))"
 588     MSVCRNN_DLL_PATH      :=$(call FullPath,$(xALT_MSVCRNN_DLL_PATH))
 589   else
 590     MSVCRNN_DLL_PATH :=$(_redist_sdk)
 591   endif
 592   MSVCRNN_DLL_PATH :=$(call AltCheckSpaces,MSVCRNN_DLL_PATH)
 593   MSVCRNN_DLL_PATH:=$(call AltCheckValue,MSVCRNN_DLL_PATH)
 594 endif
 595 
 596 # DXSDK_PATH: path to Microsoft DirectX SDK Include and Lib
 597 ifdef ALT_DXSDK_PATH
 598   xALT_DXSDK_PATH :="$(subst \,/,$(ALT_DXSDK_PATH))"
 599   DXSDK_PATH      :=$(call FullPath,$(xALT_DXSDK_PATH))
 600 else
 601   _DXSDK_PATH1 :=$(_dx_sdk_dir)
 602   _DXSDK_PATH2 :=$(JDK_DEVTOOLS_DIR)/windows/dxsdk
 603   DXSDK_PATH  :=$(call DirExists,$(_DXSDK_PATH1),$(_DXSDK_PATH2),$(_dx_sdk_dir))
 604 endif
 605 DXSDK_PATH :=$(call AltCheckSpaces,DXSDK_PATH)
 606 DXSDK_PATH:=$(call AltCheckValue,DXSDK_PATH)
 607 
 608 # DXSDK_INCLUDE_PATH: path to Microsoft DirectX SDK Include
 609 ifdef ALT_DXSDK_INCLUDE_PATH
 610   xALT_DXSDK_INCLUDE_PATH :="$(subst \,/,$(ALT_DXSDK_INCLUDE_PATH))"
 611   DXSDK_INCLUDE_PATH      :=$(call FullPath,$(xALT_DXSDK_INCLUDE_PATH))
 612 else
 613   DXSDK_INCLUDE_PATH =$(subst //,/,$(DXSDK_PATH)/Include)
 614 endif
 615 
 616 # DXSDK_LIB_PATH: path to Microsoft DirectX SDK Lib
 617 ifdef ALT_DXSDK_LIB_PATH
 618   xALT_DXSDK_LIB_PATH :="$(subst \,/,$(ALT_DXSDK_LIB_PATH))"
 619   DXSDK_LIB_PATH      :=$(call FullPath,$(xALT_DXSDK_LIB_PATH))
 620 else
 621   ifeq ($(ARCH_DATA_MODEL), 64)
 622     # 64bit libs are located in "Lib/x64" subdir
 623     DXSDK_LIB_PATH =$(subst //,/,$(DXSDK_PATH)/Lib/x64)
 624   else
 625     DXSDK_LIB_PATH =$(subst //,/,$(DXSDK_PATH)/Lib)
 626   endif
 627 endif
 628 
 629 # DEPLOY_MSSDK: Microsoft SDK for this platform (for deploy)
 630 ifdef ALT_DEPLOY_MSSDK
 631   xALT_DEPLOY_MSSDK :="$(subst \,/,$(ALT_DEPLOY_MSSDK))"
 632   DEPLOY_MSSDK      :=$(call FullPath,$(xALT_DEPLOY_MSSDK))
 633 else
 634   DEPLOY_MSSDK      :=$(_ms_sdk)
 635 endif
 636 DEPLOY_MSSDK:=$(call AltCheckSpaces,DEPLOY_MSSDK)
 637 
 638 # INSTALL_MSSDK: Microsoft Installer SDK for this platform (for install)
 639 ifdef ALT_INSTALL_MSSDK
 640   xALT_INSTALL_MSSDK :="$(subst \,/,$(ALT_INSTALL_MSSDK))"
 641   INSTALL_MSSDK      :=$(call FullPath,$(xALT_INSTALL_MSSDK))
 642 else
 643   INSTALL_MSSDK      :=$(_ms_sdk)
 644 endif
 645 INSTALL_MSSDK:=$(call AltCheckSpaces,INSTALL_MSSDK)
 646 
 647 # WSCRIPT: path to wscript.exe (used in creating install bundles)
 648 ifdef ALT_WSCRIPT
 649   xALT_WSCRIPT :="$(subst \,/,$(ALT_WSCRIPT))"
 650   WSCRIPT  =$(xALT_WSCRIPT)
 651 else
 652   _WSCRIPT1 :=$(_system_root)/system32/wscript.exe
 653   _WSCRIPT2 :=$(DEVTOOLS_PATH)wscript.exe
 654   WSCRIPT  :=$(call FileExists,$(_WSCRIPT1),$(_WSCRIPT2))
 655 endif
 656 WSCRIPT:=$(call AltCheckSpaces,WSCRIPT)
 657 # batch mode no modal dialogs on errors, please.
 658 WSCRIPT += -B
 659 
 660 # CSCRIPT: path to cscript.exe (used in creating install bundles)
 661 ifdef ALT_CSCRIPT
 662   xALT_CSCRIPT :="$(subst \,/,$(ALT_CSCRIPT))"
 663   CSCRIPT  =$(xALT_CSCRIPT)
 664 else
 665   _CSCRIPT1 :=$(_system_root)/system32/cscript.exe
 666   _CSCRIPT2 :=$(DEVTOOLS_PATH)cscript.exe
 667   CSCRIPT  :=$(call FileExists,$(_CSCRIPT1),$(_CSCRIPT2))
 668 endif
 669 CSCRIPT:=$(call AltCheckSpaces,CSCRIPT)
 670 
 671 # CABARC: path to cabarc.exe (used in creating install bundles)
 672 ifdef ALT_CABARC
 673   xALT_CABARC :="$(subst \,/,$(ALT_CABARC))"
 674   CABARC  =$(xALT_CABARC)
 675 else
 676   _CABARC1 :=$(_system_root)/system32/cabarc.exe
 677   _CABARC2 :=$(DEVTOOLS_PATH)cabarc.exe
 678   CABARC  :=$(call FileExists,$(_CABARC1),$(_CABARC2))
 679 endif
 680 CABARC:=$(call AltCheckSpaces,CABARC)
 681 
 682 # MSICERT: path to msicert.exe (used in creating install bundles)
 683 ifdef ALT_MSICERT
 684   xALT_MSICERT :="$(subst \,/,$(ALT_MSICERT))"
 685   MSICERT  =$(xALT_MSICERT)
 686 else
 687   _MSICERT1 :=$(INSTALL_MSSDK)/Bin/msicert.exe
 688   _MSICERT2 :=$(DEVTOOLS_PATH)msicert.exe
 689   MSICERT   :=$(call FileExists,$(_MSICERT1),$(_MSICERT2))
 690 endif
 691 MSICERT:=$(call AltCheckSpaces,MSICERT)
 692 
 693 # Import JDK images allow for partial builds, components not built are
 694 #    imported (or copied from) these import areas when needed.
 695 
 696 # BUILD_JDK_IMPORT_PATH: location of JDK install trees to import for
 697 #   multiple platforms, e.g. windows-i586, solaris-sparc, linux-586, etc.
 698 ifdef ALT_BUILD_JDK_IMPORT_PATH
 699   BUILD_JDK_IMPORT_PATH  :=$(call FullPath,$(ALT_BUILD_JDK_IMPORT_PATH))
 700 else
 701   BUILD_JDK_IMPORT_PATH   = $(PROMOTED_BUILD_BINARIES)
 702 endif
 703 BUILD_JDK_IMPORT_PATH:=$(call AltCheckSpaces,BUILD_JDK_IMPORT_PATH)
 704 BUILD_JDK_IMPORT_PATH:=$(call AltCheckValue,BUILD_JDK_IMPORT_PATH)
 705 
 706 # JDK_IMPORT_PATH: location of previously built JDK (this version) to import
 707 ifdef ALT_JDK_IMPORT_PATH
 708   JDK_IMPORT_PATH  :=$(call FullPath,$(ALT_JDK_IMPORT_PATH))
 709 else
 710   JDK_IMPORT_PATH   = $(BUILD_JDK_IMPORT_PATH)/$(PLATFORM)-$(ARCH)$(_JDK_IMPORT_VARIANT)
 711 endif
 712 JDK_IMPORT_PATH:=$(call AltCheckSpaces,JDK_IMPORT_PATH)
 713 JDK_IMPORT_PATH:=$(call AltCheckValue,JDK_IMPORT_PATH)
 714 
 715 # HOTSPOT_IMPORT_PATH: location of hotspot pre-built files
 716 ifdef ALT_HOTSPOT_IMPORT_PATH
 717   HOTSPOT_IMPORT_PATH :=$(call FullPath,$(ALT_HOTSPOT_IMPORT_PATH))
 718 else
 719   # Default locations include the current $OUTPUTDIR, RE Promotions,
 720   # and a JDK.  Please be aware the JDK does not include a Kernel VM.
 721   _HOTSPOT_IMPORT_PATH1 = $(OUTPUTDIR)/hotspot/import
 722   _HOTSPOT_IMPORT_PATH2 = $(PROMOTED_BUILD_DISTDIR)/hotspot/import
 723   _HOTSPOT_IMPORT_PATH3 = $(JDK_IMPORT_PATH)
 724    HOTSPOT_IMPORT_PATH := $(call DirExists,$(_HOTSPOT_IMPORT_PATH1),$(_HOTSPOT_IMPORT_PATH2),$(_HOTSPOT_IMPORT_PATH3))
 725 endif
 726 HOTSPOT_IMPORT_PATH:=$(call AltCheckSpaces,HOTSPOT_IMPORT_PATH)
 727 HOTSPOT_IMPORT_PATH:=$(call AltCheckValue,HOTSPOT_IMPORT_PATH)
 728 
 729 # HOTSPOT_CLIENT_PATH: location of client jvm library file.
 730 ifeq ($(ARCH_DATA_MODEL), 32)
 731   ifdef ALT_HOTSPOT_CLIENT_PATH
 732     HOTSPOT_CLIENT_PATH :=$(call FullPath,$(ALT_HOTSPOT_CLIENT_PATH))
 733   else
 734     HOTSPOT_CLIENT_PATH   =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/client
 735   endif
 736   HOTSPOT_CLIENT_PATH:=$(call AltCheckSpaces,HOTSPOT_CLIENT_PATH)
 737   HOTSPOT_CLIENT_PATH:=$(call AltCheckValue,HOTSPOT_CLIENT_PATH)
 738 endif
 739 
 740 # HOTSPOT_SERVER_PATH: location of server jvm library file.
 741 ifdef ALT_HOTSPOT_SERVER_PATH
 742   HOTSPOT_SERVER_PATH :=$(call FullPath,$(ALT_HOTSPOT_SERVER_PATH))
 743 else
 744   HOTSPOT_SERVER_PATH   =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/server
 745 endif
 746 HOTSPOT_SERVER_PATH:=$(call AltCheckSpaces,HOTSPOT_SERVER_PATH)
 747 HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH)
 748 
 749 # HOTSPOT_LIB_PATH: location of jvm.lib file.
 750 ifdef ALT_HOTSPOT_LIB_PATH
 751   xALT_HOTSPOT_LIB_PATH :="$(subst \,/,$(ALT_HOTSPOT_LIB_PATH))"
 752   HOTSPOT_LIB_PATH      :=$(call FullPath,$(xALT_HOTSPOT_LIB_PATH))
 753 else
 754   HOTSPOT_LIB_PATH  =$(HOTSPOT_IMPORT_PATH)/lib
 755 endif
 756 HOTSPOT_LIB_PATH:=$(call AltCheckSpaces,HOTSPOT_LIB_PATH)
 757 HOTSPOT_LIB_PATH:=$(call AltCheckValue,HOTSPOT_LIB_PATH)
 758 
 759 # Special define for checking the binaries
 760 
 761 ifeq ($(VS2010_EXISTS),true)
 762 
 763 # All windows dll and exe files should have been built with /NXCOMPAT
 764 #   and be setup for dynamic base addresses.
 765 #   In addition, we should not be dependent on certain dll files that
 766 #   we do not or cannot redistribute.
 767 
 768 # List of filenames we should NOT be dependent on
 769 ifeq ($(MFC_DEBUG),true)
 770   BANNED_DLLS=msvcp100[.]dll
 771 else
 772   BANNED_DLLS=msvcp100[.]dll|msvcr100d[.]dll|msvcrtd[.]dll
 773 endif
 774 
 775 # Macro to check it's input file for banned dependencies and verify the
 776 #   binary was built properly. Relies on process exit code.
 777 define binary_file_verification # binary_file
 778 ( \
 779   $(ECHO) "Checking for /NXCOMPAT usage in: $1" && \
 780   if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'NX compatible'`" = "" ] ; then \
 781     $(ECHO) "ERROR: Did not find 'NX compatible' in headers: $1" ; \
 782     $(DUMPBIN) /headers $1 ; \
 783     exit 7 ; \
 784   fi ; \
 785   $(ECHO) "Checking for /DYNAMICBASE usage in: $1" && \
 786   if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'Dynamic base'`" = "" ] ; then \
 787     $(ECHO) "ERROR: Did not find 'Dynamic base' in headers: $1" ; \
 788     $(DUMPBIN) /headers $1 ; \
 789     exit 8 ; \
 790   fi ; \
 791   $(ECHO) "Checking for banned dependencies in: $1" && \
 792   if [ "`$(DUMPBIN) /dependents $1 | $(EGREP) -i '$(BANNED_DLLS)'`" != "" ] ; then \
 793     $(ECHO) "ERROR: Found use of $(BANNED_DLLS)"; \
 794     $(DUMPBIN) /dependents $1 ; \
 795     exit 9 ; \
 796   fi ; \
 797 )
 798 endef
 799 
 800 else
 801 
 802 # Macro to check it's input file for banned dependencies and verify the
 803 #   binary was built properly. Relies on process exit code.
 804 define binary_file_verification # binary_file
 805 endef
 806 
 807 endif
 808