annotate make/solaris/makefiles/gcc.make @ 2003:c760f78e0a53

7003125: precompiled.hpp is included when precompiled headers are not used Summary: Added an ifndef DONT_USE_PRECOMPILED_HEADER to precompiled.hpp. Set up DONT_USE_PRECOMPILED_HEADER when compiling with Sun Studio or when the user specifies USE_PRECOMPILED_HEADER=0. Fixed broken include dependencies. Reviewed-by: coleenp, kvn
author stefank
date Wed, 01 Dec 2010 15:04:06 +0100
parents f95d63e2154a
children 95009f678859
rev   line source
duke@0 1 #
stefank@1992 2 # Copyright (c) 1998, 2010, Oracle and/or its affiliates. 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 #
trims@1563 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1563 20 # or visit www.oracle.com if you need additional information or have any
trims@1563 21 # 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"
stefank@2003 50 # Allow the user to turn off precompiled headers from the command line.
stefank@2003 51 ifneq ($(USE_PRECOMPILED_HEADER),0)
duke@0 52 USE_PRECOMPILED_HEADER=1
duke@0 53 PRECOMPILED_HEADER_DIR=.
stefank@1992 54 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled.hpp
stefank@1992 55 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
duke@0 56 endif
stefank@2003 57 endif
duke@0 58
duke@0 59
duke@0 60 #------------------------------------------------------------------------
duke@0 61 # Compiler flags
duke@0 62
duke@0 63 # position-independent code
duke@0 64 PICFLAG = -fPIC
duke@0 65
duke@0 66 VM_PICFLAG/LIBJVM = $(PICFLAG)
duke@0 67 VM_PICFLAG/AOUT =
duke@0 68 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
duke@0 69
duke@0 70 CFLAGS += $(VM_PICFLAG)
duke@0 71 CFLAGS += -fno-rtti
duke@0 72 CFLAGS += -fno-exceptions
duke@0 73 CFLAGS += -D_REENTRANT
duke@0 74 CFLAGS += -fcheck-new
duke@0 75
duke@0 76 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
duke@0 77
duke@0 78 ARCHFLAG/sparc = -m32 -mcpu=v9
duke@0 79 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
duke@0 80 ARCHFLAG/i486 = -m32 -march=i586
duke@0 81 ARCHFLAG/amd64 = -m64 -march=k8
duke@0 82
duke@0 83
duke@0 84 # Optional sub-directory in /usr/lib where BUILDARCH libraries are kept.
duke@0 85 ISA_DIR=$(ISA_DIR/$(BUILDARCH))
duke@0 86 ISA_DIR/amd64=/amd64
duke@0 87 ISA_DIR/i486=
duke@0 88 ISA_DIR/sparcv9=/64
duke@0 89
duke@0 90
duke@0 91 CFLAGS += $(ARCHFLAG)
duke@0 92 AOUT_FLAGS += $(ARCHFLAG)
duke@0 93 LFLAGS += $(ARCHFLAG)
duke@0 94 ASFLAGS += $(ARCHFLAG)
duke@0 95
duke@0 96 ifeq ($(BUILDARCH), amd64)
duke@0 97 ASFLAGS += -march=k8 -march=amd64
duke@0 98 LFLAGS += -march=k8
duke@0 99 endif
duke@0 100
duke@0 101
duke@0 102 # Use C++ Interpreter
duke@0 103 ifdef CC_INTERP
duke@0 104 CFLAGS += -DCC_INTERP
duke@0 105 endif
duke@0 106
duke@0 107 # Keep temporary files (.ii, .s)
duke@0 108 ifdef NEED_ASM
duke@0 109 CFLAGS += -save-temps
duke@0 110 else
duke@0 111 CFLAGS += -pipe
duke@0 112 endif
duke@0 113
duke@0 114
duke@0 115 # Compiler warnings are treated as errors
duke@0 116 WARNINGS_ARE_ERRORS = -Werror
duke@0 117 # Enable these warnings. See 'info gcc' about details on these options
duke@0 118 ADDITIONAL_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
duke@0 119 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ADDITIONAL_WARNINGS)
duke@0 120 # Special cases
duke@0 121 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
duke@0 122
duke@0 123 # The flags to use for an Optimized g++ build
duke@0 124 OPT_CFLAGS += -O3
duke@0 125
duke@0 126 # Hotspot uses very unstrict aliasing turn this optimization off
duke@0 127 OPT_CFLAGS += -fno-strict-aliasing
duke@0 128
duke@0 129 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
duke@0 130 # if we use expensive-optimizations
duke@0 131 # Note: all ia64 setting reflect the ones for linux
duke@0 132 # No actial testing was performed: there is no Solaris on ia64 presently
duke@0 133 ifeq ($(BUILDARCH), ia64)
duke@0 134 OPT_CFLAGS/bytecodeInterpreter.o += -fno-expensive-optimizations
duke@0 135 endif
duke@0 136
duke@0 137 OPT_CFLAGS/NOOPT=-O0
stefank@1992 138
stefank@1992 139 # Flags for generating make dependency flags.
stefank@1992 140 ifneq ("${CC_VER_MAJOR}", "2")
stefank@1992 141 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
stefank@1992 142 endif
stefank@1992 143
stefank@2003 144 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
stefank@2003 145 ifneq ($(USE_PRECOMPILED_HEADER),1)
stefank@2003 146 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
stefank@2003 147 endif
stefank@2003 148
duke@0 149 #------------------------------------------------------------------------
duke@0 150 # Linker flags
duke@0 151
duke@0 152 # statically link libstdc++.so, work with gcc but ignored by g++
duke@0 153 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
duke@0 154
duke@0 155 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
duke@0 156 ifneq ("${CC_VER_MAJOR}", "2")
duke@0 157 STATIC_LIBGCC += -static-libgcc
duke@0 158 endif
duke@0 159
duke@0 160 ifeq ($(BUILDARCH), ia64)
duke@0 161 # Note: all ia64 setting reflect the ones for linux
duke@0 162 # No actial testing was performed: there is no Solaris on ia64 presently
duke@0 163 LFLAGS += -Wl,-relax
duke@0 164 endif
duke@0 165
duke@0 166 ifdef USE_GNULD
duke@0 167 # Enable linker optimization
duke@0 168 LFLAGS += -Xlinker -O1
duke@0 169
duke@0 170 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
duke@0 171 MAPFLAG = -Xlinker --version-script=FILENAME
duke@0 172 else
duke@0 173 MAPFLAG = -Xlinker -M -Xlinker FILENAME
duke@0 174 endif
duke@0 175
duke@0 176 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
duke@0 177 SONAMEFLAG = -Xlinker -soname=SONAME
duke@0 178
duke@0 179 # Build shared library
duke@0 180 SHARED_FLAG = -shared
duke@0 181
duke@0 182 #------------------------------------------------------------------------
duke@0 183 # Debug flags
duke@0 184
duke@0 185 # Use the stabs format for debugging information (this is the default
duke@0 186 # on gcc-2.91). It's good enough, has all the information about line
duke@0 187 # numbers and local variables, and libjvm_g.so is only about 16M.
duke@0 188 # Change this back to "-g" if you want the most expressive format.
duke@0 189 # (warning: that could easily inflate libjvm_g.so to 150M!)
duke@0 190 # Note: The Itanium gcc compiler crashes when using -gstabs.
duke@0 191 DEBUG_CFLAGS/ia64 = -g
duke@0 192 DEBUG_CFLAGS/amd64 = -g
duke@0 193 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
duke@0 194 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
duke@0 195 DEBUG_CFLAGS += -gstabs
duke@0 196 endif
duke@0 197
duke@0 198 MCS = /usr/ccs/bin/mcs