jdk/makefiles/common/shared/Defs-windows.gmk
changeset 13164 72c5d01a857d
parent 13082 9b19b2302c28
child 13167 efec101d7d87
equal deleted inserted replaced
13082:9b19b2302c28 13164:72c5d01a857d
     1 #
       
     2 # Copyright (c) 2005, 2011, 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 
       
   379 # JDK_DEVTOOLS_DIR: common path for all the java devtools
       
   380 ifdef ALT_JDK_DEVTOOLS_DIR
       
   381   xALT_JDK_DEVTOOLS_DIR :="$(subst \,/,$(ALT_JDK_DEVTOOLS_DIR))"
       
   382   JDK_DEVTOOLS_DIR      :=$(call FullPath,$(xALT_JDK_DEVTOOLS_DIR))
       
   383 else
       
   384   JDK_DEVTOOLS_DIR =$(SLASH_JAVA)/devtools
       
   385 endif
       
   386 JDK_DEVTOOLS_DIR:=$(call AltCheckSpaces,JDK_DEVTOOLS_DIR)
       
   387 
       
   388 # COMPILER_PATH: path to where the compiler and tools are installed.
       
   389 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
   390 ifdef ALT_COMPILER_PATH
       
   391   xALT_COMPILER_PATH  :="$(subst \,/,$(ALT_COMPILER_PATH))"
       
   392   fxALT_COMPILER_PATH :=$(call FullPath,$(xALT_COMPILER_PATH))
       
   393   COMPILER_PATH       :=$(call PrefixPath,$(fxALT_COMPILER_PATH))
       
   394 else
       
   395   COMPILER_PATH :=$(call PrefixPath,$(_compiler_bin))
       
   396 endif
       
   397 COMPILER_PATH :=$(call AltCheckSpaces,COMPILER_PATH)
       
   398 
       
   399 # MSDEVTOOLS_PATH: path to where the additional MS Compiler tools are.
       
   400 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
   401 ifdef ALT_MSDEVTOOLS_PATH
       
   402   xALT_MSDEVTOOLS_PATH  :="$(subst \,/,$(ALT_MSDEVTOOLS_PATH))"
       
   403   fxALT_MSDEVTOOLS_PATH :=$(call FullPath,$(xALT_MSDEVTOOLS_PATH))
       
   404   MSDEVTOOLS_PATH       :=$(call PrefixPath,$(fxALT_MSDEVTOOLS_PATH))
       
   405 else
       
   406   ifeq ($(ARCH_DATA_MODEL), 64)
       
   407     ifdef MSTOOLS
       
   408       xMSTOOLS  :="$(subst \,/,$(MSTOOLS))"
       
   409       _ms_tools :=$(call FullPath,$(xMSTOOLS))
       
   410     else
       
   411       ifdef Mstools
       
   412         xMSTOOLS  :="$(subst \,/,$(Mstools))"
       
   413         _ms_tools :=$(call FullPath,$(xMSTOOLS))
       
   414       else
       
   415         _ms_tools :=
       
   416       endif
       
   417     endif
       
   418     ifneq ($(_ms_tools),)
       
   419       _ms_tools_bin :=$(_ms_tools)/Bin
       
   420     else
       
   421       # Assumes compiler bin is .../Bin/win64/x86/AMD64, rc.exe is 3 levels up
       
   422       _ms_tools_bin :=$(_compiler_bin)/../../..
       
   423     endif
       
   424   else
       
   425     _ms_tools_bin :=$(_compiler_bin)
       
   426   endif
       
   427   MSDEVTOOLS_PATH :=$(call PrefixPath,$(_ms_tools_bin))
       
   428 endif
       
   429 MSDEVTOOLS_PATH:=$(call AltCheckSpaces,MSDEVTOOLS_PATH)
       
   430 
       
   431 # DEVTOOLS_PATH: for other tools required for building (such as zip, etc.)
       
   432 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
   433 ifdef ALT_DEVTOOLS_PATH
       
   434   xALT_DEVTOOLS_PATH  :="$(subst \,/,$(ALT_DEVTOOLS_PATH))"
       
   435   fxALT_DEVTOOLS_PATH :=$(call FullPath,$(xALT_DEVTOOLS_PATH))
       
   436   DEVTOOLS_PATH       :=$(call PrefixPath,$(fxALT_DEVTOOLS_PATH))
       
   437 else
       
   438   ifdef USING_CYGWIN
       
   439     DEVTOOLS_PATH :=$(UNIXCOMMAND_PATH)
       
   440   else
       
   441     xDEVTOOLS_PATH  :="$(_system_drive)/utils"
       
   442     fxDEVTOOLS_PATH :=$(call FullPath,$(xDEVTOOLS_PATH))
       
   443     DEVTOOLS_PATH  :=$(call PrefixPath,$(fxDEVTOOLS_PATH))
       
   444   endif
       
   445 endif
       
   446 DEVTOOLS_PATH:=$(call AltCheckSpaces,DEVTOOLS_PATH)
       
   447 
       
   448 # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
       
   449 # _BOOTDIR2: Second choice
       
   450 # The _BOOTDIR3 is defind optionally.
       
   451 ifndef ALT_BOOTDIR
       
   452   _BOOTDIR1  =$(_system_drive)/jdk$(PREVIOUS_JDK_VERSION)
       
   453   _BOOTDIR2  =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION)
       
   454   _BOOTDIR3  =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
       
   455 endif
       
   456 
       
   457 # Everybody needs the MSVCRNN runtime starting with VS2010
       
   458 _NEEDS_MSVCRNN = true
       
   459 
       
   460 ifeq ($(_NEEDS_MSVCRNN), true)
       
   461   # MSVCRNN_DLL_PATH: location of msvcrnn.dll that will be re-distributed
       
   462   ifdef ALT_MSVCRNN_DLL_PATH
       
   463     xALT_MSVCRNN_DLL_PATH :="$(subst \,/,$(ALT_MSVCRNN_DLL_PATH))"
       
   464     MSVCRNN_DLL_PATH      :=$(call FullPath,$(xALT_MSVCRNN_DLL_PATH))
       
   465   else
       
   466     MSVCRNN_DLL_PATH :=$(_redist_sdk)
       
   467   endif
       
   468   MSVCRNN_DLL_PATH :=$(call AltCheckSpaces,MSVCRNN_DLL_PATH)
       
   469 endif
       
   470 
       
   471 # DXSDK_PATH: path to Microsoft DirectX SDK Include and Lib
       
   472 ifdef ALT_DXSDK_PATH
       
   473   xALT_DXSDK_PATH :="$(subst \,/,$(ALT_DXSDK_PATH))"
       
   474   DXSDK_PATH      :=$(call FullPath,$(xALT_DXSDK_PATH))
       
   475 else
       
   476   _DXSDK_PATH1 :=$(_dx_sdk_dir)
       
   477   _DXSDK_PATH2 :=$(JDK_DEVTOOLS_DIR)/windows/dxsdk
       
   478   DXSDK_PATH  :=$(call DirExists,$(_DXSDK_PATH1),$(_DXSDK_PATH2),$(_dx_sdk_dir))
       
   479 endif
       
   480 DXSDK_PATH :=$(call AltCheckSpaces,DXSDK_PATH)
       
   481 
       
   482 # DXSDK_INCLUDE_PATH: path to Microsoft DirectX SDK Include
       
   483 ifdef ALT_DXSDK_INCLUDE_PATH
       
   484   xALT_DXSDK_INCLUDE_PATH :="$(subst \,/,$(ALT_DXSDK_INCLUDE_PATH))"
       
   485   DXSDK_INCLUDE_PATH      :=$(call FullPath,$(xALT_DXSDK_INCLUDE_PATH))
       
   486 else
       
   487   DXSDK_INCLUDE_PATH =$(subst //,/,$(DXSDK_PATH)/Include)
       
   488 endif
       
   489 
       
   490 # DXSDK_LIB_PATH: path to Microsoft DirectX SDK Lib
       
   491 ifdef ALT_DXSDK_LIB_PATH
       
   492   xALT_DXSDK_LIB_PATH :="$(subst \,/,$(ALT_DXSDK_LIB_PATH))"
       
   493   DXSDK_LIB_PATH      :=$(call FullPath,$(xALT_DXSDK_LIB_PATH))
       
   494 else
       
   495   ifeq ($(ARCH_DATA_MODEL), 64)
       
   496     # 64bit libs are located in "Lib/x64" subdir
       
   497     DXSDK_LIB_PATH =$(subst //,/,$(DXSDK_PATH)/Lib/x64)
       
   498   else
       
   499     DXSDK_LIB_PATH =$(subst //,/,$(DXSDK_PATH)/Lib)
       
   500   endif
       
   501 endif
       
   502 
       
   503 # DEPLOY_MSSDK: Microsoft SDK for this platform (for deploy)
       
   504 ifdef ALT_DEPLOY_MSSDK
       
   505   xALT_DEPLOY_MSSDK :="$(subst \,/,$(ALT_DEPLOY_MSSDK))"
       
   506   DEPLOY_MSSDK      :=$(call FullPath,$(xALT_DEPLOY_MSSDK))
       
   507 else
       
   508   DEPLOY_MSSDK      :=$(_ms_sdk)
       
   509 endif
       
   510 DEPLOY_MSSDK:=$(call AltCheckSpaces,DEPLOY_MSSDK)
       
   511 
       
   512 # INSTALL_MSSDK: Microsoft Installer SDK for this platform (for install)
       
   513 ifdef ALT_INSTALL_MSSDK
       
   514   xALT_INSTALL_MSSDK :="$(subst \,/,$(ALT_INSTALL_MSSDK))"
       
   515   INSTALL_MSSDK      :=$(call FullPath,$(xALT_INSTALL_MSSDK))
       
   516 else
       
   517   INSTALL_MSSDK      :=$(_ms_sdk)
       
   518 endif
       
   519 INSTALL_MSSDK:=$(call AltCheckSpaces,INSTALL_MSSDK)
       
   520 
       
   521 # WSCRIPT: path to wscript.exe (used in creating install bundles)
       
   522 ifdef ALT_WSCRIPT
       
   523   xALT_WSCRIPT :="$(subst \,/,$(ALT_WSCRIPT))"
       
   524   WSCRIPT  =$(xALT_WSCRIPT)
       
   525 else
       
   526   _WSCRIPT1 :=$(_system_root)/system32/wscript.exe
       
   527   _WSCRIPT2 :=$(DEVTOOLS_PATH)wscript.exe
       
   528   WSCRIPT  :=$(call FileExists,$(_WSCRIPT1),$(_WSCRIPT2))
       
   529 endif
       
   530 WSCRIPT:=$(call AltCheckSpaces,WSCRIPT)
       
   531 # batch mode no modal dialogs on errors, please.
       
   532 WSCRIPT += -B
       
   533 
       
   534 # CSCRIPT: path to cscript.exe (used in creating install bundles)
       
   535 ifdef ALT_CSCRIPT
       
   536   xALT_CSCRIPT :="$(subst \,/,$(ALT_CSCRIPT))"
       
   537   CSCRIPT  =$(xALT_CSCRIPT)
       
   538 else
       
   539   _CSCRIPT1 :=$(_system_root)/system32/cscript.exe
       
   540   _CSCRIPT2 :=$(DEVTOOLS_PATH)cscript.exe
       
   541   CSCRIPT  :=$(call FileExists,$(_CSCRIPT1),$(_CSCRIPT2))
       
   542 endif
       
   543 CSCRIPT:=$(call AltCheckSpaces,CSCRIPT)
       
   544 
       
   545 # CABARC: path to cabarc.exe (used in creating install bundles)
       
   546 ifdef ALT_CABARC
       
   547   xALT_CABARC :="$(subst \,/,$(ALT_CABARC))"
       
   548   CABARC  =$(xALT_CABARC)
       
   549 else
       
   550   _CABARC1 :=$(_system_root)/system32/cabarc.exe
       
   551   _CABARC2 :=$(DEVTOOLS_PATH)cabarc.exe
       
   552   CABARC  :=$(call FileExists,$(_CABARC1),$(_CABARC2))
       
   553 endif
       
   554 CABARC:=$(call AltCheckSpaces,CABARC)
       
   555 
       
   556 # MSICERT: path to msicert.exe (used in creating install bundles)
       
   557 ifdef ALT_MSICERT
       
   558   xALT_MSICERT :="$(subst \,/,$(ALT_MSICERT))"
       
   559   MSICERT  =$(xALT_MSICERT)
       
   560 else
       
   561   _MSICERT1 :=$(INSTALL_MSSDK)/Bin/msicert.exe
       
   562   _MSICERT2 :=$(DEVTOOLS_PATH)msicert.exe
       
   563   MSICERT   :=$(call FileExists,$(_MSICERT1),$(_MSICERT2))
       
   564 endif
       
   565 MSICERT:=$(call AltCheckSpaces,MSICERT)
       
   566 
       
   567 # Import JDK images allow for partial builds, components not built are
       
   568 #    imported (or copied from) these import areas when needed.
       
   569 
       
   570 # BUILD_JDK_IMPORT_PATH: location of JDK install trees to import for
       
   571 #   multiple platforms, e.g. windows-i586, solaris-sparc, linux-586, etc.
       
   572 ifdef ALT_BUILD_JDK_IMPORT_PATH
       
   573   BUILD_JDK_IMPORT_PATH  :=$(call FullPath,$(ALT_BUILD_JDK_IMPORT_PATH))
       
   574 else
       
   575   BUILD_JDK_IMPORT_PATH   = $(PROMOTED_BUILD_BINARIES)
       
   576 endif
       
   577 BUILD_JDK_IMPORT_PATH:=$(call AltCheckSpaces,BUILD_JDK_IMPORT_PATH)
       
   578 
       
   579 # JDK_IMPORT_PATH: location of previously built JDK (this version) to import
       
   580 ifdef ALT_JDK_IMPORT_PATH
       
   581   JDK_IMPORT_PATH  :=$(call FullPath,$(ALT_JDK_IMPORT_PATH))
       
   582 else
       
   583   JDK_IMPORT_PATH   = $(BUILD_JDK_IMPORT_PATH)/$(PLATFORM)-$(ARCH)$(_JDK_IMPORT_VARIANT)
       
   584 endif
       
   585 JDK_IMPORT_PATH:=$(call AltCheckSpaces,JDK_IMPORT_PATH)
       
   586 
       
   587 # HOTSPOT_CLIENT_PATH: location of client jvm library file.
       
   588 ifeq ($(ARCH_DATA_MODEL), 32)
       
   589   ifdef ALT_HOTSPOT_CLIENT_PATH
       
   590     HOTSPOT_CLIENT_PATH :=$(call FullPath,$(ALT_HOTSPOT_CLIENT_PATH))
       
   591   else
       
   592     HOTSPOT_CLIENT_PATH   =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/client
       
   593   endif
       
   594   HOTSPOT_CLIENT_PATH:=$(call AltCheckSpaces,HOTSPOT_CLIENT_PATH)
       
   595 endif
       
   596 
       
   597 # HOTSPOT_SERVER_PATH: location of server jvm library file.
       
   598 ifdef ALT_HOTSPOT_SERVER_PATH
       
   599   HOTSPOT_SERVER_PATH :=$(call FullPath,$(ALT_HOTSPOT_SERVER_PATH))
       
   600 else
       
   601   HOTSPOT_SERVER_PATH   =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/server
       
   602 endif
       
   603 HOTSPOT_SERVER_PATH:=$(call AltCheckSpaces,HOTSPOT_SERVER_PATH)
       
   604 
       
   605 # HOTSPOT_LIB_PATH: location of jvm.lib file.
       
   606 ifdef ALT_HOTSPOT_LIB_PATH
       
   607   xALT_HOTSPOT_LIB_PATH :="$(subst \,/,$(ALT_HOTSPOT_LIB_PATH))"
       
   608   HOTSPOT_LIB_PATH      :=$(call FullPath,$(xALT_HOTSPOT_LIB_PATH))
       
   609 else
       
   610   HOTSPOT_LIB_PATH  =$(HOTSPOT_IMPORT_PATH)/lib
       
   611 endif
       
   612 HOTSPOT_LIB_PATH:=$(call AltCheckSpaces,HOTSPOT_LIB_PATH)
       
   613 
       
   614 # Special define for checking the binaries
       
   615 
       
   616 # All windows dll and exe files should have been built with /NXCOMPAT
       
   617 #   and be setup for dynamic base addresses.
       
   618 #   In addition, we should not be dependent on certain dll files that
       
   619 #   we do not or cannot redistribute.
       
   620 
       
   621 # List of filenames we should NOT be dependent on
       
   622 ifeq ($(MFC_DEBUG),true)
       
   623   BANNED_DLLS=msvcp100[.]dll
       
   624 else
       
   625   BANNED_DLLS=msvcp100[.]dll|msvcr100d[.]dll|msvcrtd[.]dll
       
   626 endif
       
   627 
       
   628 # Check for /safeseh (only used on 32bit)
       
   629 define binary_file_safeseh_verification # binary_file
       
   630 ( \
       
   631   $(ECHO) "Checking for /SAFESEH usage in: $1" && \
       
   632   if [ "`$(DUMPBIN) /loadconfig $1 | $(EGREP) -i 'Safe Exception Handler Table'`" = "" ] ; then \
       
   633     $(ECHO) "ERROR: Did not find 'Safe Exception Handler Table' in loadconfig: $1" ; \
       
   634     $(DUMPBIN) /loadconfig $1 ; \
       
   635     exit 6 ; \
       
   636   fi ; \
       
   637 )
       
   638 endef
       
   639 
       
   640 # Check for /NXCOMPAT usage
       
   641 define binary_file_nxcompat_verification # binary_file
       
   642 ( \
       
   643   $(ECHO) "Checking for /NXCOMPAT usage in: $1" && \
       
   644   if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'NX compatible'`" = "" ] ; then \
       
   645     $(ECHO) "ERROR: Did not find 'NX compatible' in headers: $1" ; \
       
   646     $(DUMPBIN) /headers $1 ; \
       
   647     exit 7 ; \
       
   648   fi ; \
       
   649 )
       
   650 endef
       
   651 
       
   652 # Check for /DYNAMICBASE usage
       
   653 define binary_file_dynamicbase_verification # binary_file
       
   654 ( \
       
   655   $(ECHO) "Checking for /DYNAMICBASE usage in: $1" && \
       
   656   if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'Dynamic base'`" = "" ] ; then \
       
   657     $(ECHO) "ERROR: Did not find 'Dynamic base' in headers: $1" ; \
       
   658     $(DUMPBIN) /headers $1 ; \
       
   659     exit 8 ; \
       
   660   fi ; \
       
   661 )
       
   662 endef
       
   663 
       
   664 # Check for banned dll usage
       
   665 define binary_file_dll_verification # binary_file
       
   666 ( \
       
   667   $(ECHO) "Checking for banned dependencies in: $1" && \
       
   668   if [ "`$(DUMPBIN) /dependents $1 | $(EGREP) -i '$(BANNED_DLLS)'`" != "" ] ; then \
       
   669     $(ECHO) "ERROR: Found use of $(BANNED_DLLS)"; \
       
   670     $(DUMPBIN) /dependents $1 ; \
       
   671     exit 9 ; \
       
   672   fi ; \
       
   673 )
       
   674 endef
       
   675 
       
   676 # Macro to check it's input file for properly built executables.
       
   677 #   Relies on process exit code. Different for 32bit vs 64bit.
       
   678 ifeq ($(ARCH_DATA_MODEL),32)
       
   679 define binary_file_verification # binary_file
       
   680 ( \
       
   681   $(call binary_file_safeseh_verification,$1); \
       
   682   $(call binary_file_nxcompat_verification,$1); \
       
   683   $(call binary_file_dynamicbase_verification,$1); \
       
   684   $(call binary_file_dll_verification,$1); \
       
   685 )
       
   686 endef
       
   687 else
       
   688 define binary_file_verification # binary_file
       
   689 ( \
       
   690   $(call binary_file_nxcompat_verification,$1); \
       
   691   $(call binary_file_dynamicbase_verification,$1); \
       
   692   $(call binary_file_dll_verification,$1); \
       
   693 )
       
   694 endef
       
   695 endif
       
   696