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