jdk/make/common/shared/Defs-windows.gmk
changeset 7665 bc5dbdc44e1e
parent 6309 d3955f70aad3
child 7669 3ebe17bda998
equal deleted inserted replaced
7483:280294134c62 7665:bc5dbdc44e1e
     1 #
     1 #
     2 # Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
     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.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     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
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     7 # published by the Free Software Foundation.  Oracle designates this
    78 #     MSVCDIR, MSVCDir.
    78 #     MSVCDIR, MSVCDir.
    79 #     So use $(subst \,/,) on them first adding quotes and placing them in
    79 #     So use $(subst \,/,) on them first adding quotes and placing them in
    80 #         their own variable assigned with :=, then use FullPath.
    80 #         their own variable assigned with :=, then use FullPath.
    81 #
    81 #
    82 
    82 
       
    83 ifdef USING_CYGWIN
       
    84 # All possible drive letters
       
    85 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
       
    86 # Convert /cygdrive/ paths to the mixed style without an exec of cygpath
       
    87 #   Must be a path with no spaces.
       
    88 define MixedPath
       
    89 $(patsubst /%,c:/cygwin/%,$(sort $(filter-out /cygdrive/%,$(foreach drive,$(drives),$(patsubst /cygdrive/$(drive)/%,$(drive):/%,$1)))))
       
    90 endef
    83 # Use FullPath to get C:/ style non-spaces path. Never ends with a /!
    91 # Use FullPath to get C:/ style non-spaces path. Never ends with a /!
    84 ifdef USING_CYGWIN
       
    85 # We assume cygpath is available in the search path
    92 # We assume cygpath is available in the search path
    86 #    NOTE: Use of 'pwd' with CYGWIN will not get you a mixed style path!
    93 #    NOTE: Use of 'pwd' with CYGWIN will not get you a mixed style path!
    87 CYGPATH_CMD=cygpath -a -s -m
    94 CYGPATH_CMD=cygpath -a -s -m
    88 define FullPath
    95 define FullPath
    89 $(shell $(CYGPATH_CMD) $1 2> $(DEV_NULL))
    96 $(if $(word 2,$1),$(shell $(CYGPATH_CMD) $1 2> $(DEV_NULL)),$(call MixedPath,$(realpath $(subst ",,$1))))
    90 endef
    97 endef
    91 define OptFullPath
    98 define OptFullPath
    92 $(shell if [ "$1" != "" -a -d "$1" ]; then $(CYGPATH_CMD) "$1" 2> $(DEV_NULL); else echo "$1"; fi)
    99 $(shell if [ "$1" != "" -a -d "$1" ]; then $(CYGPATH_CMD) "$1" 2> $(DEV_NULL); else echo "$1"; fi)
    93 endef
   100 endef
    94 else
   101 else
   226     xDXSDK_DIR  :="$(_system_drive)/DXSDK"
   233     xDXSDK_DIR  :="$(_system_drive)/DXSDK"
   227   endif
   234   endif
   228   _dx_sdk_dir :=$(call FullPath,$(xDXSDK_DIR))
   235   _dx_sdk_dir :=$(call FullPath,$(xDXSDK_DIR))
   229 endif
   236 endif
   230 
   237 
   231 # Compilers, SDK, and Visual Studio (MSDEV) [32bit is different from 64bit]
   238 # Use of the Visual Studio compilers requires certain env variables be set:
   232 ifeq ($(ARCH_DATA_MODEL), 32)
   239 #   PATH should include the path to cl.exe
   233   # Try looking in MSVCDIR or MSVCDir area first 
   240 #   INCLUDE should be defined
   234   # (set by vcvars32.bat for VC .NET, not defined in the VC 2008/2010)
   241 #   LIB     should be defined
   235   ifdef MSVCDIR
   242 #   LIBPATH should be defined
   236     xMSVCDIR  :="$(subst \,/,$(MSVCDIR))"
   243 #   VS100COMNTOOLS should be defined
   237     _msvc_dir :=$(call FullPath,$(xMSVCDIR))
   244 #   WINDOWSSDKDIR should be defined
   238   else
   245 #     The 7.0a path is from VS2010 Pro, the 7.1 path is the standalone SDK.
   239     ifdef MSVCDir
   246 #     For 64bit either will work for us.
   240       xMSVCDIR  :="$(subst \,/,$(MSVCDir))"
   247 #     If a developer chooses to install the standalone SDK in some other
       
   248 #     location, then they need to set WINDOWSSDKDIR.
       
   249 #
       
   250 # Compilers for 64bit may be from the free SDK, or Visual Studio Professional.
       
   251 #   The free Express compilers don't contain 64 bit compilers, which is why
       
   252 #   you instead need the SDK.
       
   253 #   Release enginering will use VS2010 Pro, so the frequency of testing of
       
   254 #     SDK based builds will depend entirely on individual usage.
       
   255 
       
   256 # We only need to do this once
       
   257 ifndef VS2010_EXISTS
       
   258   # The 2 key paths we need are WINDOWSSDKDIR and VS100COMNTOOLS.
       
   259   #   If not defined try to see if default location exists.
       
   260   #   If defined make sure that the path has no spaces.
       
   261   #   Finally, export path with no spaces so logic minimizes FullPath calls.
       
   262   ifndef WINDOWSSDKDIR
       
   263     # The 7.0a SDK is the second choice.
       
   264     xWINDOWSSDKDIR :="$(_program_files32)/Microsoft SDKs/Windows/v7.0a/"
       
   265     fWINDOWSSDKDIR :=$(call FullPath,$(xWINDOWSSDKDIR))
       
   266     # The 7.1 SDK is the second choice.
       
   267     ifeq ($(fWINDOWSSDKDIR),)
       
   268       xWINDOWSSDKDIR :="$(_program_files32)/Microsoft SDKs/Windows/v7.1/"
       
   269       fWINDOWSSDKDIR :=$(call FullPath,$(xWINDOWSSDKDIR))
       
   270     endif
       
   271   else
       
   272     ifneq ($(word 2,$(WINDOWSSDKDIR)),)
       
   273       xWINDOWSSDKDIR :="$(subst \,/,$(WINDOWSSDKDIR))"
       
   274       fWINDOWSSDKDIR :=$(call FullPath,$(xWINDOWSSDKDIR))
       
   275     else
       
   276       fWINDOWSSDKDIR :=$(WINDOWSSDKDIR)
       
   277     endif
       
   278   endif
       
   279   ifneq ($(fWINDOWSSDKDIR),)
       
   280     WINDOWSSDKDIR  :=$(fWINDOWSSDKDIR)/
       
   281   endif
       
   282   ifndef VS100COMNTOOLS
       
   283     xVS100COMNTOOLS :="$(_program_files32)/Microsoft Visual Studio 10.0/Common7/Tools/"
       
   284     fVS100COMNTOOLS :=$(call FullPath,$(xVS100COMNTOOLS))
       
   285   else
       
   286     ifneq ($(word 2,$(VS100COMNTOOLS)),)
       
   287       xVS100COMNTOOLS :="$(subst \,/,$(VS100COMNTOOLS))"
       
   288       fVS100COMNTOOLS :=$(call FullPath,$(xVS100COMNTOOLS))
       
   289     else
       
   290       fVS100COMNTOOLS :=$(xVS100COMNTOOLS)
       
   291     endif
       
   292   endif
       
   293   ifneq ($(fVS100COMNTOOLS),)
       
   294     VS100COMNTOOLS :=$(fVS100COMNTOOLS)/
       
   295   endif
       
   296   # Check to see that both exist
       
   297   ifeq ($(WINDOWSSDKDIR),)
       
   298     _vs2010_message := No WINDOWSSDKDIR found on system. $(_vs2010_message)
       
   299     VS2010_EXISTS   := false
       
   300   endif
       
   301   ifeq ($(VS100COMNTOOLS),)
       
   302     _vs2010_message := No VS100COMNTOOLS found on system. $(_vs2010_message)
       
   303     VS2010_EXISTS   := false
       
   304   endif
       
   305   ifeq ($(VS2010_EXISTS),false)
       
   306     x:=$(warning WARNING: No VS2010 available. $(_vs2010_message))
       
   307     VS100COMNTOOLS :=
       
   308     WINDOWSSDKDIR  :=
       
   309   else
       
   310     VS2010_EXISTS := true
       
   311     _msvc_dir     :=$(VS100COMNTOOLS)/../../Vc
       
   312   endif
       
   313   export VS2010_EXISTS
       
   314   export VS100COMNTOOLS
       
   315   export WINDOWSSDKDIR
       
   316 endif
       
   317 
       
   318 # Setup for VS2010 is simple, others logic is historic
       
   319 ifeq ($(VS2010_EXISTS),true)
       
   320   
       
   321   # VS2010 Compiler root directory
       
   322   _msvc_dir :=$(VS100COMNTOOLS)/../../Vc
       
   323   # SDK root directory
       
   324   _ms_sdk   :=$(WINDOWSSDKDIR)
       
   325   # Compiler bin directory and redist directory
       
   326   ifeq ($(ARCH_DATA_MODEL), 32)
       
   327     _compiler_bin :=$(_msvc_dir)/Bin
       
   328     _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC100.CRT)
       
   329   endif
       
   330   ifeq ($(ARCH_DATA_MODEL), 64)
       
   331     _compiler_bin :=$(_msvc_dir)/bin/amd64
       
   332     _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x64/Microsoft.VC100.CRT)
       
   333   endif
       
   334   ifeq ($(_redist_sdk),)
       
   335     _redist_sdk   :=$(_system_root)/system32
       
   336   endif
       
   337 
       
   338 else # Not VS2010
       
   339 
       
   340   # Compilers, SDK, and Visual Studio (MSDEV) [32bit is different from 64bit]
       
   341   ifeq ($(ARCH_DATA_MODEL), 32)
       
   342 
       
   343     # Try looking in MSVCDIR or MSVCDir area first 
       
   344     # (set by vcvars32.bat for VC .NET, not defined in the VC 2008/2010)
       
   345     ifdef MSVCDIR
       
   346       xMSVCDIR  :="$(subst \,/,$(MSVCDIR))"
   241       _msvc_dir :=$(call FullPath,$(xMSVCDIR))
   347       _msvc_dir :=$(call FullPath,$(xMSVCDIR))
   242     endif
   348     else
   243   endif
   349       ifdef MSVCDir
   244   # If we still don't have it, look for VSnnCOMNTOOLS (newest first),
   350         xMSVCDIR  :="$(subst \,/,$(MSVCDir))"
   245   # set by installer?
   351         _msvc_dir :=$(call FullPath,$(xMSVCDIR))
   246   ifeq ($(_msvc_dir),)
   352       endif
   247     ifdef VS100COMNTOOLS  # /Common/Tools directory, use ../../Vc
   353     endif
   248       xVS100COMNTOOLS :="$(subst \,/,$(VS100COMNTOOLS))"
   354     # If we still don't have it, look for VSnnCOMNTOOLS (newest first),
   249       _vs100tools     :=$(call FullPath,$(xVS100COMNTOOLS))
   355     # set by installer?
   250     endif
   356     ifeq ($(_msvc_dir),)
   251     ifneq ($(_vs100tools),)
       
   252       _msvc_dir   :=$(_vs100tools)/../../Vc
       
   253     else
       
   254       ifdef VS90COMNTOOLS  # /Common/Tools directory, use ../../Vc
   357       ifdef VS90COMNTOOLS  # /Common/Tools directory, use ../../Vc
   255         xVS90COMNTOOLS :="$(subst \,/,$(VS90COMNTOOLS))"
   358         xVS90COMNTOOLS :="$(subst \,/,$(VS90COMNTOOLS))"
   256         _vs90tools     :=$(call FullPath,$(xVS90COMNTOOLS))
   359         _vs90tools     :=$(call FullPath,$(xVS90COMNTOOLS))
   257       endif
   360       endif
   258       ifneq ($(_vs90tools),)
   361       ifneq ($(_vs90tools),)
   273             _msvc_dir   :=$(_vs71tools)/../../Vc7
   376             _msvc_dir   :=$(_vs71tools)/../../Vc7
   274           endif
   377           endif
   275         endif
   378         endif
   276       endif
   379       endif
   277     endif
   380     endif
   278   endif
   381   
   279   ifneq ($(_msvc_dir),)
   382     ifneq ($(_msvc_dir),)
   280     _compiler_bin :=$(_msvc_dir)/Bin
   383       _compiler_bin :=$(_msvc_dir)/Bin
   281     # Assume PlatformSDK is in VS71 (will be empty if VS90)
   384       # Assume PlatformSDK is in VS71 (will be empty if VS90)
   282     _ms_sdk       :=$(call FullPath,$(_msvc_dir)/PlatformSDK)
   385       _ms_sdk       :=$(call FullPath,$(_msvc_dir)/PlatformSDK)
   283     # Assume VS100, then VS90, then VS80, then VS71
   386       _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC90.CRT)
   284     _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC100.CRT)
   387       ifeq ($(_redist_sdk),)
   285     ifeq ($(_redist_sdk),)
   388         _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC80.CRT)
   286       ifneq ($(VS100COMNTOOLS),)
       
   287         _redist_sdk  :=c:/windows/system32
       
   288       else
       
   289         _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC90.CRT)
       
   290         ifeq ($(_redist_sdk),)
   389         ifeq ($(_redist_sdk),)
   291           _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC80.CRT)
   390           _redist_sdk   :=$(call FullPath,$(_msvc_dir)/../SDK/v1.1/Bin)
   292           ifeq ($(_redist_sdk),)
       
   293             _redist_sdk   :=$(call FullPath,$(_msvc_dir)/../SDK/v1.1/Bin)
       
   294           endif
       
   295         endif
   391         endif
   296       endif
   392       endif
   297     endif
   393     endif
   298   endif
   394   endif
   299 endif
   395 
   300 
   396   # The Microsoft Platform SDK installed by itself
   301 # The Microsoft Platform SDK installed by itself
   397   ifneq ($(_program_files),)
   302 ifneq ($(_program_files),)
   398     _PSDK :="$(_program_files)/Microsoft SDKs/Windows/v6.1/"
   303   _PSDK :="$(_program_files)/Microsoft SDKs/Windows/v6.1/"
   399     _psdk :=$(call FullPath,$(xMSSDK61))
   304   _psdk :=$(call FullPath,$(xMSSDK61))
       
   305   ifeq ($(_psdk),)
       
   306     xPSDK  :="$(_program_files)/Microsoft Platform SDK"
       
   307     _psdk  :=$(call FullPath,$(xPSDK))
       
   308     ifeq ($(_psdk),)
   400     ifeq ($(_psdk),)
   309       xPSDK  :="$(_program_files)/Microsoft SDK"
   401       xPSDK  :="$(_program_files)/Microsoft Platform SDK"
   310       _psdk :=$(call FullPath,$(xMSSDK))
   402       _psdk  :=$(call FullPath,$(xPSDK))
   311     endif
   403       ifeq ($(_psdk),)
   312   endif
   404         xPSDK  :="$(_program_files)/Microsoft SDK"
   313 endif
   405         _psdk :=$(call FullPath,$(xMSSDK))
   314 
   406       endif
   315 # If no SDK found yet, look in other places
   407     endif
   316 ifeq ($(_ms_sdk),)
   408   endif
   317   ifdef MSSDK
   409 
       
   410   # If no SDK found yet, look in other places
       
   411   ifeq ($(_ms_sdk),)
       
   412     ifdef MSSDK
   318     xMSSDK  :="$(subst \,/,$(MSSDK))"
   413     xMSSDK  :="$(subst \,/,$(MSSDK))"
   319     _ms_sdk :=$(call FullPath,$(xMSSDK))
   414     _ms_sdk :=$(call FullPath,$(xMSSDK))
   320   else
   415   else
   321     ifdef MSSdk
   416     ifdef MSSdk
   322       xMSSDK  :="$(subst \,/,$(MSSdk))"
   417       xMSSDK  :="$(subst \,/,$(MSSdk))"
   323       _ms_sdk :=$(call FullPath,$(xMSSDK))
   418       _ms_sdk :=$(call FullPath,$(xMSSDK))
   324     else
   419     else
   325       _ms_sdk :=$(_psdk)
   420         _ms_sdk :=$(_psdk)
   326     endif
   421       endif
   327   endif
   422     endif
   328 endif
   423   endif
   329 
   424   
   330 # Compilers for 64bit may be from the free SDK, or Visual Studio Professional
   425   # Compilers for 64bit may be from the free SDK, or Visual Studio Professional.
   331 # The free Express compilers don't contain 64 bit compilers, which is why
   426   ifeq ($(ARCH_DATA_MODEL), 64)
   332 # you instead need the SDK.
       
   333 # So for VS2010 based builds, either VS2010 Pro with the 7.0a SDK, or
       
   334 # the Windows 7.1 standalone SDK with compilers may be used.
       
   335 # Release enginering will use VS2010 Pro, so the frequency of testing of
       
   336 # SDK based builds will depend entirely on individual usage.
       
   337 ifeq ($(ARCH_DATA_MODEL), 64)
       
   338   ifdef VS100COMNTOOLS  # /Common7/Tools directory, use ../../Vc
       
   339     # VS2010 default location is used when building 64 bit using the 7.1 SDK
       
   340     # This is safe to hardwire as the SDK installer won't let you change it
       
   341     # and the VS2010 variable is only used if the compilers are from the SDK
       
   342     xVS2010 :="$(_program_files32)/Microsoft Visual Studio 10.0/"
       
   343     VS2010 :=$(call FullPath,$(xVS2010))
       
   344     xVS100COMNTOOLS :="$(subst \,/,$(VS100COMNTOOLS))"
       
   345     _vs100tools     :=$(call FullPath,$(xVS100COMNTOOLS))
       
   346   endif
       
   347   ifneq ($(_vs100tools),)
       
   348     _compiler_bin :=$(_vs100tools)/../../Vc/bin/amd64
       
   349     x_redist_sdk   :=$(_vs100tools)/../../Vc/redist/x64/Microsoft.VC100.CRT
       
   350     _redist_sdk    :=$(call FullPath,$(x_redist_sdk))
       
   351     # The SDK doesn't have the redist directory, but the DLL is installed
       
   352     # into the windows directory.
       
   353     ifeq ($(_redist_sdk),)
       
   354       _redist_sdk   :=c:/windows/system32
       
   355     endif
       
   356     # Not currently using MSSDK7n, but maybe we can make use of it for
       
   357     # doing default location lookup to find some SDK tools that presently
       
   358     # require the developer to explicitly set the path.
       
   359     # The 7.0a path is from VS2010 Pro, the 7.1 path is the standalone SDK.
       
   360     # Either will work for us.
       
   361     # If a developer chooses to install the standalone SDK in some other
       
   362     # location, then this will fail to find it, which won't matter so long as
       
   363     # we aren't using this variable. If we do they'd still need to set the
       
   364     # ALT_MSDEVTOOLS_PATH as now.
       
   365     # %WindowsSdkDir% could be referenced instead but the SDK installer
       
   366     # doesn't set it and in the case of the VS2010 compilers,
       
   367     # you can't change this location in the installer anyway.
       
   368     xMSSDK7n      :="$(_program_files32)/Microsoft SDKs/Windows/v7.0a/"
       
   369     MSSDK7n       :=$(call FullPath,$(xMSSDK7n))
       
   370     ifeq ($(MSSDK7n),)
       
   371       xMSSDK7n      :="$(_program_files32)/Microsoft SDKs/Windows/v7.1/"
       
   372       MSSDK7n       :=$(call FullPath,$(xMSSDK7n))
       
   373     endif
       
   374   else
       
   375     xVS2008 :="$(_program_files32)/Microsoft Visual Studio 9.0/"
   427     xVS2008 :="$(_program_files32)/Microsoft Visual Studio 9.0/"
   376     VS2008 :=$(call FullPath,$(xVS2008))
   428     VS2008 :=$(call FullPath,$(xVS2008))
   377     ifneq ($(VS2008),)
   429     ifneq ($(VS2008),)
   378       _compiler_bin :=$(VS2008)/VC/Bin/$(ARCH)
   430       _compiler_bin :=$(VS2008)/VC/Bin/$(ARCH)
   379       xMSSDK61      :="$(_program_files)/Microsoft SDKs/Windows/v6.1/"
   431       xMSSDK61      :="$(_program_files)/Microsoft SDKs/Windows/v6.1/"
   389           _redist_sdk   :=$(_ms_sdk)/redist/win64/AMD64
   441           _redist_sdk   :=$(_ms_sdk)/redist/win64/AMD64
   390         endif
   442         endif
   391       endif
   443       endif
   392     endif
   444     endif
   393   endif
   445   endif
   394 endif
   446 
       
   447 endif # VS2010_EXISTS
   395 
   448 
   396 # Location on system where jdk installs might be
   449 # Location on system where jdk installs might be
   397 ifneq ($(_program_files),)
   450 ifneq ($(_program_files),)
   398   USRJDKINSTANCES_PATH =$(_program_files)/Java
   451   USRJDKINSTANCES_PATH =$(_program_files)/Java
   399 else
   452 else
   507 
   560 
   508 # 32bit always needs the MSVCRNN runtime, 64bit does when using VS2008
   561 # 32bit always needs the MSVCRNN runtime, 64bit does when using VS2008
   509 ifeq ($(ARCH_DATA_MODEL), 32)
   562 ifeq ($(ARCH_DATA_MODEL), 32)
   510   _NEEDS_MSVCRNN = true
   563   _NEEDS_MSVCRNN = true
   511 else
   564 else
   512   ifneq ($(VS2010),)
   565   ifeq ($(VS2010_EXISTS),true)
   513     _NEEDS_MSVCRNN = true
   566     _NEEDS_MSVCRNN = true
   514   else 
   567   else 
   515     ifneq ($(VS2008),)
   568     ifneq ($(VS2008),)
   516       _NEEDS_MSVCRNN = true
   569       _NEEDS_MSVCRNN = true
   517     else
   570     else