gcc.make revision 3178
306N/A#
306N/A# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
306N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
306N/A#
306N/A# This code is free software; you can redistribute it and/or modify it
306N/A# under the terms of the GNU General Public License version 2 only, as
306N/A# published by the Free Software Foundation.
306N/A#
306N/A# This code is distributed in the hope that it will be useful, but WITHOUT
306N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
306N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
306N/A# version 2 for more details (a copy is included in the LICENSE file that
306N/A# accompanied this code).
306N/A#
306N/A# You should have received a copy of the GNU General Public License version
306N/A# 2 along with this work; if not, write to the Free Software Foundation,
306N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
306N/A#
306N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
306N/A# or visit www.oracle.com if you need additional information or have any
306N/A# questions.
306N/A#
306N/A#
306N/A
306N/A#------------------------------------------------------------------------
306N/A# CC, CXX & AS
306N/A
306N/ACXX = g++
306N/ACC = gcc
306N/AAS = $(CC) -c
306N/A
306N/ACompiler = gcc
306N/A
306N/A# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
306N/A# prints the numbers (e.g. "2.95", "3.2.1")
306N/ACC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
306N/ACC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
306N/A
306N/A# Check for the versions of C++ and C compilers ($CXX and $CC) used.
306N/A
306N/A# Get the last thing on the line that looks like x.x+ (x is a digit).
306N/ACOMPILER_REV := \
306N/A$(shell $(CXX) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
306N/ACC_COMPILER_REV := \
306N/A$(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
306N/A
306N/A
306N/A# check for precompiled headers support
306N/Aifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
306N/A# Allow the user to turn off precompiled headers from the command line.
306N/Aifneq ($(USE_PRECOMPILED_HEADER),0)
306N/APRECOMPILED_HEADER_DIR=.
306N/APRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
306N/APRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
306N/Aendif
306N/Aendif
306N/A
306N/A
306N/A#------------------------------------------------------------------------
306N/A# Compiler flags
306N/A
306N/A# position-independent code
306N/APICFLAG = -fPIC
306N/A
306N/AVM_PICFLAG/LIBJVM = $(PICFLAG)
306N/AVM_PICFLAG/AOUT =
306N/AVM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
306N/A
306N/ACFLAGS += $(VM_PICFLAG)
306N/ACFLAGS += -fno-rtti
306N/ACFLAGS += -fno-exceptions
306N/ACFLAGS += -D_REENTRANT
306N/ACFLAGS += -fcheck-new
306N/A
306N/AARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
306N/A
306N/AARCHFLAG/sparc = -m32 -mcpu=v9
306N/AARCHFLAG/sparcv9 = -m64 -mcpu=v9
306N/AARCHFLAG/i486 = -m32 -march=i586
306N/AARCHFLAG/amd64 = -m64 -march=k8
306N/A
306N/A
306N/A# Optional sub-directory in /usr/lib where BUILDARCH libraries are kept.
306N/AISA_DIR=$(ISA_DIR/$(BUILDARCH))
306N/AISA_DIR/amd64=/amd64
306N/AISA_DIR/i486=
306N/AISA_DIR/sparcv9=/64
306N/A
306N/A
306N/ACFLAGS += $(ARCHFLAG)
306N/AAOUT_FLAGS += $(ARCHFLAG)
306N/ALFLAGS += $(ARCHFLAG)
306N/AASFLAGS += $(ARCHFLAG)
306N/A
306N/Aifeq ($(BUILDARCH), amd64)
306N/AASFLAGS += -march=k8 -march=amd64
306N/ALFLAGS += -march=k8
306N/Aendif
306N/A
306N/A
306N/A# Use C++ Interpreter
306N/Aifdef CC_INTERP
306N/A CFLAGS += -DCC_INTERP
306N/Aendif
306N/A
306N/A# Keep temporary files (.ii, .s)
306N/Aifdef NEED_ASM
306N/A CFLAGS += -save-temps
306N/Aelse
306N/A CFLAGS += -pipe
306N/Aendif
306N/A
306N/A
306N/A# Compiler warnings are treated as errors
306N/AWARNINGS_ARE_ERRORS = -Werror
306N/A# Enable these warnings. See 'info gcc' about details on these options
306N/AADDITIONAL_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
306N/ACFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ADDITIONAL_WARNINGS)
306N/A# Special cases
306N/ACFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
306N/A
306N/A# The flags to use for an Optimized g++ build
306N/AOPT_CFLAGS += -O3
306N/A
306N/A# Hotspot uses very unstrict aliasing turn this optimization off
306N/AOPT_CFLAGS += -fno-strict-aliasing
306N/A
306N/A# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
306N/A# if we use expensive-optimizations
306N/A# Note: all ia64 setting reflect the ones for linux
306N/A# No actial testing was performed: there is no Solaris on ia64 presently
306N/Aifeq ($(BUILDARCH), ia64)
306N/AOPT_CFLAGS/bytecodeInterpreter.o += -fno-expensive-optimizations
306N/Aendif
306N/A
306N/AOPT_CFLAGS/NOOPT=-O0
306N/A
306N/A# Flags for generating make dependency flags.
308N/Aifneq ("${CC_VER_MAJOR}", "2")
306N/ADEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
306N/Aendif
306N/A
306N/A# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
306N/Aifeq ($(USE_PRECOMPILED_HEADER),0)
306N/ACFLAGS += -DDONT_USE_PRECOMPILED_HEADER
306N/Aendif
306N/A
306N/A#------------------------------------------------------------------------
306N/A# Linker flags
306N/A
306N/A# statically link libstdc++.so, work with gcc but ignored by g++
306N/ASTATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
306N/A
306N/A# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
306N/Aifneq ("${CC_VER_MAJOR}", "2")
306N/ASTATIC_LIBGCC += -static-libgcc
306N/Aendif
306N/A
306N/Aifeq ($(BUILDARCH), ia64)
306N/A# Note: all ia64 setting reflect the ones for linux
306N/A# No actial testing was performed: there is no Solaris on ia64 presently
306N/ALFLAGS += -Wl,-relax
306N/Aendif
306N/A
306N/Aifdef USE_GNULD
306N/A# Enable linker optimization
306N/ALFLAGS += -Xlinker -O1
306N/A
308N/A# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
306N/AMAPFLAG = -Xlinker --version-script=FILENAME
306N/Aelse
306N/AMAPFLAG = -Xlinker -M -Xlinker FILENAME
306N/Aendif
306N/A
306N/A# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
306N/ASONAMEFLAG = -Xlinker -soname=SONAME
306N/A
306N/A# Build shared library
306N/ASHARED_FLAG = -shared
306N/A
306N/A#------------------------------------------------------------------------
306N/A# Debug flags
306N/A
306N/A# Use the stabs format for debugging information (this is the default
306N/A# on gcc-2.91). It's good enough, has all the information about line
306N/A# numbers and local variables, and libjvm_g.so is only about 16M.
306N/A# Change this back to "-g" if you want the most expressive format.
306N/A# (warning: that could easily inflate libjvm_g.so to 150M!)
306N/A# Note: The Itanium gcc compiler crashes when using -gstabs.
306N/ADEBUG_CFLAGS/ia64 = -g
306N/ADEBUG_CFLAGS/amd64 = -g
306N/ADEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
306N/Aifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
306N/ADEBUG_CFLAGS += -gstabs
306N/Aendif
306N/A
306N/AMCS = /usr/ccs/bin/mcs
306N/A