gcc.make revision 2871
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# This code is free software; you can redistribute it and/or modify it
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# under the terms of the GNU General Public License version 2 only, as
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# published by the Free Software Foundation.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# This code is distributed in the hope that it will be useful, but WITHOUT
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# version 2 for more details (a copy is included in the LICENSE file that
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# accompanied this code).
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# You should have received a copy of the GNU General Public License version
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# 2 along with this work; if not, write to the Free Software Foundation,
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# or visit www.oracle.com if you need additional information or have any
f38cb554a534c6df738be3f4d23327e69888e634John Wren KennedyOS_VENDOR = $(shell uname -s)
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy#------------------------------------------------------------------------
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# When cross-compiling the ALT_COMPILER_PATH points
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# to the cross-compilation toolset
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedyifdef CROSS_COMPILE_ARCH
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy CPP = $(ALT_COMPILER_PATH)/g++
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy CC = $(ALT_COMPILER_PATH)/gcc
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedyelse ifneq ($(OS_VENDOR), Darwin)
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy HOSTCPP = $(CPP)
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy HOSTCC = $(CC)
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# i486 hotspot requires -mstackrealign on Darwin.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# llvm-gcc supports this in Xcode 3.2.6 and 4.0.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# gcc-4.0 supports this on earlier versions.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy# Prefer llvm-gcc where available.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedyifeq ($(OS_VENDOR), Darwin)
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy ifeq ($(origin CXX), default)
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy CXX = llvm-g++
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy ifeq ($(origin CC), default)
# prints the numbers (e.g. "2.95", "3.2.1")
CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
VM_PICFLAG/LIBJVM = $(PICFLAG)
# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
ARCHFLAG/i486 = -m32 -march=i586
ARCHFLAG/amd64 = -m64
ARCHFLAG/sparc = -m32 -mcpu=v9
ARCHFLAG/sparcv9 = -m64 -mcpu=v9
ARCHFLAG/zero = $(ZERO_ARCHFLAG)
# Ineffecient 16-byte stack re-alignment on Darwin/IA32
ARCHFLAG/i486 += -mstackrealign
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
OPT_CFLAGS/NOOPT=-O0
# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
OPT_CFLAGS/mulnode.o += -O0
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG)
# numbers and local variables, and libjvm_g.so is only about 16M.
# (warning: that could easily inflate libjvm_g.so to 150M!)
DEBUG_CFLAGS/ia64 = -g
DEBUG_CFLAGS/amd64 = -g
DEBUG_CFLAGS/arm = -g
DEBUG_CFLAGS/ppc = -g
# so it can set the java.awt.headless property