make/bsd/makefiles/gcc.make

Print this page




  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #  
  23 #
  24 
  25 OS_VENDOR = $(shell uname -s)
  26 
  27 #------------------------------------------------------------------------
  28 # CC, CXX & AS
  29 
  30 # When cross-compiling the ALT_COMPILER_PATH points
  31 # to the cross-compilation toolset
  32 ifdef CROSS_COMPILE_ARCH


  33  CXX = $(ALT_COMPILER_PATH)/g++
  34  CC  = $(ALT_COMPILER_PATH)/gcc
  35  HOSTCXX = g++
  36  HOSTCC  = gcc
  37 else ifneq ($(OS_VENDOR), Darwin)
  38  CXX = g++
  39  CC  = gcc
  40  HOSTCXX = $(CXX)
  41  HOSTCC  = $(CC)
  42 endif
  43 
  44 # i486 hotspot requires -mstackrealign on Darwin.
  45 # llvm-gcc supports this in Xcode 3.2.6 and 4.0.
  46 # gcc-4.0 supports this on earlier versions.
  47 # Prefer llvm-gcc where available.
  48 ifeq ($(OS_VENDOR), Darwin)
  49   ifeq ($(origin CXX), default)
  50    CXX = llvm-g++
  51   endif
  52   ifeq ($(origin CC), default)
  53    CC  = llvm-gcc
  54   endif
  55 
  56   ifeq ($(ARCH), i486)
  57   LLVM_SUPPORTS_STACKREALIGN := $(shell \
  58    [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \
  59    && echo true || echo false)
  60 
  61   ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true)
  62     CXX32 ?= llvm-g++
  63     CC32  ?= llvm-gcc
  64   else
  65     CXX32 ?= g++-4.0
  66     CC32  ?= gcc-4.0
  67   endif
  68   CXX = $(CXX32)
  69   CC  = $(CC32)
  70   endif
  71 
  72   HOSTCXX = $(CXX)
  73   HOSTCC  = $(CC)



  74 endif
  75 
  76 AS   = $(CC) -c -x assembler-with-cpp
  77 
  78 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
  79 # prints the numbers (e.g. "2.95", "3.2.1")
  80 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
  81 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
  82 
  83 # check for precompiled headers support
  84 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
  85 # Allow the user to turn off precompiled headers from the command line.
  86 ifneq ($(USE_PRECOMPILED_HEADER),0)
  87 PRECOMPILED_HEADER_DIR=.
  88 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
  89 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
  90 endif
  91 endif
  92 
  93 
  94 #------------------------------------------------------------------------
  95 # Compiler flags
  96 




  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #  
  23 #
  24 
  25 OS_VENDOR = $(shell uname -s)
  26 
  27 #------------------------------------------------------------------------
  28 # CC, CXX & AS
  29 
  30 # If a SPEC is not set already, then use these defaults.
  31 ifeq ($(SPEC),)
  32   # When cross-compiling the ALT_COMPILER_PATH points
  33   # to the cross-compilation toolset
  34   ifdef CROSS_COMPILE_ARCH
  35     CXX = $(ALT_COMPILER_PATH)/g++
  36     CC  = $(ALT_COMPILER_PATH)/gcc
  37     HOSTCXX = g++
  38     HOSTCC  = gcc
  39   else ifneq ($(OS_VENDOR), Darwin)
  40     CXX = g++
  41     CC  = gcc
  42     HOSTCXX = $(CXX)
  43     HOSTCC  = $(CC)
  44   endif
  45 
  46   # i486 hotspot requires -mstackrealign on Darwin.
  47   # llvm-gcc supports this in Xcode 3.2.6 and 4.0.
  48   # gcc-4.0 supports this on earlier versions.
  49   # Prefer llvm-gcc where available.
  50   ifeq ($(OS_VENDOR), Darwin)
  51     ifeq ($(origin CXX), default)
  52       CXX = llvm-g++
  53     endif
  54     ifeq ($(origin CC), default)
  55       CC  = llvm-gcc
  56     endif
  57 
  58     ifeq ($(ARCH), i486)
  59       LLVM_SUPPORTS_STACKREALIGN := $(shell \
  60        [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \
  61        && echo true || echo false)
  62 
  63       ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true)
  64         CXX32 ?= llvm-g++
  65         CC32  ?= llvm-gcc
  66       else
  67         CXX32 ?= g++-4.0
  68         CC32  ?= gcc-4.0
  69       endif
  70       CXX = $(CXX32)
  71       CC  = $(CC32)
  72     endif
  73 
  74     HOSTCXX = $(CXX)
  75     HOSTCC  = $(CC)
  76   endif
  77 
  78   AS   = $(CC) -c -x assembler-with-cpp
  79 endif
  80 

  81 
  82 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
  83 # prints the numbers (e.g. "2.95", "3.2.1")
  84 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
  85 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
  86 
  87 # check for precompiled headers support
  88 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
  89 # Allow the user to turn off precompiled headers from the command line.
  90 ifneq ($(USE_PRECOMPILED_HEADER),0)
  91 PRECOMPILED_HEADER_DIR=.
  92 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
  93 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
  94 endif
  95 endif
  96 
  97 
  98 #------------------------------------------------------------------------
  99 # Compiler flags
 100