Mercurial > hg > truffle
annotate make/bsd/makefiles/gcc.make @ 12475:7022b22647ed
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 17 Oct 2013 15:58:41 +0200 |
parents | f2512d89ad0c |
children | 0806a46dced5 f509b8f4699b |
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 | |
3960 | 86 |
10398 | 87 ifeq ($(USE_CLANG), true) |
88 CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1) | |
89 CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2) | |
90 else | |
91 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only | |
92 # prints the numbers (e.g. "2.95", "3.2.1") | |
93 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) | |
94 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) | |
3960 | 95 endif |
96 | |
10398 | 97 ifeq ($(USE_CLANG), true) |
98 # clang has precompiled headers support by default, but the user can switch | |
99 # it off by using 'USE_PRECOMPILED_HEADER=0'. | |
100 ifdef LP64 | |
101 ifeq ($(USE_PRECOMPILED_HEADER),) | |
102 USE_PRECOMPILED_HEADER=1 | |
103 endif | |
104 else | |
105 # We don't support precompiled headers on 32-bit builds because there some files are | |
106 # compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make) | |
107 # Clang produces an error if the PCH file was compiled with other options than the actual compilation unit. | |
108 USE_PRECOMPILED_HEADER=0 | |
109 endif | |
110 | |
111 ifeq ($(USE_PRECOMPILED_HEADER),1) | |
112 | |
113 ifndef LP64 | |
114 $(error " Precompiled Headers only supported on 64-bit platforms!") | |
115 endif | |
116 | |
117 PRECOMPILED_HEADER_DIR=. | |
118 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp | |
119 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch | |
120 | |
121 PCH_FLAG = -include precompiled.hpp | |
122 PCH_FLAG/DEFAULT = $(PCH_FLAG) | |
123 PCH_FLAG/NO_PCH = -DNO_PCH | |
124 PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@)) | |
125 | |
126 VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE) | |
127 VM_PCH_FLAG/AOUT = | |
128 VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO)) | |
129 | |
130 # We only use precompiled headers for the JVM build | |
131 CFLAGS += $(VM_PCH_FLAG) | |
12151
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
132 |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
133 # The following files are compiled at various optimization |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
134 # levels due to optimization issues encountered at the |
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
135 # '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
|
136 # 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
|
137 # 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
|
138 # 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
|
139 # 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
|
140 # 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
|
141 # 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
|
142 # need this special handling. |
10398 | 143 PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH) |
144 PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH) | |
145 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
|
146 PCH_FLAG/unsafe.o = $(PCH_FLAG/NO_PCH) |
10398 | 147 |
148 endif | |
149 else # ($(USE_CLANG), true) | |
150 # check for precompiled headers support | |
151 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" | |
152 # Allow the user to turn off precompiled headers from the command line. | |
153 ifneq ($(USE_PRECOMPILED_HEADER),0) | |
154 PRECOMPILED_HEADER_DIR=. | |
155 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp | |
156 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch | |
157 endif | |
158 endif | |
159 endif | |
160 | |
161 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. | |
162 ifeq ($(USE_PRECOMPILED_HEADER),0) | |
163 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER | |
164 endif | |
3960 | 165 |
166 #------------------------------------------------------------------------ | |
167 # Compiler flags | |
168 | |
169 # position-independent code | |
170 PICFLAG = -fPIC | |
171 | |
172 VM_PICFLAG/LIBJVM = $(PICFLAG) | |
173 VM_PICFLAG/AOUT = | |
174 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) | |
175 | |
5946
3d7ea1dbe0de
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
5897
diff
changeset
|
176 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
|
177 CFLAGS += $(LIBFFI_CFLAGS) |
3960 | 178 endif |
5946
3d7ea1dbe0de
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
5897
diff
changeset
|
179 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
|
180 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
|
181 CFLAGS += $(LLVM_CFLAGS) |
3960 | 182 endif |
183 CFLAGS += $(VM_PICFLAG) | |
184 CFLAGS += -fno-rtti | |
185 CFLAGS += -fno-exceptions | |
10398 | 186 ifeq ($(USE_CLANG),) |
187 CFLAGS += -pthread | |
188 CFLAGS += -fcheck-new | |
189 # version 4 and above support fvisibility=hidden (matches jni_x86.h file) | |
190 # except 4.1.2 gives pointless warnings that can't be disabled (afaik) | |
191 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" | |
192 CFLAGS += -fvisibility=hidden | |
193 endif | |
194 else | |
195 CFLAGS += -fvisibility=hidden | |
196 endif | |
197 | |
198 ifeq ($(USE_CLANG), true) | |
199 # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm' | |
200 # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment') | |
201 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0" | |
202 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16 | |
203 else | |
204 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16 | |
205 endif | |
3960 | 206 endif |
207 | |
208 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) | |
209 ARCHFLAG/i486 = -m32 -march=i586 | |
10398 | 210 ARCHFLAG/amd64 = -m64 $(STACK_ALIGNMENT_OPT) |
3960 | 211 ARCHFLAG/ia64 = |
212 ARCHFLAG/sparc = -m32 -mcpu=v9 | |
213 ARCHFLAG/sparcv9 = -m64 -mcpu=v9 | |
214 ARCHFLAG/zero = $(ZERO_ARCHFLAG) | |
215 | |
216 # Darwin-specific build flags | |
217 ifeq ($(OS_VENDOR), Darwin) | |
218 # Ineffecient 16-byte stack re-alignment on Darwin/IA32 | |
219 ARCHFLAG/i486 += -mstackrealign | |
220 endif | |
221 | |
222 CFLAGS += $(ARCHFLAG) | |
223 AOUT_FLAGS += $(ARCHFLAG) | |
224 LFLAGS += $(ARCHFLAG) | |
225 ASFLAGS += $(ARCHFLAG) | |
226 | |
227 ifdef E500V2 | |
228 CFLAGS += -DE500V2 | |
229 endif | |
230 | |
231 # Use C++ Interpreter | |
232 ifdef CC_INTERP | |
233 CFLAGS += -DCC_INTERP | |
234 endif | |
235 | |
236 # Keep temporary files (.ii, .s) | |
237 ifdef NEED_ASM | |
238 CFLAGS += -save-temps | |
239 else | |
240 CFLAGS += -pipe | |
241 endif | |
242 | |
243 # Compiler warnings are treated as errors | |
4006 | 244 ifneq ($(COMPILER_WARNINGS_FATAL),false) |
245 WARNINGS_ARE_ERRORS = -Werror | |
246 endif | |
3960 | 247 |
10398 | 248 ifeq ($(USE_CLANG), true) |
249 # However we need to clean the code up before we can unrestrictedly enable this option with Clang | |
12329 | 250 WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses |
10398 | 251 WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-compare |
252 # Not yet supported by clang in Xcode 4.6.2 | |
253 # WARNINGS_ARE_ERRORS += -Wno-tautological-constant-out-of-range-compare | |
254 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
|
255 WARNINGS_ARE_ERRORS += -Wno-empty-body |
10398 | 256 endif |
257 | |
8722 | 258 WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef |
10398 | 259 |
260 ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" | |
261 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit | |
262 # conversions which might affect the values. Only enable it in earlier versions. | |
263 WARNING_FLAGS = -Wunused-function | |
264 ifeq ($(USE_CLANG),) | |
12329 | 265 WARNING_FLAGS += -Wconversion |
10398 | 266 endif |
3960 | 267 endif |
268 | |
8722 | 269 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) |
3960 | 270 # Special cases |
271 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) | |
272 # XXXDARWIN: for _dyld_bind_fully_image_containing_address | |
273 ifeq ($(OS_VENDOR), Darwin) | |
274 CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations | |
275 endif | |
276 | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
277 OPT_CFLAGS/SIZE=-Os |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
278 OPT_CFLAGS/SPEED=-O3 |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
279 |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
280 # Hotspot uses very unstrict aliasing turn this optimization off |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
281 # 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
|
282 # so that OPT_CFLAGS overrides get this option too. |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
283 CFLAGS += -fno-strict-aliasing |
3960 | 284 |
285 # The flags to use for an Optimized g++ build | |
4006 | 286 ifeq ($(OS_VENDOR), Darwin) |
287 # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy | |
288 # <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
|
289 OPT_CFLAGS_DEFAULT ?= SIZE |
4006 | 290 else |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
291 OPT_CFLAGS_DEFAULT ?= SPEED |
4006 | 292 endif |
3960 | 293 |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
294 ifdef OPT_CFLAGS |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
295 ifneq ("$(origin OPT_CFLAGS)", "command line") |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
296 $(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
|
297 endif |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
298 endif |
3960 | 299 |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
300 OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
301 |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6129
diff
changeset
|
302 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp |
3960 | 303 # if we use expensive-optimizations |
304 ifeq ($(BUILDARCH), ia64) | |
305 OPT_CFLAGS += -fno-expensive-optimizations | |
306 endif | |
307 | |
308 OPT_CFLAGS/NOOPT=-O0 | |
309 | |
10398 | 310 # Work around some compiler bugs. |
311 ifeq ($(USE_CLANG), true) | |
312 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1) | |
313 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) | |
12151
ca0501b58953
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
12143
diff
changeset
|
314 OPT_CFLAGS/unsafe.o += -O1 |
10398 | 315 endif |
316 else | |
317 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. | |
318 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) | |
319 OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT) | |
320 endif | |
3960 | 321 endif |
322 | |
323 # Flags for generating make dependency flags. | |
10398 | 324 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) |
325 ifeq ($(USE_CLANG),) | |
326 ifneq ($(CC_VER_MAJOR), 2) | |
327 DEPFLAGS += -fpch-deps | |
328 endif | |
3960 | 329 endif |
330 | |
331 # -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
|
332 ifeq ($(USE_PRECOMPILED_HEADER),0) |
3960 | 333 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER |
334 endif | |
335 | |
8682 | 336 ifeq ($(OS_VENDOR), Darwin) |
337 # Setting these parameters makes it an error to link to macosx APIs that are | |
338 # newer than the given OS version and makes the linked binaries compatible even | |
339 # if built on a newer version of the OS. | |
340 # The expected format is X.Y.Z | |
341 ifeq ($(MACOSX_VERSION_MIN),) | |
342 MACOSX_VERSION_MIN=10.7.0 | |
343 endif | |
344 # The macro takes the version with no dots, ex: 1070 | |
345 CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \ | |
346 -mmacosx-version-min=$(MACOSX_VERSION_MIN) | |
347 LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) | |
348 endif | |
349 | |
12203
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
350 |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
351 #------------------------------------------------------------------------ |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
352 # Assembler flags |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
353 |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
354 # Enforce prerpocessing of .s files |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
355 ASFLAGS += -x assembler-with-cpp |
1c6b721a3fbf
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
12151
diff
changeset
|
356 |
3960 | 357 #------------------------------------------------------------------------ |
358 # Linker flags | |
359 | |
360 # statically link libstdc++.so, work with gcc but ignored by g++ | |
361 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic | |
362 | |
10398 | 363 ifeq ($(USE_CLANG),) |
364 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. | |
365 ifneq ("${CC_VER_MAJOR}", "2") | |
366 STATIC_LIBGCC += -static-libgcc | |
367 endif | |
3960 | 368 |
10398 | 369 ifeq ($(BUILDARCH), ia64) |
370 LFLAGS += -Wl,-relax | |
371 endif | |
3960 | 372 endif |
373 | |
374 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. | |
375 MAPFLAG = -Xlinker --version-script=FILENAME | |
376 | |
377 # | |
378 # Shared Library | |
379 # | |
380 ifeq ($(OS_VENDOR), Darwin) | |
381 # Standard linker flags | |
382 LFLAGS += | |
383 | |
11026 | 384 # The apple linker has its own variant of mapfiles/version-scripts |
385 MAPFLAG = -Xlinker -exported_symbols_list -Xlinker FILENAME | |
3960 | 386 |
387 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj | |
388 SONAMEFLAG = | |
389 | |
390 # Build shared library | |
4006 | 391 SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG) |
3960 | 392 |
393 # Keep symbols even they are not used | |
394 #AOUT_FLAGS += -Xlinker -export-dynamic | |
395 else | |
396 # Enable linker optimization | |
397 LFLAGS += -Xlinker -O1 | |
398 | |
399 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj | |
400 SONAMEFLAG = -Xlinker -soname=SONAME | |
401 | |
402 # Build shared library | |
403 SHARED_FLAG = -shared $(VM_PICFLAG) | |
404 | |
405 # Keep symbols even they are not used | |
406 AOUT_FLAGS += -Xlinker -export-dynamic | |
407 endif | |
408 | |
409 #------------------------------------------------------------------------ | |
410 # Debug flags | |
411 | |
10398 | 412 ifeq ($(USE_CLANG), true) |
413 # Restrict the debug information created by Clang to avoid | |
414 # too big object files and speed the build up a little bit | |
415 # (see http://llvm.org/bugs/show_bug.cgi?id=7554) | |
416 CFLAGS += -flimit-debug-info | |
3960 | 417 endif |
418 | |
10398 | 419 # DEBUG_BINARIES uses full -g debug information for all configs |
3960 | 420 ifeq ($(DEBUG_BINARIES), true) |
10398 | 421 CFLAGS += -g |
422 else | |
423 # Use the stabs format for debugging information (this is the default | |
424 # on gcc-2.91). It's good enough, has all the information about line | |
425 # numbers and local variables, and libjvm.so is only about 16M. | |
426 # Change this back to "-g" if you want the most expressive format. | |
427 # (warning: that could easily inflate libjvm.so to 150M!) | |
428 # Note: The Itanium gcc compiler crashes when using -gstabs. | |
429 DEBUG_CFLAGS/ia64 = -g | |
430 DEBUG_CFLAGS/amd64 = -g | |
431 DEBUG_CFLAGS/arm = -g | |
432 DEBUG_CFLAGS/ppc = -g | |
433 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) | |
434 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) | |
435 DEBUG_CFLAGS += -gstabs | |
436 endif | |
3960 | 437 endif |
438 | |
439 # If we are building HEADLESS, pass on to VM | |
440 # so it can set the java.awt.headless property | |
441 ifdef HEADLESS | |
442 CFLAGS += -DHEADLESS | |
443 endif | |
444 | |
445 # We are building Embedded for a small device | |
446 # favor code space over speed | |
447 ifdef MINIMIZE_RAM_USAGE | |
448 CFLAGS += -DMINIMIZE_RAM_USAGE | |
449 endif |