Mercurial > hg > truffle
annotate make/bsd/makefiles/gcc.make @ 13747:6f9ce155dcfa
Ruby: turn tracing and debugging back on by default.
author | Chris Seaton <chris.seaton@oracle.com> |
---|---|
date | Thu, 23 Jan 2014 23:49:46 +0000 |
parents | 096c224171c4 |
children | f97c5ec83832 |
rev | line source |
---|---|
3960 | 1 # |
11026 | 2 # Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
3960 | 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. | |
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 #------------------------------------------------------------------------ | |
4891
719f7007c8e8
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
4129
diff
changeset
|
28 # CC, CXX & AS |
3960 | 29 |
5897
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
30 # If a SPEC is not set already, then use these defaults. |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
31 ifeq ($(SPEC),) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
32 # When cross-compiling the ALT_COMPILER_PATH points |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
33 # to the cross-compilation toolset |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
34 ifdef CROSS_COMPILE_ARCH |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
35 CXX = $(ALT_COMPILER_PATH)/g++ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
36 CC = $(ALT_COMPILER_PATH)/gcc |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
37 HOSTCXX = g++ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
38 HOSTCC = gcc |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
39 else ifneq ($(OS_VENDOR), Darwin) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
40 CXX = g++ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
41 CC = gcc |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
42 HOSTCXX = $(CXX) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
43 HOSTCC = $(CC) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
44 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
45 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
46 # i486 hotspot requires -mstackrealign on Darwin. |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
47 # llvm-gcc supports this in Xcode 3.2.6 and 4.0. |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
48 # gcc-4.0 supports this on earlier versions. |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
49 # Prefer llvm-gcc where available. |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
50 ifeq ($(OS_VENDOR), Darwin) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
51 ifeq ($(origin CXX), default) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
52 CXX = llvm-g++ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
53 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
54 ifeq ($(origin CC), default) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
55 CC = llvm-gcc |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
56 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
57 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
58 ifeq ($(ARCH), i486) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
59 LLVM_SUPPORTS_STACKREALIGN := $(shell \ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
60 [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
61 && echo true || echo false) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
62 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
63 ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
64 CXX32 ?= llvm-g++ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
65 CC32 ?= llvm-gcc |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
66 else |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
67 CXX32 ?= g++-4.0 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
68 CC32 ?= gcc-4.0 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
69 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
70 CXX = $(CXX32) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
71 CC = $(CC32) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
72 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
73 |
10398 | 74 ifeq ($(USE_CLANG), true) |
75 CXX = clang++ | |
76 CC = clang | |
77 endif | |
78 | |
5897
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
79 HOSTCXX = $(CXX) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
80 HOSTCC = $(CC) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
81 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
82 |
12203
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
83 AS = $(CC) -c |
4006 | 84 endif |
85 | |
12859
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
86 ifeq ($(OS_VENDOR), Darwin) |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
87 ifeq ($(DSYMUTIL),) |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
88 DSYMUTIL=dsymutil |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
89 endif |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
90 endif |
3960 | 91 |
10398 | 92 ifeq ($(USE_CLANG), true) |
93 CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1) | |
94 CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2) | |
95 else | |
96 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only | |
97 # prints the numbers (e.g. "2.95", "3.2.1") | |
98 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) | |
99 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) | |
3960 | 100 endif |
101 | |
10398 | 102 ifeq ($(USE_CLANG), true) |
103 # clang has precompiled headers support by default, but the user can switch | |
104 # it off by using 'USE_PRECOMPILED_HEADER=0'. | |
105 ifdef LP64 | |
106 ifeq ($(USE_PRECOMPILED_HEADER),) | |
107 USE_PRECOMPILED_HEADER=1 | |
108 endif | |
109 else | |
110 # We don't support precompiled headers on 32-bit builds because there some files are | |
111 # compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make) | |
112 # Clang produces an error if the PCH file was compiled with other options than the actual compilation unit. | |
113 USE_PRECOMPILED_HEADER=0 | |
114 endif | |
115 | |
116 ifeq ($(USE_PRECOMPILED_HEADER),1) | |
117 | |
118 ifndef LP64 | |
119 $(error " Precompiled Headers only supported on 64-bit platforms!") | |
120 endif | |
121 | |
122 PRECOMPILED_HEADER_DIR=. | |
123 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp | |
124 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch | |
125 | |
126 PCH_FLAG = -include precompiled.hpp | |
127 PCH_FLAG/DEFAULT = $(PCH_FLAG) | |
128 PCH_FLAG/NO_PCH = -DNO_PCH | |
129 PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@)) | |
130 | |
131 VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE) | |
132 VM_PCH_FLAG/AOUT = | |
133 VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO)) | |
134 | |
135 # We only use precompiled headers for the JVM build | |
136 CFLAGS += $(VM_PCH_FLAG) | |
12151
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
137 |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
138 # The following files are compiled at various optimization |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
139 # levels due to optimization issues encountered at the |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
140 # 'OPT_CFLAGS_DEFAULT' level. The Clang compiler issues a compile |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
141 # time error if there is an optimization level specification |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
142 # skew between the PCH file and the C++ file. Especially if the |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
143 # PCH file is compiled at a higher optimization level than |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
144 # the C++ file. One solution might be to prepare extra optimization |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
145 # level specific PCH files for the opt build and use them here, but |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
146 # it's probably not worth the effort as long as only a few files |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
147 # need this special handling. |
10398 | 148 PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH) |
149 PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH) | |
150 PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH) | |
12143
dfc126b2f659
8022407: sun/misc/CopyMemory.java fails with SIGSEGV in Unsafe_SetByte+0x35
hseigel
parents:
12077
diff
changeset
|
151 PCH_FLAG/unsafe.o = $(PCH_FLAG/NO_PCH) |
12629 | 152 PCH_FLAG/graalCompilerToVM.o = $(PCH_FLAG/NO_PCH) |
153 | |
10398 | 154 endif |
155 else # ($(USE_CLANG), true) | |
156 # check for precompiled headers support | |
157 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" | |
158 # Allow the user to turn off precompiled headers from the command line. | |
159 ifneq ($(USE_PRECOMPILED_HEADER),0) | |
160 PRECOMPILED_HEADER_DIR=. | |
161 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp | |
162 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch | |
163 endif | |
164 endif | |
165 endif | |
166 | |
167 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. | |
168 ifeq ($(USE_PRECOMPILED_HEADER),0) | |
169 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER | |
170 endif | |
3960 | 171 |
172 #------------------------------------------------------------------------ | |
173 # Compiler flags | |
174 | |
175 # position-independent code | |
176 PICFLAG = -fPIC | |
177 | |
178 VM_PICFLAG/LIBJVM = $(PICFLAG) | |
179 VM_PICFLAG/AOUT = | |
180 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) | |
181 | |
5946
3d7ea1dbe0de
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
5897
diff
changeset
|
182 ifeq ($(JVM_VARIANT_ZERO), true) |
3d7ea1dbe0de
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
5897
diff
changeset
|
183 CFLAGS += $(LIBFFI_CFLAGS) |
3960 | 184 endif |
5946
3d7ea1dbe0de
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
5897
diff
changeset
|
185 ifeq ($(JVM_VARIANT_ZEROSHARK), true) |
3d7ea1dbe0de
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
5897
diff
changeset
|
186 CFLAGS += $(LIBFFI_CFLAGS) |
3d7ea1dbe0de
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
5897
diff
changeset
|
187 CFLAGS += $(LLVM_CFLAGS) |
3960 | 188 endif |
189 CFLAGS += $(VM_PICFLAG) | |
190 CFLAGS += -fno-rtti | |
191 CFLAGS += -fno-exceptions | |
10398 | 192 ifeq ($(USE_CLANG),) |
193 CFLAGS += -pthread | |
194 CFLAGS += -fcheck-new | |
195 # version 4 and above support fvisibility=hidden (matches jni_x86.h file) | |
196 # except 4.1.2 gives pointless warnings that can't be disabled (afaik) | |
197 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" | |
198 CFLAGS += -fvisibility=hidden | |
199 endif | |
200 else | |
201 CFLAGS += -fvisibility=hidden | |
202 endif | |
203 | |
204 ifeq ($(USE_CLANG), true) | |
205 # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm' | |
206 # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment') | |
207 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0" | |
208 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16 | |
209 else | |
210 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16 | |
211 endif | |
3960 | 212 endif |
213 | |
214 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) | |
215 ARCHFLAG/i486 = -m32 -march=i586 | |
10398 | 216 ARCHFLAG/amd64 = -m64 $(STACK_ALIGNMENT_OPT) |
3960 | 217 ARCHFLAG/ia64 = |
218 ARCHFLAG/sparc = -m32 -mcpu=v9 | |
219 ARCHFLAG/sparcv9 = -m64 -mcpu=v9 | |
220 ARCHFLAG/zero = $(ZERO_ARCHFLAG) | |
221 | |
222 # Darwin-specific build flags | |
223 ifeq ($(OS_VENDOR), Darwin) | |
224 # Ineffecient 16-byte stack re-alignment on Darwin/IA32 | |
225 ARCHFLAG/i486 += -mstackrealign | |
226 endif | |
227 | |
228 CFLAGS += $(ARCHFLAG) | |
229 AOUT_FLAGS += $(ARCHFLAG) | |
230 LFLAGS += $(ARCHFLAG) | |
231 ASFLAGS += $(ARCHFLAG) | |
232 | |
233 ifdef E500V2 | |
234 CFLAGS += -DE500V2 | |
235 endif | |
236 | |
237 # Use C++ Interpreter | |
238 ifdef CC_INTERP | |
239 CFLAGS += -DCC_INTERP | |
240 endif | |
241 | |
242 # Keep temporary files (.ii, .s) | |
243 ifdef NEED_ASM | |
244 CFLAGS += -save-temps | |
245 else | |
246 CFLAGS += -pipe | |
247 endif | |
248 | |
249 # Compiler warnings are treated as errors | |
4006 | 250 ifneq ($(COMPILER_WARNINGS_FATAL),false) |
251 WARNINGS_ARE_ERRORS = -Werror | |
252 endif | |
3960 | 253 |
10398 | 254 ifeq ($(USE_CLANG), true) |
255 # However we need to clean the code up before we can unrestrictedly enable this option with Clang | |
12329 | 256 WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses |
10398 | 257 WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-compare |
258 # Not yet supported by clang in Xcode 4.6.2 | |
259 # WARNINGS_ARE_ERRORS += -Wno-tautological-constant-out-of-range-compare | |
260 WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess | |
12077
e16282db4946
8022956: Clang: enable return type warnings on BSD
twisti
parents:
11026
diff
changeset
|
261 WARNINGS_ARE_ERRORS += -Wno-empty-body |
10398 | 262 endif |
263 | |
8722 | 264 WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef |
10398 | 265 |
266 ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" | |
267 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit | |
268 # conversions which might affect the values. Only enable it in earlier versions. | |
269 WARNING_FLAGS = -Wunused-function | |
270 ifeq ($(USE_CLANG),) | |
12329 | 271 WARNING_FLAGS += -Wconversion |
10398 | 272 endif |
3960 | 273 endif |
274 | |
8722 | 275 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) |
3960 | 276 # Special cases |
277 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) | |
278 # XXXDARWIN: for _dyld_bind_fully_image_containing_address | |
279 ifeq ($(OS_VENDOR), Darwin) | |
280 CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations | |
281 endif | |
282 | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
283 OPT_CFLAGS/SIZE=-Os |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
284 OPT_CFLAGS/SPEED=-O3 |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
285 |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
286 # Hotspot uses very unstrict aliasing turn this optimization off |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
287 # This option is added to CFLAGS rather than OPT_CFLAGS |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
288 # so that OPT_CFLAGS overrides get this option too. |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
289 CFLAGS += -fno-strict-aliasing |
3960 | 290 |
291 # The flags to use for an Optimized g++ build | |
4006 | 292 ifeq ($(OS_VENDOR), Darwin) |
293 # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy | |
294 # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers> | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
295 OPT_CFLAGS_DEFAULT ?= SIZE |
4006 | 296 else |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
297 OPT_CFLAGS_DEFAULT ?= SPEED |
4006 | 298 endif |
3960 | 299 |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
300 ifdef OPT_CFLAGS |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
301 ifneq ("$(origin OPT_CFLAGS)", "command line") |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
302 $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
303 endif |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
304 endif |
3960 | 305 |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
306 OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
307 |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
308 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp |
3960 | 309 # if we use expensive-optimizations |
310 ifeq ($(BUILDARCH), ia64) | |
311 OPT_CFLAGS += -fno-expensive-optimizations | |
312 endif | |
313 | |
314 OPT_CFLAGS/NOOPT=-O0 | |
315 | |
10398 | 316 # Work around some compiler bugs. |
317 ifeq ($(USE_CLANG), true) | |
12629 | 318 # Clang 4.2 |
10398 | 319 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1) |
320 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) | |
12151
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
321 OPT_CFLAGS/unsafe.o += -O1 |
10398 | 322 endif |
12500
0806a46dced5
workaround for bug in Clang 5.0
Doug Simon <doug.simon@oracle.com>
parents:
12329
diff
changeset
|
323 # Clang 5.0 |
0806a46dced5
workaround for bug in Clang 5.0
Doug Simon <doug.simon@oracle.com>
parents:
12329
diff
changeset
|
324 ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& $(CC_VER_MINOR) = 0), 1) |
12629 | 325 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) |
12500
0806a46dced5
workaround for bug in Clang 5.0
Doug Simon <doug.simon@oracle.com>
parents:
12329
diff
changeset
|
326 OPT_CFLAGS/unsafe.o += -O1 |
12629 | 327 OPT_CFLAGS/graalCompilerToVM.o += -O1 |
12500
0806a46dced5
workaround for bug in Clang 5.0
Doug Simon <doug.simon@oracle.com>
parents:
12329
diff
changeset
|
328 endif |
10398 | 329 else |
330 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. | |
331 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) | |
332 OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT) | |
333 endif | |
3960 | 334 endif |
335 | |
12629 | 336 # We want to use libc++ on Clang 5.0 |
337 ifeq ($(USE_CLANG), true) | |
338 # Clang 5.0 | |
339 ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& $(CC_VER_MINOR) = 0), 1) | |
340 CFLAGS += -stdlib=libc++ | |
341 endif | |
342 endif | |
343 | |
3960 | 344 # Flags for generating make dependency flags. |
10398 | 345 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) |
346 ifeq ($(USE_CLANG),) | |
347 ifneq ($(CC_VER_MAJOR), 2) | |
348 DEPFLAGS += -fpch-deps | |
349 endif | |
3960 | 350 endif |
351 | |
352 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. | |
4129
f4414323345f
7116081: USE_PRECOMPILED_HEADER=0 triggers a single threaded build of the JVM
stefank
parents:
4033
diff
changeset
|
353 ifeq ($(USE_PRECOMPILED_HEADER),0) |
3960 | 354 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER |
355 endif | |
356 | |
8682 | 357 ifeq ($(OS_VENDOR), Darwin) |
358 # Setting these parameters makes it an error to link to macosx APIs that are | |
359 # newer than the given OS version and makes the linked binaries compatible even | |
360 # if built on a newer version of the OS. | |
361 # The expected format is X.Y.Z | |
362 ifeq ($(MACOSX_VERSION_MIN),) | |
363 MACOSX_VERSION_MIN=10.7.0 | |
364 endif | |
365 # The macro takes the version with no dots, ex: 1070 | |
366 CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \ | |
367 -mmacosx-version-min=$(MACOSX_VERSION_MIN) | |
368 LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) | |
369 endif | |
370 | |
12203
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
371 |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
372 #------------------------------------------------------------------------ |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
373 # Assembler flags |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
374 |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
375 # Enforce prerpocessing of .s files |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
376 ASFLAGS += -x assembler-with-cpp |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
377 |
3960 | 378 #------------------------------------------------------------------------ |
379 # Linker flags | |
380 | |
381 # statically link libstdc++.so, work with gcc but ignored by g++ | |
382 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic | |
383 | |
10398 | 384 ifeq ($(USE_CLANG),) |
385 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. | |
386 ifneq ("${CC_VER_MAJOR}", "2") | |
387 STATIC_LIBGCC += -static-libgcc | |
388 endif | |
3960 | 389 |
10398 | 390 ifeq ($(BUILDARCH), ia64) |
391 LFLAGS += -Wl,-relax | |
392 endif | |
3960 | 393 endif |
394 | |
395 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. | |
396 MAPFLAG = -Xlinker --version-script=FILENAME | |
397 | |
398 # | |
399 # Shared Library | |
400 # | |
401 ifeq ($(OS_VENDOR), Darwin) | |
402 # Standard linker flags | |
403 LFLAGS += | |
404 | |
11026 | 405 # The apple linker has its own variant of mapfiles/version-scripts |
406 MAPFLAG = -Xlinker -exported_symbols_list -Xlinker FILENAME | |
3960 | 407 |
408 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj | |
409 SONAMEFLAG = | |
410 | |
411 # Build shared library | |
4006 | 412 SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG) |
3960 | 413 |
414 # Keep symbols even they are not used | |
415 #AOUT_FLAGS += -Xlinker -export-dynamic | |
416 else | |
417 # Enable linker optimization | |
418 LFLAGS += -Xlinker -O1 | |
419 | |
420 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj | |
421 SONAMEFLAG = -Xlinker -soname=SONAME | |
422 | |
423 # Build shared library | |
424 SHARED_FLAG = -shared $(VM_PICFLAG) | |
425 | |
426 # Keep symbols even they are not used | |
427 AOUT_FLAGS += -Xlinker -export-dynamic | |
428 endif | |
429 | |
430 #------------------------------------------------------------------------ | |
431 # Debug flags | |
432 | |
10398 | 433 ifeq ($(USE_CLANG), true) |
434 # Restrict the debug information created by Clang to avoid | |
435 # too big object files and speed the build up a little bit | |
436 # (see http://llvm.org/bugs/show_bug.cgi?id=7554) | |
437 CFLAGS += -flimit-debug-info | |
3960 | 438 endif |
439 | |
10398 | 440 # DEBUG_BINARIES uses full -g debug information for all configs |
3960 | 441 ifeq ($(DEBUG_BINARIES), true) |
10398 | 442 CFLAGS += -g |
443 else | |
444 # Use the stabs format for debugging information (this is the default | |
445 # on gcc-2.91). It's good enough, has all the information about line | |
446 # numbers and local variables, and libjvm.so is only about 16M. | |
447 # Change this back to "-g" if you want the most expressive format. | |
448 # (warning: that could easily inflate libjvm.so to 150M!) | |
449 # Note: The Itanium gcc compiler crashes when using -gstabs. | |
450 DEBUG_CFLAGS/ia64 = -g | |
451 DEBUG_CFLAGS/amd64 = -g | |
452 DEBUG_CFLAGS/arm = -g | |
453 DEBUG_CFLAGS/ppc = -g | |
454 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) | |
455 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) | |
456 DEBUG_CFLAGS += -gstabs | |
457 endif | |
12859
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
458 |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
459 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
460 FASTDEBUG_CFLAGS/ia64 = -g |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
461 FASTDEBUG_CFLAGS/amd64 = -g |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
462 FASTDEBUG_CFLAGS/arm = -g |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
463 FASTDEBUG_CFLAGS/ppc = -g |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
464 FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH)) |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
465 ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),) |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
466 ifeq ($(USE_CLANG), true) |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
467 # Clang doesn't understand -gstabs |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
468 FASTDEBUG_CFLAGS += -g |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
469 else |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
470 FASTDEBUG_CFLAGS += -gstabs |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
471 endif |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
472 endif |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
473 |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
474 OPT_CFLAGS/ia64 = -g |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
475 OPT_CFLAGS/amd64 = -g |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
476 OPT_CFLAGS/arm = -g |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
477 OPT_CFLAGS/ppc = -g |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
478 OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH)) |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
479 ifeq ($(OPT_CFLAGS/$(BUILDARCH)),) |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
480 ifeq ($(USE_CLANG), true) |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
481 # Clang doesn't understand -gstabs |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
482 OPT_CFLAGS += -g |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
483 else |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
484 OPT_CFLAGS += -gstabs |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
485 endif |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
486 endif |
f509b8f4699b
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
12329
diff
changeset
|
487 endif |
3960 | 488 endif |
489 | |
490 # If we are building HEADLESS, pass on to VM | |
491 # so it can set the java.awt.headless property | |
492 ifdef HEADLESS | |
493 CFLAGS += -DHEADLESS | |
494 endif | |
495 | |
496 # We are building Embedded for a small device | |
497 # favor code space over speed | |
498 ifdef MINIMIZE_RAM_USAGE | |
499 CFLAGS += -DMINIMIZE_RAM_USAGE | |
500 endif |