annotate build/solaris/makefiles/gcc.make @ 0:a61af66fc99e

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children
rev   line source
duke@0 1 #
duke@0 2 # Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 #
duke@0 5 # This code is free software; you can redistribute it and/or modify it
duke@0 6 # under the terms of the GNU General Public License version 2 only, as
duke@0 7 # published by the Free Software Foundation.
duke@0 8 #
duke@0 9 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 # accompanied this code).
duke@0 14 #
duke@0 15 # You should have received a copy of the GNU General Public License version
duke@0 16 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 #
duke@0 19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 # have any questions.
duke@0 22 #
duke@0 23 #
duke@0 24
duke@0 25 #------------------------------------------------------------------------
duke@0 26 # CC, CPP & AS
duke@0 27
duke@0 28 CPP = g++
duke@0 29 CC = gcc
duke@0 30 AS = $(CC) -c
duke@0 31
duke@0 32 Compiler = gcc
duke@0 33
duke@0 34 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
duke@0 35 # prints the numbers (e.g. "2.95", "3.2.1")
duke@0 36 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
duke@0 37 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
duke@0 38
duke@0 39 # Check for the versions of C++ and C compilers ($CPP and $CC) used.
duke@0 40
duke@0 41 # Get the last thing on the line that looks like x.x+ (x is a digit).
duke@0 42 COMPILER_REV := \
duke@0 43 $(shell $(CPP) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
duke@0 44 C_COMPILER_REV := \
duke@0 45 $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
duke@0 46
duke@0 47
duke@0 48 # check for precompiled headers support
duke@0 49 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
duke@0 50 USE_PRECOMPILED_HEADER=1
duke@0 51 PRECOMPILED_HEADER_DIR=.
duke@0 52 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/incls/_precompiled.incl.gch
duke@0 53 endif
duke@0 54
duke@0 55
duke@0 56 #------------------------------------------------------------------------
duke@0 57 # Compiler flags
duke@0 58
duke@0 59 # position-independent code
duke@0 60 PICFLAG = -fPIC
duke@0 61
duke@0 62 VM_PICFLAG/LIBJVM = $(PICFLAG)
duke@0 63 VM_PICFLAG/AOUT =
duke@0 64 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
duke@0 65
duke@0 66 CFLAGS += $(VM_PICFLAG)
duke@0 67 CFLAGS += -fno-rtti
duke@0 68 CFLAGS += -fno-exceptions
duke@0 69 CFLAGS += -D_REENTRANT
duke@0 70 CFLAGS += -fcheck-new
duke@0 71
duke@0 72 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
duke@0 73
duke@0 74 ARCHFLAG/sparc = -m32 -mcpu=v9
duke@0 75 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
duke@0 76 ARCHFLAG/i486 = -m32 -march=i586
duke@0 77 ARCHFLAG/amd64 = -m64 -march=k8
duke@0 78
duke@0 79
duke@0 80 # Optional sub-directory in /usr/lib where BUILDARCH libraries are kept.
duke@0 81 ISA_DIR=$(ISA_DIR/$(BUILDARCH))
duke@0 82 ISA_DIR/amd64=/amd64
duke@0 83 ISA_DIR/i486=
duke@0 84 ISA_DIR/sparcv9=/64
duke@0 85
duke@0 86
duke@0 87 CFLAGS += $(ARCHFLAG)
duke@0 88 AOUT_FLAGS += $(ARCHFLAG)
duke@0 89 LFLAGS += $(ARCHFLAG)
duke@0 90 ASFLAGS += $(ARCHFLAG)
duke@0 91
duke@0 92 ifeq ($(BUILDARCH), amd64)
duke@0 93 ASFLAGS += -march=k8 -march=amd64
duke@0 94 LFLAGS += -march=k8
duke@0 95 endif
duke@0 96
duke@0 97
duke@0 98 # Use C++ Interpreter
duke@0 99 ifdef CC_INTERP
duke@0 100 CFLAGS += -DCC_INTERP
duke@0 101 endif
duke@0 102
duke@0 103 # Keep temporary files (.ii, .s)
duke@0 104 ifdef NEED_ASM
duke@0 105 CFLAGS += -save-temps
duke@0 106 else
duke@0 107 CFLAGS += -pipe
duke@0 108 endif
duke@0 109
duke@0 110
duke@0 111 # Compiler warnings are treated as errors
duke@0 112 WARNINGS_ARE_ERRORS = -Werror
duke@0 113 # Enable these warnings. See 'info gcc' about details on these options
duke@0 114 ADDITIONAL_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
duke@0 115 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ADDITIONAL_WARNINGS)
duke@0 116 # Special cases
duke@0 117 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
duke@0 118
duke@0 119 # The flags to use for an Optimized g++ build
duke@0 120 OPT_CFLAGS += -O3
duke@0 121
duke@0 122 # Hotspot uses very unstrict aliasing turn this optimization off
duke@0 123 OPT_CFLAGS += -fno-strict-aliasing
duke@0 124
duke@0 125 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
duke@0 126 # if we use expensive-optimizations
duke@0 127 # Note: all ia64 setting reflect the ones for linux
duke@0 128 # No actial testing was performed: there is no Solaris on ia64 presently
duke@0 129 ifeq ($(BUILDARCH), ia64)
duke@0 130 OPT_CFLAGS/bytecodeInterpreter.o += -fno-expensive-optimizations
duke@0 131 endif
duke@0 132
duke@0 133 OPT_CFLAGS/NOOPT=-O0
duke@0 134 #------------------------------------------------------------------------
duke@0 135 # Linker flags
duke@0 136
duke@0 137 # statically link libstdc++.so, work with gcc but ignored by g++
duke@0 138 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
duke@0 139
duke@0 140 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
duke@0 141 ifneq ("${CC_VER_MAJOR}", "2")
duke@0 142 STATIC_LIBGCC += -static-libgcc
duke@0 143 endif
duke@0 144
duke@0 145 ifeq ($(BUILDARCH), ia64)
duke@0 146 # Note: all ia64 setting reflect the ones for linux
duke@0 147 # No actial testing was performed: there is no Solaris on ia64 presently
duke@0 148 LFLAGS += -Wl,-relax
duke@0 149 endif
duke@0 150
duke@0 151 ifdef USE_GNULD
duke@0 152 # Enable linker optimization
duke@0 153 LFLAGS += -Xlinker -O1
duke@0 154
duke@0 155 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
duke@0 156 MAPFLAG = -Xlinker --version-script=FILENAME
duke@0 157 else
duke@0 158 MAPFLAG = -Xlinker -M -Xlinker FILENAME
duke@0 159 endif
duke@0 160
duke@0 161 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
duke@0 162 SONAMEFLAG = -Xlinker -soname=SONAME
duke@0 163
duke@0 164 # Build shared library
duke@0 165 SHARED_FLAG = -shared
duke@0 166
duke@0 167 #------------------------------------------------------------------------
duke@0 168 # Debug flags
duke@0 169
duke@0 170 # Use the stabs format for debugging information (this is the default
duke@0 171 # on gcc-2.91). It's good enough, has all the information about line
duke@0 172 # numbers and local variables, and libjvm_g.so is only about 16M.
duke@0 173 # Change this back to "-g" if you want the most expressive format.
duke@0 174 # (warning: that could easily inflate libjvm_g.so to 150M!)
duke@0 175 # Note: The Itanium gcc compiler crashes when using -gstabs.
duke@0 176 DEBUG_CFLAGS/ia64 = -g
duke@0 177 DEBUG_CFLAGS/amd64 = -g
duke@0 178 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
duke@0 179 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
duke@0 180 DEBUG_CFLAGS += -gstabs
duke@0 181 endif
duke@0 182
duke@0 183 MCS = /usr/ccs/bin/mcs