1 #
2 # Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
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 #
134 # Darwin-specific build flags
135 ifeq ($(OS_VENDOR), Darwin)
136 # Ineffecient 16-byte stack re-alignment on Darwin/IA32
137 ARCHFLAG/i486 += -mstackrealign
138 endif
139
140 CFLAGS += $(ARCHFLAG)
141 AOUT_FLAGS += $(ARCHFLAG)
142 LFLAGS += $(ARCHFLAG)
143 ASFLAGS += $(ARCHFLAG)
144
145 ifdef E500V2
146 CFLAGS += -DE500V2
147 endif
148
149 # Use C++ Interpreter
150 ifdef CC_INTERP
151 CFLAGS += -DCC_INTERP
152 endif
153
154 # Build for embedded targets
155 ifdef JAVASE_EMBEDDED
156 CFLAGS += -DJAVASE_EMBEDDED
157 endif
158
159 # Keep temporary files (.ii, .s)
160 ifdef NEED_ASM
161 CFLAGS += -save-temps
162 else
163 CFLAGS += -pipe
164 endif
165
166 # Compiler warnings are treated as errors
167 ifneq ($(COMPILER_WARNINGS_FATAL),false)
168 WARNINGS_ARE_ERRORS = -Werror
169 endif
170
171 # Except for a few acceptable ones
172 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
173 # conversions which might affect the values. To avoid that, we need to turn
174 # it off explicitly.
175 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
176 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare
177 else
178 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
179 endif
180
181 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
182 # Special cases
183 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
184 # XXXDARWIN: for _dyld_bind_fully_image_containing_address
185 ifeq ($(OS_VENDOR), Darwin)
186 CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations
187 endif
188
189
190 # The flags to use for an Optimized g++ build
191 ifeq ($(OS_VENDOR), Darwin)
192 # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy
193 # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers>
194 OPT_CFLAGS += -Os
195 else
196 OPT_CFLAGS += -O3
197 endif
198
199 # Hotspot uses very unstrict aliasing turn this optimization off
200 OPT_CFLAGS += -fno-strict-aliasing
201
202 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
203 # if we use expensive-optimizations
204 ifeq ($(BUILDARCH), ia64)
205 OPT_CFLAGS += -fno-expensive-optimizations
206 endif
207
208 OPT_CFLAGS/NOOPT=-O0
209
210 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
211 ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
212 OPT_CFLAGS/mulnode.o += -O0
213 endif
214
215 # Flags for generating make dependency flags.
216 ifneq ("${CC_VER_MAJOR}", "2")
217 DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
218 endif
219
220 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
221 ifeq ($(USE_PRECOMPILED_HEADER),0)
222 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
223 endif
224
225 #------------------------------------------------------------------------
226 # Linker flags
227
|
1 #
2 # Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
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 #
134 # Darwin-specific build flags
135 ifeq ($(OS_VENDOR), Darwin)
136 # Ineffecient 16-byte stack re-alignment on Darwin/IA32
137 ARCHFLAG/i486 += -mstackrealign
138 endif
139
140 CFLAGS += $(ARCHFLAG)
141 AOUT_FLAGS += $(ARCHFLAG)
142 LFLAGS += $(ARCHFLAG)
143 ASFLAGS += $(ARCHFLAG)
144
145 ifdef E500V2
146 CFLAGS += -DE500V2
147 endif
148
149 # Use C++ Interpreter
150 ifdef CC_INTERP
151 CFLAGS += -DCC_INTERP
152 endif
153
154 # Keep temporary files (.ii, .s)
155 ifdef NEED_ASM
156 CFLAGS += -save-temps
157 else
158 CFLAGS += -pipe
159 endif
160
161 # Compiler warnings are treated as errors
162 ifneq ($(COMPILER_WARNINGS_FATAL),false)
163 WARNINGS_ARE_ERRORS = -Werror
164 endif
165
166 # Except for a few acceptable ones
167 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
168 # conversions which might affect the values. To avoid that, we need to turn
169 # it off explicitly.
170 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
171 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare
172 else
173 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
174 endif
175
176 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
177 # Special cases
178 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
179 # XXXDARWIN: for _dyld_bind_fully_image_containing_address
180 ifeq ($(OS_VENDOR), Darwin)
181 CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations
182 endif
183
184 OPT_CFLAGS/SIZE=-Os
185 OPT_CFLAGS/SPEED=-O3
186
187 # Hotspot uses very unstrict aliasing turn this optimization off
188 OPT_EXTRAS += -fno-strict-aliasing
189
190 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
191 # if we use expensive-optimizations
192 ifeq ($(BUILDARCH), ia64)
193 OPT_EXTRAS += -fno-expensive-optimizations
194 endif
195
196 # The flags to use for an Optimized g++ build
197 ifeq ($(OS_VENDOR), Darwin)
198 # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy
199 # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers>
200 OPT_CFLAGS_DEFAULT ?= SIZE
201 else
202 OPT_CFLAGS_DEFAULT ?= SPEED
203 endif
204
205 ifdef OPT_CFLAGS
206 $(error "Use OPT_CFLAGS_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS")
207 endif
208
209 OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
210
211 OPT_CFLAGS/NOOPT=-O0
212
213 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
214 ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
215 OPT_CFLAGS/mulnode.o += -O0
216 endif
217
218 # Flags for generating make dependency flags.
219 ifneq ("${CC_VER_MAJOR}", "2")
220 DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
221 endif
222
223 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
224 ifeq ($(USE_PRECOMPILED_HEADER),0)
225 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
226 endif
227
228 #------------------------------------------------------------------------
229 # Linker flags
230
|