28 # CC, CPP & AS |
28 # CC, CPP & AS |
29 |
29 |
30 # When cross-compiling the ALT_COMPILER_PATH points |
30 # When cross-compiling the ALT_COMPILER_PATH points |
31 # to the cross-compilation toolset |
31 # to the cross-compilation toolset |
32 ifdef CROSS_COMPILE_ARCH |
32 ifdef CROSS_COMPILE_ARCH |
33 CXX = $(ALT_COMPILER_PATH)/g++ |
33 CPP = $(ALT_COMPILER_PATH)/g++ |
34 CPP = $(ALT_COMPILER_PATH)/g++ |
34 CC = $(ALT_COMPILER_PATH)/gcc |
35 CC = $(ALT_COMPILER_PATH)/gcc |
35 HOSTCPP = g++ |
36 HOSTCPP = g++ |
36 HOSTCC = gcc |
37 HOSTCC = gcc |
37 else ifneq ($(OS_VENDOR), Darwin) |
38 else |
38 CXX = g++ |
39 CXX ?= g++ |
39 CPP = $(CXX) |
40 CPP = $(CXX) |
40 CC = gcc |
41 CC ?= gcc |
41 HOSTCPP = $(CPP) |
42 HOSTCPP = $(CPP) |
42 HOSTCC = $(CC) |
43 HOSTCC = $(CPP) |
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) |
44 endif |
76 endif |
45 |
77 |
46 AS = $(CC) -c -x assembler-with-cpp |
78 AS = $(CC) -c -x assembler-with-cpp |
47 |
79 |
48 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only |
80 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only |
128 else |
160 else |
129 CFLAGS += -pipe |
161 CFLAGS += -pipe |
130 endif |
162 endif |
131 |
163 |
132 # Compiler warnings are treated as errors |
164 # Compiler warnings are treated as errors |
133 WARNINGS_ARE_ERRORS = -Werror |
165 ifneq ($(COMPILER_WARNINGS_FATAL),false) |
|
166 WARNINGS_ARE_ERRORS = -Werror |
|
167 endif |
134 |
168 |
135 # Except for a few acceptable ones |
169 # Except for a few acceptable ones |
136 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit |
170 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit |
137 # conversions which might affect the values. To avoid that, we need to turn |
171 # conversions which might affect the values. To avoid that, we need to turn |
138 # it off explicitly. |
172 # it off explicitly. |
150 CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations |
184 CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations |
151 endif |
185 endif |
152 |
186 |
153 |
187 |
154 # The flags to use for an Optimized g++ build |
188 # The flags to use for an Optimized g++ build |
155 OPT_CFLAGS += -O3 |
189 ifeq ($(OS_VENDOR), Darwin) |
|
190 # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy |
|
191 # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers> |
|
192 OPT_CFLAGS += -Os |
|
193 else |
|
194 OPT_CFLAGS += -O3 |
|
195 endif |
156 |
196 |
157 # Hotspot uses very unstrict aliasing turn this optimization off |
197 # Hotspot uses very unstrict aliasing turn this optimization off |
158 OPT_CFLAGS += -fno-strict-aliasing |
198 OPT_CFLAGS += -fno-strict-aliasing |
159 |
199 |
160 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp |
200 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp |
210 |
250 |
211 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj |
251 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj |
212 SONAMEFLAG = |
252 SONAMEFLAG = |
213 |
253 |
214 # Build shared library |
254 # Build shared library |
215 SHARED_FLAG = -dynamiclib $(VM_PICFLAG) |
255 SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG) |
216 |
256 |
217 # Keep symbols even they are not used |
257 # Keep symbols even they are not used |
218 #AOUT_FLAGS += -Xlinker -export-dynamic |
258 #AOUT_FLAGS += -Xlinker -export-dynamic |
219 else |
259 else |
220 # Enable linker optimization |
260 # Enable linker optimization |