author | hseigel |
Thu, 29 Aug 2013 13:44:07 -0400 | |
changeset 19693 | 633580a41062 |
parent 19336 | ddceb0657500 |
child 19701 | 8dfde6242cd1 |
permissions | -rw-r--r-- |
10565 | 1 |
# |
18431 | 2 |
# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
10565 | 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 |
#------------------------------------------------------------------------ |
|
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
11205
diff
changeset
|
28 |
# CC, CXX & AS |
10565 | 29 |
|
11955
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
30 |
# If a SPEC is not set already, then use these defaults. |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
31 |
ifeq ($(SPEC),) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
32 |
# When cross-compiling the ALT_COMPILER_PATH points |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
33 |
# to the cross-compilation toolset |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
34 |
ifdef CROSS_COMPILE_ARCH |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
35 |
CXX = $(ALT_COMPILER_PATH)/g++ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
36 |
CC = $(ALT_COMPILER_PATH)/gcc |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
37 |
HOSTCXX = g++ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
38 |
HOSTCC = gcc |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
39 |
else ifneq ($(OS_VENDOR), Darwin) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
40 |
CXX = g++ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
41 |
CC = gcc |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
42 |
HOSTCXX = $(CXX) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
43 |
HOSTCC = $(CC) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
44 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
45 |
|
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
46 |
# i486 hotspot requires -mstackrealign on Darwin. |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
47 |
# llvm-gcc supports this in Xcode 3.2.6 and 4.0. |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
48 |
# gcc-4.0 supports this on earlier versions. |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
49 |
# Prefer llvm-gcc where available. |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
50 |
ifeq ($(OS_VENDOR), Darwin) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
51 |
ifeq ($(origin CXX), default) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
52 |
CXX = llvm-g++ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
53 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
54 |
ifeq ($(origin CC), default) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
55 |
CC = llvm-gcc |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
56 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
57 |
|
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
58 |
ifeq ($(ARCH), i486) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
59 |
LLVM_SUPPORTS_STACKREALIGN := $(shell \ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
60 |
[ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
61 |
&& echo true || echo false) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
62 |
|
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
63 |
ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
64 |
CXX32 ?= llvm-g++ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
65 |
CC32 ?= llvm-gcc |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
66 |
else |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
67 |
CXX32 ?= g++-4.0 |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
68 |
CC32 ?= gcc-4.0 |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
69 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
70 |
CXX = $(CXX32) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
71 |
CC = $(CC32) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
72 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
73 |
|
17880 | 74 |
ifeq ($(USE_CLANG), true) |
75 |
CXX = clang++ |
|
76 |
CC = clang |
|
77 |
endif |
|
78 |
||
11955
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
79 |
HOSTCXX = $(CXX) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
80 |
HOSTCC = $(CC) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
81 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
82 |
|
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
83 |
AS = $(CC) -c -x assembler-with-cpp |
10739 | 84 |
endif |
85 |
||
10565 | 86 |
|
17880 | 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) |
|
10565 | 95 |
endif |
96 |
||
17880 | 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) |
|
132 |
||
133 |
# There are some files which don't like precompiled headers |
|
134 |
# The following files are build with 'OPT_CFLAGS/NOOPT' (-O0) in the opt build. |
|
135 |
# But Clang doesn't support a precompiled header which was compiled with -O3 |
|
136 |
# to be used in a compilation unit which uses '-O0'. We could also prepare an |
|
137 |
# extra '-O0' PCH file for the opt build and use it here, but it's probably |
|
138 |
# not worth the effort as long as only two files need this special handling. |
|
139 |
PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH) |
|
140 |
PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH) |
|
141 |
PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH) |
|
19693
633580a41062
8022407: sun/misc/CopyMemory.java fails with SIGSEGV in Unsafe_SetByte+0x35
hseigel
parents:
19336
diff
changeset
|
142 |
PCH_FLAG/unsafe.o = $(PCH_FLAG/NO_PCH) |
17880 | 143 |
|
144 |
endif |
|
145 |
else # ($(USE_CLANG), true) |
|
146 |
# check for precompiled headers support |
|
147 |
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" |
|
148 |
# Allow the user to turn off precompiled headers from the command line. |
|
149 |
ifneq ($(USE_PRECOMPILED_HEADER),0) |
|
150 |
PRECOMPILED_HEADER_DIR=. |
|
151 |
PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp |
|
152 |
PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch |
|
153 |
endif |
|
154 |
endif |
|
155 |
endif |
|
156 |
||
157 |
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. |
|
158 |
ifeq ($(USE_PRECOMPILED_HEADER),0) |
|
159 |
CFLAGS += -DDONT_USE_PRECOMPILED_HEADER |
|
160 |
endif |
|
10565 | 161 |
|
162 |
#------------------------------------------------------------------------ |
|
163 |
# Compiler flags |
|
164 |
||
165 |
# position-independent code |
|
166 |
PICFLAG = -fPIC |
|
167 |
||
168 |
VM_PICFLAG/LIBJVM = $(PICFLAG) |
|
169 |
VM_PICFLAG/AOUT = |
|
170 |
VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) |
|
171 |
||
12156
fb31de03f649
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
11955
diff
changeset
|
172 |
ifeq ($(JVM_VARIANT_ZERO), true) |
fb31de03f649
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
11955
diff
changeset
|
173 |
CFLAGS += $(LIBFFI_CFLAGS) |
10565 | 174 |
endif |
12156
fb31de03f649
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
11955
diff
changeset
|
175 |
ifeq ($(JVM_VARIANT_ZEROSHARK), true) |
fb31de03f649
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
11955
diff
changeset
|
176 |
CFLAGS += $(LIBFFI_CFLAGS) |
fb31de03f649
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
11955
diff
changeset
|
177 |
CFLAGS += $(LLVM_CFLAGS) |
10565 | 178 |
endif |
179 |
CFLAGS += $(VM_PICFLAG) |
|
180 |
CFLAGS += -fno-rtti |
|
181 |
CFLAGS += -fno-exceptions |
|
17880 | 182 |
ifeq ($(USE_CLANG),) |
183 |
CFLAGS += -pthread |
|
184 |
CFLAGS += -fcheck-new |
|
185 |
# version 4 and above support fvisibility=hidden (matches jni_x86.h file) |
|
186 |
# except 4.1.2 gives pointless warnings that can't be disabled (afaik) |
|
187 |
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" |
|
188 |
CFLAGS += -fvisibility=hidden |
|
189 |
endif |
|
190 |
else |
|
191 |
CFLAGS += -fvisibility=hidden |
|
192 |
endif |
|
193 |
||
194 |
ifeq ($(USE_CLANG), true) |
|
195 |
# Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm' |
|
196 |
# Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment') |
|
197 |
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0" |
|
198 |
STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16 |
|
199 |
else |
|
200 |
STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16 |
|
201 |
endif |
|
10565 | 202 |
endif |
203 |
||
204 |
ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) |
|
205 |
ARCHFLAG/i486 = -m32 -march=i586 |
|
17880 | 206 |
ARCHFLAG/amd64 = -m64 $(STACK_ALIGNMENT_OPT) |
10565 | 207 |
ARCHFLAG/ia64 = |
208 |
ARCHFLAG/sparc = -m32 -mcpu=v9 |
|
209 |
ARCHFLAG/sparcv9 = -m64 -mcpu=v9 |
|
210 |
ARCHFLAG/zero = $(ZERO_ARCHFLAG) |
|
211 |
||
212 |
# Darwin-specific build flags |
|
213 |
ifeq ($(OS_VENDOR), Darwin) |
|
214 |
# Ineffecient 16-byte stack re-alignment on Darwin/IA32 |
|
215 |
ARCHFLAG/i486 += -mstackrealign |
|
216 |
endif |
|
217 |
||
218 |
CFLAGS += $(ARCHFLAG) |
|
219 |
AOUT_FLAGS += $(ARCHFLAG) |
|
220 |
LFLAGS += $(ARCHFLAG) |
|
221 |
ASFLAGS += $(ARCHFLAG) |
|
222 |
||
223 |
ifdef E500V2 |
|
224 |
CFLAGS += -DE500V2 |
|
225 |
endif |
|
226 |
||
227 |
# Use C++ Interpreter |
|
228 |
ifdef CC_INTERP |
|
229 |
CFLAGS += -DCC_INTERP |
|
230 |
endif |
|
231 |
||
232 |
# Keep temporary files (.ii, .s) |
|
233 |
ifdef NEED_ASM |
|
234 |
CFLAGS += -save-temps |
|
235 |
else |
|
236 |
CFLAGS += -pipe |
|
237 |
endif |
|
238 |
||
239 |
# Compiler warnings are treated as errors |
|
10739 | 240 |
ifneq ($(COMPILER_WARNINGS_FATAL),false) |
241 |
WARNINGS_ARE_ERRORS = -Werror |
|
242 |
endif |
|
10565 | 243 |
|
17880 | 244 |
ifeq ($(USE_CLANG), true) |
245 |
# However we need to clean the code up before we can unrestrictedly enable this option with Clang |
|
246 |
WARNINGS_ARE_ERRORS += -Wno-unused-value -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses |
|
247 |
WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-compare |
|
248 |
# Not yet supported by clang in Xcode 4.6.2 |
|
249 |
# WARNINGS_ARE_ERRORS += -Wno-tautological-constant-out-of-range-compare |
|
250 |
WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess |
|
19336
ddceb0657500
8022956: Clang: enable return type warnings on BSD
twisti
parents:
18431
diff
changeset
|
251 |
WARNINGS_ARE_ERRORS += -Wno-empty-body |
17880 | 252 |
endif |
253 |
||
15938 | 254 |
WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef |
17880 | 255 |
|
256 |
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" |
|
257 |
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit |
|
258 |
# conversions which might affect the values. Only enable it in earlier versions. |
|
259 |
WARNING_FLAGS = -Wunused-function |
|
260 |
ifeq ($(USE_CLANG),) |
|
261 |
WARNINGS_FLAGS += -Wconversion |
|
262 |
endif |
|
10565 | 263 |
endif |
264 |
||
15938 | 265 |
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) |
10565 | 266 |
# Special cases |
267 |
CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) |
|
268 |
# XXXDARWIN: for _dyld_bind_fully_image_containing_address |
|
269 |
ifeq ($(OS_VENDOR), Darwin) |
|
270 |
CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations |
|
271 |
endif |
|
272 |
||
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
273 |
OPT_CFLAGS/SIZE=-Os |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
274 |
OPT_CFLAGS/SPEED=-O3 |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
275 |
|
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
276 |
# Hotspot uses very unstrict aliasing turn this optimization off |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
277 |
# This option is added to CFLAGS rather than OPT_CFLAGS |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
278 |
# so that OPT_CFLAGS overrides get this option too. |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
279 |
CFLAGS += -fno-strict-aliasing |
10565 | 280 |
|
281 |
# The flags to use for an Optimized g++ build |
|
10739 | 282 |
ifeq ($(OS_VENDOR), Darwin) |
283 |
# use -Os by default, unless -O3 can be proved to be worth the cost, as per policy |
|
284 |
# <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers> |
|
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
285 |
OPT_CFLAGS_DEFAULT ?= SIZE |
10739 | 286 |
else |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
287 |
OPT_CFLAGS_DEFAULT ?= SPEED |
10739 | 288 |
endif |
10565 | 289 |
|
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
290 |
ifdef OPT_CFLAGS |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
291 |
ifneq ("$(origin OPT_CFLAGS)", "command line") |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
292 |
$(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
293 |
endif |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
294 |
endif |
10565 | 295 |
|
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
296 |
OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
297 |
|
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
298 |
# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp |
10565 | 299 |
# if we use expensive-optimizations |
300 |
ifeq ($(BUILDARCH), ia64) |
|
301 |
OPT_CFLAGS += -fno-expensive-optimizations |
|
302 |
endif |
|
303 |
||
304 |
OPT_CFLAGS/NOOPT=-O0 |
|
305 |
||
17880 | 306 |
# Work around some compiler bugs. |
307 |
ifeq ($(USE_CLANG), true) |
|
308 |
ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1) |
|
309 |
OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) |
|
19693
633580a41062
8022407: sun/misc/CopyMemory.java fails with SIGSEGV in Unsafe_SetByte+0x35
hseigel
parents:
19336
diff
changeset
|
310 |
OPT_CFLAGS/unsafe.o += -01 |
17880 | 311 |
endif |
312 |
else |
|
313 |
# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. |
|
314 |
ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) |
|
315 |
OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT) |
|
316 |
endif |
|
10565 | 317 |
endif |
318 |
||
319 |
# Flags for generating make dependency flags. |
|
17880 | 320 |
DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) |
321 |
ifeq ($(USE_CLANG),) |
|
322 |
ifneq ($(CC_VER_MAJOR), 2) |
|
323 |
DEPFLAGS += -fpch-deps |
|
324 |
endif |
|
10565 | 325 |
endif |
326 |
||
327 |
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. |
|
11205
f07e6dd70a1f
7116081: USE_PRECOMPILED_HEADER=0 triggers a single threaded build of the JVM
stefank
parents:
10830
diff
changeset
|
328 |
ifeq ($(USE_PRECOMPILED_HEADER),0) |
10565 | 329 |
CFLAGS += -DDONT_USE_PRECOMPILED_HEADER |
330 |
endif |
|
331 |
||
15862 | 332 |
ifeq ($(OS_VENDOR), Darwin) |
333 |
# Setting these parameters makes it an error to link to macosx APIs that are |
|
334 |
# newer than the given OS version and makes the linked binaries compatible even |
|
335 |
# if built on a newer version of the OS. |
|
336 |
# The expected format is X.Y.Z |
|
337 |
ifeq ($(MACOSX_VERSION_MIN),) |
|
338 |
MACOSX_VERSION_MIN=10.7.0 |
|
339 |
endif |
|
340 |
# The macro takes the version with no dots, ex: 1070 |
|
341 |
CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \ |
|
342 |
-mmacosx-version-min=$(MACOSX_VERSION_MIN) |
|
343 |
LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) |
|
344 |
endif |
|
345 |
||
10565 | 346 |
#------------------------------------------------------------------------ |
347 |
# Linker flags |
|
348 |
||
349 |
# statically link libstdc++.so, work with gcc but ignored by g++ |
|
350 |
STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic |
|
351 |
||
17880 | 352 |
ifeq ($(USE_CLANG),) |
353 |
# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. |
|
354 |
ifneq ("${CC_VER_MAJOR}", "2") |
|
355 |
STATIC_LIBGCC += -static-libgcc |
|
356 |
endif |
|
10565 | 357 |
|
17880 | 358 |
ifeq ($(BUILDARCH), ia64) |
359 |
LFLAGS += -Wl,-relax |
|
360 |
endif |
|
10565 | 361 |
endif |
362 |
||
363 |
# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. |
|
364 |
MAPFLAG = -Xlinker --version-script=FILENAME |
|
365 |
||
366 |
# |
|
367 |
# Shared Library |
|
368 |
# |
|
369 |
ifeq ($(OS_VENDOR), Darwin) |
|
370 |
# Standard linker flags |
|
371 |
LFLAGS += |
|
372 |
||
18431 | 373 |
# The apple linker has its own variant of mapfiles/version-scripts |
374 |
MAPFLAG = -Xlinker -exported_symbols_list -Xlinker FILENAME |
|
10565 | 375 |
|
376 |
# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj |
|
377 |
SONAMEFLAG = |
|
378 |
||
379 |
# Build shared library |
|
10739 | 380 |
SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG) |
10565 | 381 |
|
382 |
# Keep symbols even they are not used |
|
383 |
#AOUT_FLAGS += -Xlinker -export-dynamic |
|
384 |
else |
|
385 |
# Enable linker optimization |
|
386 |
LFLAGS += -Xlinker -O1 |
|
387 |
||
388 |
# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj |
|
389 |
SONAMEFLAG = -Xlinker -soname=SONAME |
|
390 |
||
391 |
# Build shared library |
|
392 |
SHARED_FLAG = -shared $(VM_PICFLAG) |
|
393 |
||
394 |
# Keep symbols even they are not used |
|
395 |
AOUT_FLAGS += -Xlinker -export-dynamic |
|
396 |
endif |
|
397 |
||
398 |
#------------------------------------------------------------------------ |
|
399 |
# Debug flags |
|
400 |
||
17880 | 401 |
ifeq ($(USE_CLANG), true) |
402 |
# Restrict the debug information created by Clang to avoid |
|
403 |
# too big object files and speed the build up a little bit |
|
404 |
# (see http://llvm.org/bugs/show_bug.cgi?id=7554) |
|
405 |
CFLAGS += -flimit-debug-info |
|
10565 | 406 |
endif |
407 |
||
17880 | 408 |
# DEBUG_BINARIES uses full -g debug information for all configs |
10565 | 409 |
ifeq ($(DEBUG_BINARIES), true) |
17880 | 410 |
CFLAGS += -g |
411 |
else |
|
412 |
# Use the stabs format for debugging information (this is the default |
|
413 |
# on gcc-2.91). It's good enough, has all the information about line |
|
414 |
# numbers and local variables, and libjvm.so is only about 16M. |
|
415 |
# Change this back to "-g" if you want the most expressive format. |
|
416 |
# (warning: that could easily inflate libjvm.so to 150M!) |
|
417 |
# Note: The Itanium gcc compiler crashes when using -gstabs. |
|
418 |
DEBUG_CFLAGS/ia64 = -g |
|
419 |
DEBUG_CFLAGS/amd64 = -g |
|
420 |
DEBUG_CFLAGS/arm = -g |
|
421 |
DEBUG_CFLAGS/ppc = -g |
|
422 |
DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) |
|
423 |
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) |
|
424 |
DEBUG_CFLAGS += -gstabs |
|
425 |
endif |
|
10565 | 426 |
endif |
427 |
||
428 |
# If we are building HEADLESS, pass on to VM |
|
429 |
# so it can set the java.awt.headless property |
|
430 |
ifdef HEADLESS |
|
431 |
CFLAGS += -DHEADLESS |
|
432 |
endif |
|
433 |
||
434 |
# We are building Embedded for a small device |
|
435 |
# favor code space over speed |
|
436 |
ifdef MINIMIZE_RAM_USAGE |
|
437 |
CFLAGS += -DMINIMIZE_RAM_USAGE |
|
438 |
endif |