Mercurial > hg > graal-jvmci-8
annotate make/linux/makefiles/gcc.make @ 2184:5d801e6b9a80
Imported build system changes from other repository.
author | Thomas Wuerthinger <thomas.wuerthinger@gmail.com> |
---|---|
date | Mon, 21 Feb 2011 19:17:10 +0100 |
parents | a5610f0862fe |
children | 7e88bdae86ec |
rev | line source |
---|---|
0 | 1 # |
1692 | 2 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 # | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1010
diff
changeset
|
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1010
diff
changeset
|
20 # or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1010
diff
changeset
|
21 # questions. |
0 | 22 # |
23 # | |
24 | |
25 #------------------------------------------------------------------------ | |
26 # CC, CPP & AS | |
27 | |
2020
a5610f0862fe
7005007: Refine use of ALT_COMPILER_PATH to avoid conflict with JPRT usage
dholmes
parents:
1983
diff
changeset
|
28 # When cross-compiling the ALT_COMPILER_PATH points |
a5610f0862fe
7005007: Refine use of ALT_COMPILER_PATH to avoid conflict with JPRT usage
dholmes
parents:
1983
diff
changeset
|
29 # to the cross-compilation toolset |
a5610f0862fe
7005007: Refine use of ALT_COMPILER_PATH to avoid conflict with JPRT usage
dholmes
parents:
1983
diff
changeset
|
30 ifdef CROSS_COMPILE_ARCH |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
31 CPP = $(ALT_COMPILER_PATH)/g++ |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
32 CC = $(ALT_COMPILER_PATH)/gcc |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
33 else |
0 | 34 CPP = g++ |
35 CC = gcc | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
36 endif |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
37 |
0 | 38 AS = $(CC) -c |
39 | |
40 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only | |
41 # prints the numbers (e.g. "2.95", "3.2.1") | |
42 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) | |
43 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) | |
44 | |
45 # check for precompiled headers support | |
46 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" | |
1983
c760f78e0a53
7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents:
1972
diff
changeset
|
47 # Allow the user to turn off precompiled headers from the command line. |
c760f78e0a53
7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents:
1972
diff
changeset
|
48 ifneq ($(USE_PRECOMPILED_HEADER),0) |
0 | 49 USE_PRECOMPILED_HEADER=1 |
50 PRECOMPILED_HEADER_DIR=. | |
1972 | 51 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled.hpp |
52 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch | |
0 | 53 endif |
1983
c760f78e0a53
7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents:
1972
diff
changeset
|
54 endif |
0 | 55 |
56 | |
57 #------------------------------------------------------------------------ | |
58 # Compiler flags | |
59 | |
60 # position-independent code | |
61 PICFLAG = -fPIC | |
62 | |
63 VM_PICFLAG/LIBJVM = $(PICFLAG) | |
64 VM_PICFLAG/AOUT = | |
65 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) | |
66 | |
1010 | 67 ifeq ($(ZERO_BUILD), true) |
68 CFLAGS += $(LIBFFI_CFLAGS) | |
69 endif | |
1692 | 70 ifeq ($(SHARK_BUILD), true) |
71 CFLAGS += $(LLVM_CFLAGS) | |
72 endif | |
0 | 73 CFLAGS += $(VM_PICFLAG) |
74 CFLAGS += -fno-rtti | |
75 CFLAGS += -fno-exceptions | |
76 CFLAGS += -D_REENTRANT | |
77 CFLAGS += -fcheck-new | |
2184
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2020
diff
changeset
|
78 # version 4 and above support fvisibility=hidden (matches jni_x86.h file) |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2020
diff
changeset
|
79 # except 4.1.2 gives pointless warnings that can't be disabled (afaik) |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2020
diff
changeset
|
80 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2020
diff
changeset
|
81 CFLAGS += -fvisibility=hidden |
5d801e6b9a80
Imported build system changes from other repository.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2020
diff
changeset
|
82 endif |
0 | 83 |
84 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) | |
85 ARCHFLAG/i486 = -m32 -march=i586 | |
86 ARCHFLAG/amd64 = -m64 | |
87 ARCHFLAG/ia64 = | |
88 ARCHFLAG/sparc = -m32 -mcpu=v9 | |
89 ARCHFLAG/sparcv9 = -m64 -mcpu=v9 | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
90 ARCHFLAG/arm = -fsigned-char |
1010 | 91 ARCHFLAG/zero = $(ZERO_ARCHFLAG) |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
92 ifndef E500V2 |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
93 ARCHFLAG/ppc = -mcpu=powerpc |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
94 endif |
0 | 95 |
96 CFLAGS += $(ARCHFLAG) | |
97 AOUT_FLAGS += $(ARCHFLAG) | |
98 LFLAGS += $(ARCHFLAG) | |
99 ASFLAGS += $(ARCHFLAG) | |
100 | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
101 ifdef E500V2 |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
102 CFLAGS += -DE500V2 |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
103 endif |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
104 |
0 | 105 # Use C++ Interpreter |
106 ifdef CC_INTERP | |
107 CFLAGS += -DCC_INTERP | |
108 endif | |
109 | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
110 # Build for embedded targets |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
111 ifdef JAVASE_EMBEDDED |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
112 CFLAGS += -DJAVASE_EMBEDDED |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
113 endif |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
114 |
0 | 115 # Keep temporary files (.ii, .s) |
116 ifdef NEED_ASM | |
117 CFLAGS += -save-temps | |
118 else | |
119 CFLAGS += -pipe | |
120 endif | |
121 | |
122 # Compiler warnings are treated as errors | |
123 WARNINGS_ARE_ERRORS = -Werror | |
229 | 124 |
0 | 125 # Except for a few acceptable ones |
229 | 126 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit |
127 # conversions which might affect the values. To avoid that, we need to turn | |
128 # it off explicitly. | |
129 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" | |
130 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare | |
131 else | |
0 | 132 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare |
229 | 133 endif |
134 | |
0 | 135 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS) |
136 # Special cases | |
137 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) | |
138 | |
139 # The flags to use for an Optimized g++ build | |
140 OPT_CFLAGS += -O3 | |
141 | |
142 # Hotspot uses very unstrict aliasing turn this optimization off | |
143 OPT_CFLAGS += -fno-strict-aliasing | |
144 | |
145 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp | |
146 # if we use expensive-optimizations | |
147 ifeq ($(BUILDARCH), ia64) | |
148 OPT_CFLAGS += -fno-expensive-optimizations | |
149 endif | |
150 | |
151 OPT_CFLAGS/NOOPT=-O0 | |
152 | |
744
af5d39ca39a3
6835796: Fedora 9 linux_i586-fastdebug-c2-runThese_Xcomp times out
kvn
parents:
579
diff
changeset
|
153 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. |
af5d39ca39a3
6835796: Fedora 9 linux_i586-fastdebug-c2-runThese_Xcomp times out
kvn
parents:
579
diff
changeset
|
154 ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0" |
af5d39ca39a3
6835796: Fedora 9 linux_i586-fastdebug-c2-runThese_Xcomp times out
kvn
parents:
579
diff
changeset
|
155 OPT_CFLAGS/mulnode.o += -O0 |
af5d39ca39a3
6835796: Fedora 9 linux_i586-fastdebug-c2-runThese_Xcomp times out
kvn
parents:
579
diff
changeset
|
156 endif |
af5d39ca39a3
6835796: Fedora 9 linux_i586-fastdebug-c2-runThese_Xcomp times out
kvn
parents:
579
diff
changeset
|
157 |
1972 | 158 # Flags for generating make dependency flags. |
159 ifneq ("${CC_VER_MAJOR}", "2") | |
160 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) | |
161 endif | |
162 | |
1983
c760f78e0a53
7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents:
1972
diff
changeset
|
163 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. |
c760f78e0a53
7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents:
1972
diff
changeset
|
164 ifneq ($(USE_PRECOMPILED_HEADER),1) |
c760f78e0a53
7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents:
1972
diff
changeset
|
165 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER |
c760f78e0a53
7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents:
1972
diff
changeset
|
166 endif |
c760f78e0a53
7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents:
1972
diff
changeset
|
167 |
0 | 168 #------------------------------------------------------------------------ |
169 # Linker flags | |
170 | |
171 # statically link libstdc++.so, work with gcc but ignored by g++ | |
172 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic | |
173 | |
174 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. | |
175 ifneq ("${CC_VER_MAJOR}", "2") | |
176 STATIC_LIBGCC += -static-libgcc | |
177 endif | |
178 | |
179 ifeq ($(BUILDARCH), ia64) | |
180 LFLAGS += -Wl,-relax | |
181 endif | |
182 | |
183 # Enable linker optimization | |
184 LFLAGS += -Xlinker -O1 | |
185 | |
576
69c752d99841
6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents:
235
diff
changeset
|
186 # If this is a --hash-style=gnu system, use --hash-style=both |
69c752d99841
6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents:
235
diff
changeset
|
187 # The gnu .hash section won't work on some Linux systems like SuSE 10. |
69c752d99841
6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents:
235
diff
changeset
|
188 _HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu') |
69c752d99841
6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents:
235
diff
changeset
|
189 ifneq ($(_HAS_HASH_STYLE_GNU),) |
69c752d99841
6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents:
235
diff
changeset
|
190 LDFLAGS_HASH_STYLE = -Wl,--hash-style=both |
69c752d99841
6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents:
235
diff
changeset
|
191 endif |
69c752d99841
6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents:
235
diff
changeset
|
192 LFLAGS += $(LDFLAGS_HASH_STYLE) |
69c752d99841
6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents:
235
diff
changeset
|
193 |
0 | 194 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. |
195 MAPFLAG = -Xlinker --version-script=FILENAME | |
196 | |
197 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj | |
198 SONAMEFLAG = -Xlinker -soname=SONAME | |
199 | |
200 # Build shared library | |
201 SHARED_FLAG = -shared | |
202 | |
203 # Keep symbols even they are not used | |
204 AOUT_FLAGS += -export-dynamic | |
205 | |
206 #------------------------------------------------------------------------ | |
207 # Debug flags | |
208 | |
209 # Use the stabs format for debugging information (this is the default | |
210 # on gcc-2.91). It's good enough, has all the information about line | |
211 # numbers and local variables, and libjvm_g.so is only about 16M. | |
212 # Change this back to "-g" if you want the most expressive format. | |
213 # (warning: that could easily inflate libjvm_g.so to 150M!) | |
214 # Note: The Itanium gcc compiler crashes when using -gstabs. | |
215 DEBUG_CFLAGS/ia64 = -g | |
216 DEBUG_CFLAGS/amd64 = -g | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
217 DEBUG_CFLAGS/arm = -g |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
218 DEBUG_CFLAGS/ppc = -g |
0 | 219 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) |
220 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) | |
221 DEBUG_CFLAGS += -gstabs | |
222 endif | |
767
5d4dd2f5f6a1
6829575: 100028: Debug information is incomplete or missing
aph
parents:
579
diff
changeset
|
223 |
5d4dd2f5f6a1
6829575: 100028: Debug information is incomplete or missing
aph
parents:
579
diff
changeset
|
224 # DEBUG_BINARIES overrides everything, use full -g debug information |
5d4dd2f5f6a1
6829575: 100028: Debug information is incomplete or missing
aph
parents:
579
diff
changeset
|
225 ifeq ($(DEBUG_BINARIES), true) |
5d4dd2f5f6a1
6829575: 100028: Debug information is incomplete or missing
aph
parents:
579
diff
changeset
|
226 DEBUG_CFLAGS = -g |
5d4dd2f5f6a1
6829575: 100028: Debug information is incomplete or missing
aph
parents:
579
diff
changeset
|
227 CFLAGS += $(DEBUG_CFLAGS) |
5d4dd2f5f6a1
6829575: 100028: Debug information is incomplete or missing
aph
parents:
579
diff
changeset
|
228 endif |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
229 |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
230 # If we are building HEADLESS, pass on to VM |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
231 # so it can set the java.awt.headless property |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
232 ifdef HEADLESS |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
233 CFLAGS += -DHEADLESS |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
234 endif |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
235 |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
236 # We are building Embedded for a small device |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
237 # favor code space over speed |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
238 ifdef MINIMIZE_RAM_USAGE |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
239 CFLAGS += -DMINIMIZE_RAM_USAGE |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
240 endif |