make/bsd/makefiles/gcc.make

Print this page




   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  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, CPP & AS
  29 
  30 # When cross-compiling the ALT_COMPILER_PATH points
  31 # to the cross-compilation toolset
  32 ifdef CROSS_COMPILE_ARCH
  33  CPP = $(ALT_COMPILER_PATH)/g++
  34  CC  = $(ALT_COMPILER_PATH)/gcc
  35  HOSTCPP = g++
  36  HOSTCC  = gcc
  37 else ifneq ($(OS_VENDOR), Darwin)
  38  CXX = g++
  39  CPP = $(CXX)
  40  CC  = gcc
  41  HOSTCPP = $(CPP)
  42  HOSTCC  = $(CC)
  43 endif
  44 
  45 # i486 hotspot requires -mstackrealign on Darwin.
  46 # llvm-gcc supports this in Xcode 3.2.6 and 4.0.
  47 # gcc-4.0 supports this on earlier versions.
  48 # Prefer llvm-gcc where available.
  49 ifeq ($(OS_VENDOR), Darwin)
  50   ifeq ($(origin CXX), default)
  51    CXX = llvm-g++
  52   endif
  53   ifeq ($(origin CC), default)
  54    CC  = llvm-gcc
  55   endif
  56   CPP  = $(CXX)
  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   CPP = $(CXX32)
  71   CC  = $(CC32)
  72   endif
  73 
  74   HOSTCPP = $(CPP)
  75   HOSTCC  = $(CC)
  76 endif
  77 
  78 AS   = $(CC) -c -x assembler-with-cpp
  79 
  80 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
  81 # prints the numbers (e.g. "2.95", "3.2.1")
  82 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
  83 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
  84 
  85 # check for precompiled headers support
  86 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
  87 # Allow the user to turn off precompiled headers from the command line.
  88 ifneq ($(USE_PRECOMPILED_HEADER),0)
  89 PRECOMPILED_HEADER_DIR=.
  90 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
  91 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
  92 endif
  93 endif
  94 




   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  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  CXX = $(CXX)
  40  CC  = gcc
  41  HOSTCXX = $(CXX)
  42  HOSTCC  = $(CC)
  43 endif
  44 
  45 # i486 hotspot requires -mstackrealign on Darwin.
  46 # llvm-gcc supports this in Xcode 3.2.6 and 4.0.
  47 # gcc-4.0 supports this on earlier versions.
  48 # Prefer llvm-gcc where available.
  49 ifeq ($(OS_VENDOR), Darwin)
  50   ifeq ($(origin CXX), default)
  51    CXX = llvm-g++
  52   endif
  53   ifeq ($(origin CC), default)
  54    CC  = llvm-gcc
  55   endif

  56 
  57   ifeq ($(ARCH), i486)
  58   LLVM_SUPPORTS_STACKREALIGN := $(shell \
  59    [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \
  60    && echo true || echo false)
  61 
  62   ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true)
  63     CXX32 ?= llvm-g++
  64     CC32  ?= llvm-gcc
  65   else
  66     CXX32 ?= g++-4.0
  67     CC32  ?= gcc-4.0
  68   endif
  69   CXX = $(CXX32)
  70   CC  = $(CC32)
  71   endif
  72 
  73   HOSTCXX = $(CXX)
  74   HOSTCC  = $(CC)
  75 endif
  76 
  77 AS   = $(CC) -c -x assembler-with-cpp
  78 
  79 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
  80 # prints the numbers (e.g. "2.95", "3.2.1")
  81 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
  82 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
  83 
  84 # check for precompiled headers support
  85 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
  86 # Allow the user to turn off precompiled headers from the command line.
  87 ifneq ($(USE_PRECOMPILED_HEADER),0)
  88 PRECOMPILED_HEADER_DIR=.
  89 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
  90 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
  91 endif
  92 endif
  93