source: trunk/openjdk/hotspot/make/solaris/makefiles/gcc.make

Last change on this file was 309, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b24 from branches/vendor/oracle.

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