4575N/A# Copyright (c) 1999, 2013, Oracle
and/or its affiliates. All rights reserved.
2796N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2796N/A# This code is free software; you can redistribute it
and/or modify it
2796N/A# under the terms of the GNU General Public License version 2 only, as
2796N/A# published by the Free Software Foundation.
2796N/A# This code is distributed in the hope that it will be useful, but WITHOUT
2796N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2796N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2796N/A# version 2 for more details (a copy is included in the LICENSE file that
2796N/A# You should have received a copy of the GNU General Public License version
2796N/A# 2 along with this work; if not, write to the Free Software Foundation,
2796N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2796N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2796N/AOS_VENDOR = $(shell uname -s)
2796N/A#------------------------------------------------------------------------
3568N/A# If a SPEC is not set already, then use these defaults.
3568N/A # When cross-compiling the ALT_COMPILER_PATH points
3568N/A # to the cross-compilation toolset
3568N/A CXX = $(ALT_COMPILER_PATH)/g++
3568N/A CC = $(ALT_COMPILER_PATH)/gcc
3568N/A else ifneq ($(OS_VENDOR), Darwin)
3568N/A # i486 hotspot requires -mstackrealign on Darwin.
3568N/A # llvm-gcc supports this in Xcode 3.2.6 and 4.0.
3568N/A # gcc-4.0 supports this on earlier versions.
3568N/A # Prefer llvm-gcc where available.
3568N/A ifeq ($(OS_VENDOR), Darwin)
3568N/A ifeq ($(origin CXX), default)
3568N/A ifeq ($(origin CC), default)
3568N/A LLVM_SUPPORTS_STACKREALIGN := $(shell \
3568N/A [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \
3568N/A && echo true || echo false)
3568N/A ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true)
3568N/A AS = $(CC) -c -x assembler-with-cpp
2796N/A# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
2796N/ACC_VER_MAJOR := $(shell $(CC) -dumpversion | sed '
s/egcs-//' | cut -d'.' -f1)
2796N/ACC_VER_MINOR := $(shell $(CC) -dumpversion | sed '
s/egcs-//' | cut -d'.' -f2)
2796N/A# check for precompiled headers support
2796N/Aifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
2796N/A# Allow the user to turn off precompiled headers from the command line.
2796N/Aifneq ($(USE_PRECOMPILED_HEADER),0)
2796N/A#------------------------------------------------------------------------
2796N/AVM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
3617N/Aifeq ($(JVM_VARIANT_ZERO), true)
3617N/Aifeq ($(JVM_VARIANT_ZEROSHARK), true)
2796N/A# version 4 and above support fvisibility=hidden (matches
jni_x86.h file)
2796N/A# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
2796N/Aifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
2796N/ACFLAGS += -fvisibility=hidden
2796N/AARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
2796N/A# Darwin-specific build flags
2796N/A# Build for embedded targets
2796N/A CFLAGS += -DJAVASE_EMBEDDED
2796N/A# Keep temporary files (.ii, .s)
2796N/A# Compiler warnings are treated as errors
2842N/Aifneq ($(COMPILER_WARNINGS_FATAL),false)
2842N/A WARNINGS_ARE_ERRORS = -Werror
2796N/A# Except for a few acceptable ones
2796N/A# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
2796N/A# conversions which might affect the values. To avoid that, we need to turn
2796N/Aifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
2796N/AACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare
2796N/AACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
2796N/A# XXXDARWIN: for _dyld_bind_fully_image_containing_address
2796N/A# The flags to use for an Optimized g++ build
2842N/A # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy
2796N/A# Hotspot uses very unstrict aliasing turn this optimization off
2796N/AOPT_CFLAGS += -fno-strict-aliasing
2796N/A# if we use expensive-optimizations
2796N/AOPT_CFLAGS += -fno-expensive-optimizations
2796N/Aifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
2796N/A# Flags for generating make dependency flags.
2796N/Aifneq ("${CC_VER_MAJOR}", "2")
3796N/ADEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
2972N/Aifeq ($(USE_PRECOMPILED_HEADER),0)
2796N/ACFLAGS += -DDONT_USE_PRECOMPILED_HEADER
2796N/A#------------------------------------------------------------------------
2796N/A# statically link libstdc++.so, work with gcc but ignored by g++
2796N/ASTATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
2796N/Aifneq ("${CC_VER_MAJOR}", "2")
2796N/ASTATIC_LIBGCC += -static-libgcc
2796N/A# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
2796N/AMAPFLAG = -Xlinker --version-script=FILENAME
4575N/A MAPFLAG = -Xlinker -exported_symbols_list -Xlinker FILENAME
2796N/A # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
2842N/A SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG)
2796N/A # Keep symbols even they are not used
2796N/A #AOUT_FLAGS += -Xlinker -export-dynamic
2796N/A # Enable linker optimization
2796N/A # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
2796N/A SONAMEFLAG = -Xlinker -soname=SONAME
2796N/A SHARED_FLAG = -shared $(VM_PICFLAG)
2796N/A # Keep symbols even they are not used
2796N/A AOUT_FLAGS += -Xlinker -export-dynamic
2796N/A#------------------------------------------------------------------------
2796N/A# Use the stabs format for debugging information (this is the default
2796N/A# on gcc-2.91). It's good enough, has all the information about line
2796N/A# Change this back to "-g" if you want the most expressive format.
2796N/A# Note: The Itanium gcc compiler crashes when using -gstabs.
2796N/ADEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
2796N/Aifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
2796N/A# DEBUG_BINARIES overrides everything, use full -g debug information
2796N/Aifeq ($(DEBUG_BINARIES), true)
2796N/A# If we are building HEADLESS, pass on to VM
2796N/A# We are building Embedded for a small device
2796N/A# favor code space over speed
2796N/ACFLAGS += -DMINIMIZE_RAM_USAGE