0N/A#
3364N/A# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
0N/A# published by the Free Software Foundation.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
1472N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A# or visit www.oracle.com if you need additional information or have any
1472N/A# questions.
0N/A#
0N/A#
0N/A
0N/A#------------------------------------------------------------------------
3178N/A# CC, CXX & AS
0N/A
3568N/A# If a SPEC is not set already, then use these defaults.
3568N/Aifeq ($(SPEC),)
3568N/A # When cross-compiling the ALT_COMPILER_PATH points
3568N/A # to the cross-compilation toolset
3568N/A ifdef CROSS_COMPILE_ARCH
3568N/A CXX = $(ALT_COMPILER_PATH)/g++
3568N/A CC = $(ALT_COMPILER_PATH)/gcc
3568N/A HOSTCXX = g++
3568N/A HOSTCC = gcc
3568N/A STRIP = $(ALT_COMPILER_PATH)/strip
3568N/A else
3568N/A CXX = g++
3568N/A CC = gcc
3568N/A HOSTCXX = $(CXX)
3568N/A HOSTCC = $(CC)
3568N/A STRIP = strip
3568N/A endif
3568N/A AS = $(CC) -c
1601N/Aendif
1601N/A
0N/A
0N/A# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
0N/A# prints the numbers (e.g. "2.95", "3.2.1")
0N/ACC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
0N/ACC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
0N/A
0N/A# check for precompiled headers support
0N/Aifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
1890N/A# Allow the user to turn off precompiled headers from the command line.
1890N/Aifneq ($(USE_PRECOMPILED_HEADER),0)
0N/APRECOMPILED_HEADER_DIR=.
2871N/APRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
1879N/APRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
0N/Aendif
1890N/Aendif
0N/A
0N/A
0N/A#------------------------------------------------------------------------
0N/A# Compiler flags
0N/A
0N/A# position-independent code
0N/APICFLAG = -fPIC
0N/A
0N/AVM_PICFLAG/LIBJVM = $(PICFLAG)
0N/AVM_PICFLAG/AOUT =
0N/AVM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
0N/A
3617N/Aifeq ($(JVM_VARIANT_ZERO), true)
1010N/ACFLAGS += $(LIBFFI_CFLAGS)
1010N/Aendif
3617N/Aifeq ($(JVM_VARIANT_ZEROSHARK), true)
3617N/ACFLAGS += $(LIBFFI_CFLAGS)
1612N/ACFLAGS += $(LLVM_CFLAGS)
1612N/Aendif
0N/ACFLAGS += $(VM_PICFLAG)
0N/ACFLAGS += -fno-rtti
0N/ACFLAGS += -fno-exceptions
0N/ACFLAGS += -D_REENTRANT
0N/ACFLAGS += -fcheck-new
2072N/A# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
2072N/A# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
2072N/Aifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
2072N/ACFLAGS += -fvisibility=hidden
2072N/Aendif
0N/A
0N/AARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
0N/AARCHFLAG/i486 = -m32 -march=i586
0N/AARCHFLAG/amd64 = -m64
0N/AARCHFLAG/ia64 =
0N/AARCHFLAG/sparc = -m32 -mcpu=v9
0N/AARCHFLAG/sparcv9 = -m64 -mcpu=v9
1601N/AARCHFLAG/arm = -fsigned-char
1010N/AARCHFLAG/zero = $(ZERO_ARCHFLAG)
1601N/Aifndef E500V2
1601N/AARCHFLAG/ppc = -mcpu=powerpc
1601N/Aendif
0N/A
0N/ACFLAGS += $(ARCHFLAG)
0N/AAOUT_FLAGS += $(ARCHFLAG)
0N/ALFLAGS += $(ARCHFLAG)
0N/AASFLAGS += $(ARCHFLAG)
0N/A
1601N/Aifdef E500V2
1601N/ACFLAGS += -DE500V2
1601N/Aendif
1601N/A
0N/A# Use C++ Interpreter
0N/Aifdef CC_INTERP
0N/A CFLAGS += -DCC_INTERP
0N/Aendif
0N/A
1601N/A# Build for embedded targets
1601N/Aifdef JAVASE_EMBEDDED
1601N/A CFLAGS += -DJAVASE_EMBEDDED
1601N/Aendif
1601N/A
0N/A# Keep temporary files (.ii, .s)
0N/Aifdef NEED_ASM
0N/A CFLAGS += -save-temps
0N/Aelse
0N/A CFLAGS += -pipe
0N/Aendif
0N/A
0N/A# Compiler warnings are treated as errors
0N/AWARNINGS_ARE_ERRORS = -Werror
229N/A
0N/A# Except for a few acceptable ones
229N/A# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
229N/A# conversions which might affect the values. To avoid that, we need to turn
229N/A# it off explicitly.
229N/Aifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
229N/AACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare
229N/Aelse
0N/AACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
229N/Aendif
229N/A
0N/ACFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
0N/A# Special cases
0N/ACFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
0N/A
0N/A# The flags to use for an Optimized g++ build
0N/AOPT_CFLAGS += -O3
0N/A
0N/A# Hotspot uses very unstrict aliasing turn this optimization off
0N/AOPT_CFLAGS += -fno-strict-aliasing
0N/A
0N/A# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
0N/A# if we use expensive-optimizations
0N/Aifeq ($(BUILDARCH), ia64)
0N/AOPT_CFLAGS += -fno-expensive-optimizations
0N/Aendif
0N/A
0N/AOPT_CFLAGS/NOOPT=-O0
0N/A
744N/A# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
744N/Aifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
744N/AOPT_CFLAGS/mulnode.o += -O0
744N/Aendif
744N/A
1879N/A# Flags for generating make dependency flags.
1879N/Aifneq ("${CC_VER_MAJOR}", "2")
3796N/ADEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
1879N/Aendif
1879N/A
1890N/A# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
2972N/Aifeq ($(USE_PRECOMPILED_HEADER),0)
1890N/ACFLAGS += -DDONT_USE_PRECOMPILED_HEADER
1890N/Aendif
1890N/A
0N/A#------------------------------------------------------------------------
0N/A# Linker flags
0N/A
0N/A# statically link libstdc++.so, work with gcc but ignored by g++
0N/ASTATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
0N/A
0N/A# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
0N/Aifneq ("${CC_VER_MAJOR}", "2")
0N/ASTATIC_LIBGCC += -static-libgcc
0N/Aendif
0N/A
0N/Aifeq ($(BUILDARCH), ia64)
0N/ALFLAGS += -Wl,-relax
0N/Aendif
0N/A
0N/A# Enable linker optimization
0N/ALFLAGS += -Xlinker -O1
0N/A
576N/A# If this is a --hash-style=gnu system, use --hash-style=both
576N/A# The gnu .hash section won't work on some Linux systems like SuSE 10.
576N/A_HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu')
576N/Aifneq ($(_HAS_HASH_STYLE_GNU),)
576N/A LDFLAGS_HASH_STYLE = -Wl,--hash-style=both
576N/Aendif
576N/ALFLAGS += $(LDFLAGS_HASH_STYLE)
576N/A
0N/A# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
0N/AMAPFLAG = -Xlinker --version-script=FILENAME
0N/A
0N/A# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
0N/ASONAMEFLAG = -Xlinker -soname=SONAME
0N/A
0N/A# Build shared library
0N/ASHARED_FLAG = -shared
0N/A
0N/A# Keep symbols even they are not used
2404N/AAOUT_FLAGS += -Xlinker -export-dynamic
0N/A
0N/A#------------------------------------------------------------------------
0N/A# Debug flags
0N/A
3952N/A# DEBUG_BINARIES uses full -g debug information for all configs
3952N/Aifeq ($(DEBUG_BINARIES), true)
3952N/A CFLAGS += -g
3952N/Aelse
3952N/A # Use the stabs format for debugging information (this is the default
3952N/A # on gcc-2.91). It's good enough, has all the information about line
3952N/A # numbers and local variables, and libjvm_g.so is only about 16M.
3952N/A # Change this back to "-g" if you want the most expressive format.
3952N/A # (warning: that could easily inflate libjvm_g.so to 150M!)
3952N/A # Note: The Itanium gcc compiler crashes when using -gstabs.
3952N/A DEBUG_CFLAGS/ia64 = -g
3952N/A DEBUG_CFLAGS/amd64 = -g
3952N/A DEBUG_CFLAGS/arm = -g
3952N/A DEBUG_CFLAGS/ppc = -g
3952N/A DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
3952N/A ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
3952N/A DEBUG_CFLAGS += -gstabs
2790N/A endif
3952N/A
3952N/A ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
3952N/A FASTDEBUG_CFLAGS/ia64 = -g
3952N/A FASTDEBUG_CFLAGS/amd64 = -g
3952N/A FASTDEBUG_CFLAGS/arm = -g
3952N/A FASTDEBUG_CFLAGS/ppc = -g
3952N/A FASTDEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
3952N/A ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
3952N/A FASTDEBUG_CFLAGS += -gstabs
3952N/A endif
3952N/A
3952N/A OPT_CFLAGS/ia64 = -g
3952N/A OPT_CFLAGS/amd64 = -g
3952N/A OPT_CFLAGS/arm = -g
3952N/A OPT_CFLAGS/ppc = -g
3952N/A OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
3952N/A ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
3952N/A OPT_CFLAGS += -gstabs
3952N/A endif
2790N/A endif
2790N/Aendif
2790N/A
1601N/A# If we are building HEADLESS, pass on to VM
1601N/A# so it can set the java.awt.headless property
1601N/Aifdef HEADLESS
1601N/ACFLAGS += -DHEADLESS
1601N/Aendif
1601N/A
1601N/A# We are building Embedded for a small device
1601N/A# favor code space over speed
1601N/Aifdef MINIMIZE_RAM_USAGE
1601N/ACFLAGS += -DMINIMIZE_RAM_USAGE
1601N/Aendif