make/solaris/makefiles/gcc.make

Wed, 01 Dec 2010 15:04:06 +0100

author
stefank
date
Wed, 01 Dec 2010 15:04:06 +0100
changeset 2325
c760f78e0a53
parent 2314
f95d63e2154a
child 3229
95009f678859
permissions
-rw-r--r--

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

     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 #
    25 #------------------------------------------------------------------------
    26 # CC, CPP & AS
    28 CPP = g++
    29 CC  = gcc
    30 AS  = $(CC) -c
    32 Compiler = gcc
    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")
    36 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
    37 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
    39 # Check for the versions of C++ and C compilers ($CPP and $CC) used. 
    41 # Get the last thing on the line that looks like x.x+ (x is a digit).
    42 COMPILER_REV := \
    43 $(shell $(CPP) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
    44 C_COMPILER_REV := \
    45 $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
    48 # check for precompiled headers support
    49 ifneq "$(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.
    51 ifneq ($(USE_PRECOMPILED_HEADER),0)
    52 USE_PRECOMPILED_HEADER=1
    53 PRECOMPILED_HEADER_DIR=.
    54 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled.hpp
    55 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
    56 endif
    57 endif
    60 #------------------------------------------------------------------------
    61 # Compiler flags
    63 # position-independent code
    64 PICFLAG = -fPIC
    66 VM_PICFLAG/LIBJVM = $(PICFLAG)
    67 VM_PICFLAG/AOUT   =
    68 VM_PICFLAG        = $(VM_PICFLAG/$(LINK_INTO))
    70 CFLAGS += $(VM_PICFLAG)
    71 CFLAGS += -fno-rtti
    72 CFLAGS += -fno-exceptions
    73 CFLAGS += -D_REENTRANT
    74 CFLAGS += -fcheck-new
    76 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
    78 ARCHFLAG/sparc   = -m32 -mcpu=v9
    79 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
    80 ARCHFLAG/i486    = -m32 -march=i586
    81 ARCHFLAG/amd64   = -m64 -march=k8
    84 # Optional sub-directory in /usr/lib where BUILDARCH libraries are kept.
    85 ISA_DIR=$(ISA_DIR/$(BUILDARCH))
    86 ISA_DIR/amd64=/amd64
    87 ISA_DIR/i486=
    88 ISA_DIR/sparcv9=/64
    91 CFLAGS     += $(ARCHFLAG)
    92 AOUT_FLAGS += $(ARCHFLAG)
    93 LFLAGS     += $(ARCHFLAG)
    94 ASFLAGS    += $(ARCHFLAG)
    96 ifeq ($(BUILDARCH), amd64)
    97 ASFLAGS += -march=k8  -march=amd64
    98 LFLAGS += -march=k8 
    99 endif
   102 # Use C++ Interpreter
   103 ifdef CC_INTERP
   104   CFLAGS += -DCC_INTERP
   105 endif
   107 # Keep temporary files (.ii, .s)
   108 ifdef NEED_ASM
   109   CFLAGS += -save-temps
   110 else
   111   CFLAGS += -pipe
   112 endif
   115 # Compiler warnings are treated as errors 
   116 WARNINGS_ARE_ERRORS = -Werror 
   117 # Enable these warnings. See 'info gcc' about details on these options
   118 ADDITIONAL_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare 
   119 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ADDITIONAL_WARNINGS) 
   120 # Special cases 
   121 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))  
   123 # The flags to use for an Optimized g++ build
   124 OPT_CFLAGS += -O3
   126 # Hotspot uses very unstrict aliasing turn this optimization off
   127 OPT_CFLAGS += -fno-strict-aliasing
   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
   133 ifeq ($(BUILDARCH), ia64)
   134 OPT_CFLAGS/bytecodeInterpreter.o += -fno-expensive-optimizations
   135 endif
   137 OPT_CFLAGS/NOOPT=-O0
   139 # Flags for generating make dependency flags.
   140 ifneq ("${CC_VER_MAJOR}", "2")
   141 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
   142 endif
   144 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
   145 ifneq ($(USE_PRECOMPILED_HEADER),1)
   146 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
   147 endif
   149 #------------------------------------------------------------------------
   150 # Linker flags
   152 # statically link libstdc++.so, work with gcc but ignored by g++
   153 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
   155 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
   156 ifneq ("${CC_VER_MAJOR}", "2")
   157 STATIC_LIBGCC += -static-libgcc
   158 endif
   160 ifeq ($(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
   163 LFLAGS += -Wl,-relax
   164 endif
   166 ifdef USE_GNULD
   167 # Enable linker optimization
   168 LFLAGS += -Xlinker -O1
   170 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
   171 MAPFLAG = -Xlinker --version-script=FILENAME 
   172 else 
   173 MAPFLAG = -Xlinker -M -Xlinker FILENAME 
   174 endif 
   176 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
   177 SONAMEFLAG = -Xlinker -soname=SONAME
   179 # Build shared library
   180 SHARED_FLAG = -shared
   182 #------------------------------------------------------------------------
   183 # Debug flags
   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. 
   191 DEBUG_CFLAGS/ia64  = -g 
   192 DEBUG_CFLAGS/amd64 = -g 
   193 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) 
   194 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) 
   195 DEBUG_CFLAGS += -gstabs 
   196 endif 
   198 MCS = /usr/ccs/bin/mcs

mercurial