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 # GCC Compiler settings
  28 #
  29 
  30 ifeq ($(PLATFORM), windows)
  31 
  32   # Settings specific to Windows, pretty stale, hasn't been used
  33   CC           ?= $(COMPILER_PATH)gcc
  34   CPP          ?= $(COMPILER_PATH)gcc -E
  35   CXX          ?= $(COMPILER_PATH)g++
  36   CCC          ?= $(COMPILER_PATH)g++
  37   AR           ?= $(COMPILER_PATH)lib
  38   LINK         ?= $(COMPILER_PATH)link
  39   RC           ?= $(COMPILER_PATH)rc
  40   LINK32       = $(LINK)
  41   RSC          = $(RC)
  42   # unset any GNU Make settings of MFLAGS and MAKEFLAGS which may mess up nmake
  43   NMAKE          = MFLAGS= MAKEFLAGS= $(COMPILER_PATH)nmake -nologo
  44   ifeq ($(ARCH_DATA_MODEL), 32)
  45     CC_VER  = UNKNOWN
  46   else
  47     CC_VER  = UNKNOWN
  48   endif
  49   _LINK_VER :=$(shell $(LINK) 2>&1 | $(HEAD) -n 1)
  50   LINK_VER  :=$(call GetVersion,"$(_LINK_VER)")
  51 
  52 endif
  53 
  54 ifeq ($(PLATFORM), linux)
  55 
  56 # Settings specific to Linux
  57   CC             ?= $(COMPILER_PATH)gcc
  58   CPP            ?= $(COMPILER_PATH)gcc -E
  59 # Acquire the paths to the compilers and tools
  60   # statically link libstdc++ before C++ ABI is stablized on Linux
  61   STATIC_CXX     = true
  62   ifeq ($(STATIC_CXX),true)
  63     # g++ always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++"
  64     # We need to use gcc to statically link the C++ runtime. gcc and g++ use
  65     # the same subprocess to compile C++ files, so it is OK to build using gcc.
  66     CXX            ?= $(CC)
  67     #$(COMPILER_PATH)gcc
  68   else
  69 #    CXX            = $(COMPILER_PATH)g++
  70   endif
  71   # Option used to create a shared library
  72   SHARED_LIBRARY_FLAG = -shared
  73   SUN_COMP_VER := $(shell $(CC) --verbose 2>&1 )
  74 
  75 endif
  76 
  77 ifeq ($(PLATFORM), solaris)
  78 
  79   # Settings specific to Solaris
  80   CC             ?= $(COMPILER_PATH)gcc
  81   CPP            ?= $(COMPILER_PATH)gcc -E
  82   CXX            ?= $(COMPILER_PATH)g++
  83 
  84   # Option used to create a shared library
  85   SHARED_LIBRARY_FLAG = -G
  86   
  87 endif
  88 
  89 # Get gcc version
  90 _CC_VER :=$(shell $(CC) -dumpversion 2>&1 )
  91 CC_VER  :=$(call GetVersion,"$(_CC_VER)")
  92 CC_MAJORVER  :=$(call MajorVersion,$(CC_VER))
  93 CC_MINORVER  :=$(call MinorVersion,$(CC_VER))
  94 
  95 # Name of compiler
  96 COMPILER_NAME = GCC$(call MajorVersion,$(CC_VER))
  97 COMPILER_VERSION = $(COMPILER_NAME)
  98