1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/solaris/makefiles/gcc.make Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,183 @@ 1.4 +# 1.5 +# Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 +# 1.8 +# This code is free software; you can redistribute it and/or modify it 1.9 +# under the terms of the GNU General Public License version 2 only, as 1.10 +# published by the Free Software Foundation. 1.11 +# 1.12 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 +# version 2 for more details (a copy is included in the LICENSE file that 1.16 +# accompanied this code). 1.17 +# 1.18 +# You should have received a copy of the GNU General Public License version 1.19 +# 2 along with this work; if not, write to the Free Software Foundation, 1.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 +# 1.22 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 +# CA 95054 USA or visit www.sun.com if you need additional information or 1.24 +# have any questions. 1.25 +# 1.26 +# 1.27 + 1.28 +#------------------------------------------------------------------------ 1.29 +# CC, CPP & AS 1.30 + 1.31 +CPP = g++ 1.32 +CC = gcc 1.33 +AS = $(CC) -c 1.34 + 1.35 +Compiler = gcc 1.36 + 1.37 +# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only 1.38 +# prints the numbers (e.g. "2.95", "3.2.1") 1.39 +CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) 1.40 +CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) 1.41 + 1.42 +# Check for the versions of C++ and C compilers ($CPP and $CC) used. 1.43 + 1.44 +# Get the last thing on the line that looks like x.x+ (x is a digit). 1.45 +COMPILER_REV := \ 1.46 +$(shell $(CPP) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) 1.47 +C_COMPILER_REV := \ 1.48 +$(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) 1.49 + 1.50 + 1.51 +# check for precompiled headers support 1.52 +ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" 1.53 +USE_PRECOMPILED_HEADER=1 1.54 +PRECOMPILED_HEADER_DIR=. 1.55 +PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/incls/_precompiled.incl.gch 1.56 +endif 1.57 + 1.58 + 1.59 +#------------------------------------------------------------------------ 1.60 +# Compiler flags 1.61 + 1.62 +# position-independent code 1.63 +PICFLAG = -fPIC 1.64 + 1.65 +VM_PICFLAG/LIBJVM = $(PICFLAG) 1.66 +VM_PICFLAG/AOUT = 1.67 +VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) 1.68 + 1.69 +CFLAGS += $(VM_PICFLAG) 1.70 +CFLAGS += -fno-rtti 1.71 +CFLAGS += -fno-exceptions 1.72 +CFLAGS += -D_REENTRANT 1.73 +CFLAGS += -fcheck-new 1.74 + 1.75 +ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) 1.76 + 1.77 +ARCHFLAG/sparc = -m32 -mcpu=v9 1.78 +ARCHFLAG/sparcv9 = -m64 -mcpu=v9 1.79 +ARCHFLAG/i486 = -m32 -march=i586 1.80 +ARCHFLAG/amd64 = -m64 -march=k8 1.81 + 1.82 + 1.83 +# Optional sub-directory in /usr/lib where BUILDARCH libraries are kept. 1.84 +ISA_DIR=$(ISA_DIR/$(BUILDARCH)) 1.85 +ISA_DIR/amd64=/amd64 1.86 +ISA_DIR/i486= 1.87 +ISA_DIR/sparcv9=/64 1.88 + 1.89 + 1.90 +CFLAGS += $(ARCHFLAG) 1.91 +AOUT_FLAGS += $(ARCHFLAG) 1.92 +LFLAGS += $(ARCHFLAG) 1.93 +ASFLAGS += $(ARCHFLAG) 1.94 + 1.95 +ifeq ($(BUILDARCH), amd64) 1.96 +ASFLAGS += -march=k8 -march=amd64 1.97 +LFLAGS += -march=k8 1.98 +endif 1.99 + 1.100 + 1.101 +# Use C++ Interpreter 1.102 +ifdef CC_INTERP 1.103 + CFLAGS += -DCC_INTERP 1.104 +endif 1.105 + 1.106 +# Keep temporary files (.ii, .s) 1.107 +ifdef NEED_ASM 1.108 + CFLAGS += -save-temps 1.109 +else 1.110 + CFLAGS += -pipe 1.111 +endif 1.112 + 1.113 + 1.114 +# Compiler warnings are treated as errors 1.115 +WARNINGS_ARE_ERRORS = -Werror 1.116 +# Enable these warnings. See 'info gcc' about details on these options 1.117 +ADDITIONAL_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare 1.118 +CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ADDITIONAL_WARNINGS) 1.119 +# Special cases 1.120 +CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) 1.121 + 1.122 +# The flags to use for an Optimized g++ build 1.123 +OPT_CFLAGS += -O3 1.124 + 1.125 +# Hotspot uses very unstrict aliasing turn this optimization off 1.126 +OPT_CFLAGS += -fno-strict-aliasing 1.127 + 1.128 +# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp 1.129 +# if we use expensive-optimizations 1.130 +# Note: all ia64 setting reflect the ones for linux 1.131 +# No actial testing was performed: there is no Solaris on ia64 presently 1.132 +ifeq ($(BUILDARCH), ia64) 1.133 +OPT_CFLAGS/bytecodeInterpreter.o += -fno-expensive-optimizations 1.134 +endif 1.135 + 1.136 +OPT_CFLAGS/NOOPT=-O0 1.137 +#------------------------------------------------------------------------ 1.138 +# Linker flags 1.139 + 1.140 +# statically link libstdc++.so, work with gcc but ignored by g++ 1.141 +STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic 1.142 + 1.143 +# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. 1.144 +ifneq ("${CC_VER_MAJOR}", "2") 1.145 +STATIC_LIBGCC += -static-libgcc 1.146 +endif 1.147 + 1.148 +ifeq ($(BUILDARCH), ia64) 1.149 +# Note: all ia64 setting reflect the ones for linux 1.150 +# No actial testing was performed: there is no Solaris on ia64 presently 1.151 +LFLAGS += -Wl,-relax 1.152 +endif 1.153 + 1.154 +ifdef USE_GNULD 1.155 +# Enable linker optimization 1.156 +LFLAGS += -Xlinker -O1 1.157 + 1.158 +# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. 1.159 +MAPFLAG = -Xlinker --version-script=FILENAME 1.160 +else 1.161 +MAPFLAG = -Xlinker -M -Xlinker FILENAME 1.162 +endif 1.163 + 1.164 +# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj 1.165 +SONAMEFLAG = -Xlinker -soname=SONAME 1.166 + 1.167 +# Build shared library 1.168 +SHARED_FLAG = -shared 1.169 + 1.170 +#------------------------------------------------------------------------ 1.171 +# Debug flags 1.172 + 1.173 +# Use the stabs format for debugging information (this is the default 1.174 +# on gcc-2.91). It's good enough, has all the information about line 1.175 +# numbers and local variables, and libjvm_g.so is only about 16M. 1.176 +# Change this back to "-g" if you want the most expressive format. 1.177 +# (warning: that could easily inflate libjvm_g.so to 150M!) 1.178 +# Note: The Itanium gcc compiler crashes when using -gstabs. 1.179 +DEBUG_CFLAGS/ia64 = -g 1.180 +DEBUG_CFLAGS/amd64 = -g 1.181 +DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) 1.182 +ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) 1.183 +DEBUG_CFLAGS += -gstabs 1.184 +endif 1.185 + 1.186 +MCS = /usr/ccs/bin/mcs