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 # MSVC Compiler settings
  28 #
  29 
  30 ifeq ($(PLATFORM), windows)
  31   CC           ?= $(COMPILER_PATH)cl
  32   CPP          ?= $(COMPILER_PATH)cl
  33   CXX          ?= $(COMPILER_PATH)cl
  34   CCC          ?= $(COMPILER_PATH)cl
  35   AR           ?= $(COMPILER_PATH)lib
  36   LINK         ?= $(COMPILER_PATH)link
  37   LINK32       ?= $(LINK)
  38 # TODO Add dumpbin.exe to configure
  39   DUMPBIN      ?= $(COMPILER_PATH)dumpbin.exe
  40  
  41   # Fill in unknown values
  42   COMPILER_NAME=Unknown MSVC Compiler
  43   COMPILER_VERSION=
  44   
  45   # unset any GNU Make settings of MFLAGS and MAKEFLAGS which may mess up nmake
  46   NMAKE          = MFLAGS= MAKEFLAGS= $(COMPILER_PATH)nmake -nologo
  47 
  48   # 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}')
  50 
  51   LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
  52   CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
  53   
  54   # The VS2010 compiler is the same one used on both 32bit and 64bit
  55   ifeq ($(CC_MAJORVER), 16)
  56     COMPILER_NAME=Microsoft Visual Studio 10 (16.00.30319.01)
  57     COMPILER_VERSION=VS2010
  58     ifeq ($(WINDOWSSDKDIR),)
  59       WINDOWSSDKDIR := $(error WINDOWSSDKDIR cannot be empty here)
  60     endif
  61     ifeq ($(ARCH_DATA_MODEL), 32)
  62       _OTHER_TOOLS_BIN = $(WINDOWSSDKDIR)/Bin
  63     else
  64       ifeq ($(ARCH), ia64)
  65         _OTHER_TOOLS_BIN = $(WINDOWSSDKDIR)/Bin/ia64
  66       else
  67         _OTHER_TOOLS_BIN = $(WINDOWSSDKDIR)/Bin/x64
  68       endif
  69     endif
  70     RC     = $(_OTHER_TOOLS_BIN)/RC.Exe
  71     REBASE = $(_OTHER_TOOLS_BIN)/ReBase.Exe
  72     MT     = $(_OTHER_TOOLS_BIN)/mt.exe
  73     MTL    = $(_OTHER_TOOLS_BIN)/midl.exe
  74   endif
  75   
  76   # These variables can never be empty
  77   ifndef COMPILER_PATH
  78     COMPILER_PATH := $(error COMPILER_PATH cannot be empty here)
  79   endif
  80   ifndef COMPILER_VERSION
  81     COMPILER_VERSION := $(error COMPILER_VERSION cannot be empty here)
  82   endif
  83   ifneq ($(COMPILER_VERSION),VS2010)
  84     COMPILER_VERSION := $(error COMPILER_VERSION must be VS2010)
  85   endif
  86   
  87   # Shared library generation flag
  88   SHARED_LIBRARY_FLAG = -LD
  89   # RSC is always same as RC (Not sure who uses this RSC variable)
  90   RSC = $(RC)
  91 
  92 endif
  93