make/solaris/makefiles/gcc.make

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

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

mercurial