make/bsd/makefiles/gcc.make

changeset 3600
7292cff45988
parent 3518
719f7007c8e8
child 3649
3d7ea1dbe0de
equal deleted inserted replaced
3599:b5ab7482dbf9 3600:7292cff45988
25 OS_VENDOR = $(shell uname -s) 25 OS_VENDOR = $(shell uname -s)
26 26
27 #------------------------------------------------------------------------ 27 #------------------------------------------------------------------------
28 # CC, CXX & AS 28 # CC, CXX & AS
29 29
30 # When cross-compiling the ALT_COMPILER_PATH points 30 # If a SPEC is not set already, then use these defaults.
31 # to the cross-compilation toolset 31 ifeq ($(SPEC),)
32 ifdef CROSS_COMPILE_ARCH 32 # When cross-compiling the ALT_COMPILER_PATH points
33 CXX = $(ALT_COMPILER_PATH)/g++ 33 # to the cross-compilation toolset
34 CC = $(ALT_COMPILER_PATH)/gcc 34 ifdef CROSS_COMPILE_ARCH
35 HOSTCXX = g++ 35 CXX = $(ALT_COMPILER_PATH)/g++
36 HOSTCC = gcc 36 CC = $(ALT_COMPILER_PATH)/gcc
37 else ifneq ($(OS_VENDOR), Darwin) 37 HOSTCXX = g++
38 CXX = g++ 38 HOSTCC = gcc
39 CC = gcc 39 else ifneq ($(OS_VENDOR), Darwin)
40 HOSTCXX = $(CXX) 40 CXX = g++
41 HOSTCC = $(CC) 41 CC = gcc
42 endif 42 HOSTCXX = $(CXX)
43 43 HOSTCC = $(CC)
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 44 endif
52 ifeq ($(origin CC), default) 45
53 CC = llvm-gcc 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)
54 endif 76 endif
55 77
56 ifeq ($(ARCH), i486) 78 AS = $(CC) -c -x assembler-with-cpp
57 LLVM_SUPPORTS_STACKREALIGN := $(shell \ 79 endif
58 [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \ 80
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 81
78 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only 82 # -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") 83 # prints the numbers (e.g. "2.95", "3.2.1")
80 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) 84 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) 85 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)

mercurial