jdk/make/common/shared/Compiler-msvc.gmk
changeset 7665 bc5dbdc44e1e
parent 5506 202f599c92aa
child 8008 753c38f4af83
equal deleted inserted replaced
7483:280294134c62 7665:bc5dbdc44e1e
     1 #
     1 #
     2 # Copyright (c) 2005, 2008, 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
    32   CPP          = $(COMPILER_PATH)cl
    32   CPP          = $(COMPILER_PATH)cl
    33   CXX          = $(COMPILER_PATH)cl
    33   CXX          = $(COMPILER_PATH)cl
    34   CCC          = $(COMPILER_PATH)cl
    34   CCC          = $(COMPILER_PATH)cl
    35   LIBEXE       = $(COMPILER_PATH)lib
    35   LIBEXE       = $(COMPILER_PATH)lib
    36   LINK         = $(COMPILER_PATH)link
    36   LINK         = $(COMPILER_PATH)link
    37   RC           = $(MSDEVTOOLS_PATH)rc
       
    38   RSC          = $(MSDEVTOOLS_PATH)rc
       
    39   LINK32       = $(LINK)
    37   LINK32       = $(LINK)
    40  
    38  
    41   # Fill in unknown values
    39   # Fill in unknown values
    42   COMPILER_NAME=Unknown MSVC Compiler
    40   COMPILER_NAME=Unknown MSVC Compiler
    43   COMPILER_VERSION=
    41   COMPILER_VERSION=
    45   # unset any GNU Make settings of MFLAGS and MAKEFLAGS which may mess up nmake
    43   # unset any GNU Make settings of MFLAGS and MAKEFLAGS which may mess up nmake
    46   NMAKE          = MFLAGS= MAKEFLAGS= $(COMPILER_PATH)nmake -nologo
    44   NMAKE          = MFLAGS= MAKEFLAGS= $(COMPILER_PATH)nmake -nologo
    47 
    45 
    48   # Compiler version and type (Always get word after "Version")
    46   # Compiler version and type (Always get word after "Version")
    49   CC_VER  := $(shell $(CC) 2>&1 | $(HEAD) -n 1 | $(SED) 's/.*\(Version.*\)/\1/' | $(NAWK) '{print $$2}')
    47   CC_VER  := $(shell $(CC) 2>&1 | $(HEAD) -n 1 | $(SED) 's/.*\(Version.*\)/\1/' | $(NAWK) '{print $$2}')
    50   
    48 
       
    49   # The MSDEVTOOLS_PATH is for older compilers, place for rc, mt, etc.
       
    50   _OTHER_TOOLS_PATH = $(MSDEVTOOLS_PATH)
       
    51 
    51   # SDK-64 and MSVC6 put REBASE.EXE in a different places - go figure...
    52   # SDK-64 and MSVC6 put REBASE.EXE in a different places - go figure...
    52   ifeq ($(ARCH_DATA_MODEL), 32)
    53   ifeq ($(ARCH_DATA_MODEL), 32)
    53     LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
    54     LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
    54     CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
    55     CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
    55     ifeq ($(CC_MAJORVER), 13)
    56     ifeq ($(CC_MAJORVER), 13)
    56       # This should be: CC_VER=13.10.3077 LINK_VER=7.10.3077
    57       # This should be: CC_VER=13.10.3077 LINK_VER=7.10.3077
    57       COMPILER_NAME=Visual Studio .NET 2003 Professional C++
    58       COMPILER_NAME=Visual Studio .NET 2003 Professional C++
    58       COMPILER_VERSION=VS2003
    59       COMPILER_VERSION=VS2003
       
    60       RC         = $(_OTHER_TOOLS_PATH)rc
    59       REBASE     = $(COMPILER_PATH)../../Common7/Tools/Bin/rebase
    61       REBASE     = $(COMPILER_PATH)../../Common7/Tools/Bin/rebase
    60       MTL        = $(COMPILER_PATH)../../Common7/Tools/Bin/midl
    62       MTL        = $(COMPILER_PATH)../../Common7/Tools/Bin/midl
    61       ifndef COMPILER_PATH
       
    62 	COMPILER_PATH := $(error COMPILER_PATH cannot be empty here)
       
    63       endif
       
    64     endif
    63     endif
    65     ifeq ($(CC_MAJORVER), 14)
    64     ifeq ($(CC_MAJORVER), 14)
    66       COMPILER_NAME=Visual Studio 8
    65       COMPILER_NAME=Visual Studio 8
    67       COMPILER_VERSION=VS2005
    66       COMPILER_VERSION=VS2005
       
    67       RC         = $(_OTHER_TOOLS_PATH)rc
    68       REBASE     = $(COMPILER_PATH)../../Common8/Tools/Bin/rebase
    68       REBASE     = $(COMPILER_PATH)../../Common8/Tools/Bin/rebase
    69       MTL        = $(COMPILER_PATH)../../Common8/Tools/Bin/midl
    69       MTL        = $(COMPILER_PATH)../../Common8/Tools/Bin/midl
    70       MT         = $(MSDEVTOOLS_PATH)/mt
    70       MT         = $(_OTHER_TOOLS_PATH)/mt
    71       ifndef COMPILER_PATH
       
    72 	COMPILER_PATH := $(error COMPILER_PATH cannot be empty here)
       
    73       endif
       
    74     endif
    71     endif
    75     ifeq ($(CC_MAJORVER), 15)
    72     ifeq ($(CC_MAJORVER), 15)
    76       COMPILER_NAME=Visual Studio 9
    73       COMPILER_NAME=Visual Studio 9
    77       COMPILER_VERSION=VS2008
    74       COMPILER_VERSION=VS2008
       
    75       RC         = $(_OTHER_TOOLS_PATH)rc
    78       #rebase and midl moved out of Visual Studio into the SDK:
    76       #rebase and midl moved out of Visual Studio into the SDK:
    79       REBASE     = $(MSDEVTOOLS_PATH)/rebase
    77       REBASE     = $(_OTHER_TOOLS_PATH)/rebase
    80       MTL        = $(MSDEVTOOLS_PATH)/midl.exe
    78       MTL        = $(_OTHER_TOOLS_PATH)/midl.exe
    81       MT         = $(MSDEVTOOLS_PATH)mt
    79       MT         = $(_OTHER_TOOLS_PATH)mt
    82       ifndef COMPILER_PATH
       
    83 	COMPILER_PATH := $(error COMPILER_PATH cannot be empty here)
       
    84       endif
       
    85     endif
       
    86     ifeq ($(CC_MAJORVER), 16)
       
    87       COMPILER_NAME=Visual Studio 10
       
    88       COMPILER_VERSION=VS2010
       
    89       #rebase and midl moved out of Visual Studio into the SDK:
       
    90       REBASE     = $(MSDEVTOOLS_PATH)/rebase
       
    91       MTL        = $(MSDEVTOOLS_PATH)/midl.exe
       
    92       MT         = $(MSDEVTOOLS_PATH)mt
       
    93       ifndef COMPILER_PATH
       
    94 	COMPILER_PATH := $(error COMPILER_PATH cannot be empty here)
       
    95       endif
       
    96     endif
    80     endif
    97   else
    81   else
    98     # else ARCH_DATA_MODEL is 64
    82     # else ARCH_DATA_MODEL is 64
    99     LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
    83     LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
   100     CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
    84     CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
   103     ifeq ($(CC_MAJORVER), 13)
    87     ifeq ($(CC_MAJORVER), 13)
   104       ifeq ($(ARCH), ia64)
    88       ifeq ($(ARCH), ia64)
   105         # This should be: CC_VER=13.00.9337.7 LINK_VER=7.00.9337.7
    89         # This should be: CC_VER=13.00.9337.7 LINK_VER=7.00.9337.7
   106         COMPILER_NAME=Microsoft Platform SDK - November 2001 Edition
    90         COMPILER_NAME=Microsoft Platform SDK - November 2001 Edition
   107         COMPILER_VERSION=VS2003
    91         COMPILER_VERSION=VS2003
       
    92         RC = $(_OTHER_TOOLS_PATH)rc
   108       endif
    93       endif
   109     endif
    94     endif
   110     ifeq ($(CC_MAJORVER), 14)
    95     ifeq ($(CC_MAJORVER), 14)
   111       ifeq ($(ARCH), amd64)
    96       ifeq ($(ARCH), amd64)
   112         #rebase and midl moved out of Visual Studio into the SDK:
    97         #rebase and midl moved out of Visual Studio into the SDK:
   113         REBASE     = $(MSDEVTOOLS_PATH)/rebase
    98         RC         = $(_OTHER_TOOLS_PATH)/rc
   114         MTL        = $(MSDEVTOOLS_PATH)/midl.exe
    99         REBASE     = $(_OTHER_TOOLS_PATH)/rebase
       
   100         MTL        = $(_OTHER_TOOLS_PATH)/midl.exe
   115         ifeq ($(CC_MICROVER), 30701)
   101         ifeq ($(CC_MICROVER), 30701)
   116           # This should be: CC_VER=14.00.30701 LINK_VER=8.00.30701
   102           # This should be: CC_VER=14.00.30701 LINK_VER=8.00.30701
   117 	  # WARNING: it says 14, but it is such an early build it doesn't
   103 	  # WARNING: it says 14, but it is such an early build it doesn't
   118 	  #          have all the VS2005 compiler option changes, so treat
   104 	  #          have all the VS2005 compiler option changes, so treat
   119 	  #          this like a VS2003 compiler.
   105 	  #          this like a VS2003 compiler.
   133       COMPILER_VERSION=VS2008
   119       COMPILER_VERSION=VS2008
   134       RC = $(MSSDK61)/Bin/X64/rc.exe
   120       RC = $(MSSDK61)/Bin/X64/rc.exe
   135       MT = $(MSSDK61)/Bin/X64/mt.exe
   121       MT = $(MSSDK61)/Bin/X64/mt.exe
   136       MTL = $(MSSDK61)/Bin/X64/midl.exe
   122       MTL = $(MSSDK61)/Bin/X64/midl.exe
   137     endif
   123     endif
   138     ifeq ($(CC_MAJORVER), 16)
   124   endif
   139       COMPILER_NAME=Microsoft Visual Studio 10 (16.00.30319.01)
   125   
   140       COMPILER_VERSION=VS2010
   126   # The VS2010 compiler is the same one used on both 32bit and 64bit
   141       RC = $(MSDEVTOOLS_PATH)/Bin/x64/rc.exe
   127   ifeq ($(CC_MAJORVER), 16)
   142       RSC = $(MSDEVTOOLS_PATH)/Bin/x64/rc.exe
   128     COMPILER_NAME=Microsoft Visual Studio 10 (16.00.30319.01)
   143       MT = $(MSDEVTOOLS_PATH)/Bin/x64/mt.exe
   129     COMPILER_VERSION=VS2010
   144       MTL = $(MSDEVTOOLS_PATH)/Bin/X64/midl.exe
   130     ifeq ($(WINDOWSSDKDIR),)
       
   131       WINDOWSSDKDIR := $(error WINDOWSSDKDIR cannot be empty here)
   145     endif
   132     endif
   146     # This will cause problems if ALT_COMPILER_PATH is defined to ""
   133     ifeq ($(ARCH_DATA_MODEL), 32)
   147     # which is a directive to use the PATH.
   134       _OTHER_TOOLS_BIN = $(WINDOWSSDKDIR)/Bin
   148     ifndef COMPILER_PATH
   135     else
   149       COMPILER_PATH := $(error COMPILER_PATH cannot be empty here)
   136       ifeq ($(ARCH), ia64)
       
   137         _OTHER_TOOLS_BIN = $(WINDOWSSDKDIR)/Bin/ia64
       
   138       else
       
   139         _OTHER_TOOLS_BIN = $(WINDOWSSDKDIR)/Bin/x64
       
   140       endif
   150     endif
   141     endif
       
   142     RC     = $(_OTHER_TOOLS_BIN)/rc.exe
       
   143     REBASE = $(_OTHER_TOOLS_BIN)/rebase.exe
       
   144     MT     = $(_OTHER_TOOLS_BIN)/mt.exe
       
   145     MTL    = $(_OTHER_TOOLS_BIN)/midl.exe
       
   146   endif
       
   147   
       
   148   # These variables can never be empty
       
   149   ifndef COMPILER_PATH
       
   150     COMPILER_PATH := $(error COMPILER_PATH cannot be empty here)
   151   endif
   151   endif
   152   ifndef COMPILER_VERSION
   152   ifndef COMPILER_VERSION
   153     COMPILER_VERSION := $(error COMPILER_VERSION cannot be empty here)
   153     COMPILER_VERSION := $(error COMPILER_VERSION cannot be empty here)
   154   endif
   154   endif
       
   155   
   155   # Shared library generation flag
   156   # Shared library generation flag
   156   SHARED_LIBRARY_FLAG = -LD
   157   SHARED_LIBRARY_FLAG = -LD
       
   158   # RSC is always same as RC (Not sure who uses this RSC variable)
       
   159   RSC = $(RC)
       
   160 
   157 endif
   161 endif
   158 
   162