hotspot/make/bsd/makefiles/gcc.make
author stefank
Mon, 28 Nov 2011 14:58:31 +0100
changeset 11205 f07e6dd70a1f
parent 10830 f3fedfa29811
child 11721 dcd1f62c9caf
permissions -rw-r--r--
7116081: USE_PRECOMPILED_HEADER=0 triggers a single threaded build of the JVM Summary: Changed the conditional to see if the precompiled header has been specified. Also, removed the unused PrecompiledOption. Reviewed-by: dholmes, brutisso
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     1
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     2
# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     4
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     7
# published by the Free Software Foundation.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     8
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    13
# accompanied this code).
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    14
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    18
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    21
# questions.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    22
#  
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    23
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    24
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    25
OS_VENDOR = $(shell uname -s)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    26
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    27
#------------------------------------------------------------------------
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    28
# CC, CPP & AS
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    29
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    30
# When cross-compiling the ALT_COMPILER_PATH points
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    31
# to the cross-compilation toolset
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    32
ifdef CROSS_COMPILE_ARCH
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    33
 CPP = $(ALT_COMPILER_PATH)/g++
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    34
 CC  = $(ALT_COMPILER_PATH)/gcc
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    35
 HOSTCPP = g++
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    36
 HOSTCC  = gcc
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    37
else ifneq ($(OS_VENDOR), Darwin)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    38
 CXX = g++
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    39
 CPP = $(CXX)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    40
 CC  = gcc
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    41
 HOSTCPP = $(CPP)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    42
 HOSTCC  = $(CC)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    43
endif
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    44
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    45
# i486 hotspot requires -mstackrealign on Darwin.
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    46
# llvm-gcc supports this in Xcode 3.2.6 and 4.0.
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    47
# gcc-4.0 supports this on earlier versions.
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    48
# Prefer llvm-gcc where available.
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    49
ifeq ($(OS_VENDOR), Darwin)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    50
  ifeq ($(origin CXX), default)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    51
   CXX = llvm-g++
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    52
  endif
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    53
  ifeq ($(origin CC), default)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    54
   CC  = llvm-gcc
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    55
  endif
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    56
  CPP  = $(CXX)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    57
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    58
  ifeq ($(ARCH), i486)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    59
  LLVM_SUPPORTS_STACKREALIGN := $(shell \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    60
   [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    61
   && echo true || echo false)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    62
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    63
  ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    64
    CXX32 ?= llvm-g++
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    65
    CC32  ?= llvm-gcc
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    66
  else
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    67
    CXX32 ?= g++-4.0
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    68
    CC32  ?= gcc-4.0
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    69
  endif
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    70
  CPP = $(CXX32)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    71
  CC  = $(CC32)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    72
  endif
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    73
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    74
  HOSTCPP = $(CPP)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    75
  HOSTCC  = $(CC)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    76
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    77
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    78
AS   = $(CC) -c -x assembler-with-cpp
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    79
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    80
# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    81
# prints the numbers (e.g. "2.95", "3.2.1")
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    82
CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    83
CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    84
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    85
# check for precompiled headers support
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    86
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    87
# Allow the user to turn off precompiled headers from the command line.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    88
ifneq ($(USE_PRECOMPILED_HEADER),0)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    89
PRECOMPILED_HEADER_DIR=.
10830
f3fedfa29811 7106766: Move the precompiled header from the src/share/vm directory
brutisso
parents: 10739
diff changeset
    90
PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    91
PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    92
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    93
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    94
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    95
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    96
#------------------------------------------------------------------------
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    97
# Compiler flags
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    98
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    99
# position-independent code
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   100
PICFLAG = -fPIC
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   101
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   102
VM_PICFLAG/LIBJVM = $(PICFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   103
VM_PICFLAG/AOUT   =
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   104
VM_PICFLAG        = $(VM_PICFLAG/$(LINK_INTO))
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   105
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   106
ifeq ($(ZERO_BUILD), true)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   107
CFLAGS += $(LIBFFI_CFLAGS)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   108
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   109
ifeq ($(SHARK_BUILD), true)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   110
CFLAGS += $(LLVM_CFLAGS)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   111
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   112
CFLAGS += $(VM_PICFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   113
CFLAGS += -fno-rtti
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   114
CFLAGS += -fno-exceptions
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   115
CFLAGS += -pthread
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   116
CFLAGS += -fcheck-new
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   117
# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   118
# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   119
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   120
CFLAGS += -fvisibility=hidden
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   121
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   122
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   123
ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   124
ARCHFLAG/i486    = -m32 -march=i586
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   125
ARCHFLAG/amd64   = -m64
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   126
ARCHFLAG/ia64    =
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   127
ARCHFLAG/sparc   = -m32 -mcpu=v9
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   128
ARCHFLAG/sparcv9 = -m64 -mcpu=v9
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   129
ARCHFLAG/zero    = $(ZERO_ARCHFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   130
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   131
# Darwin-specific build flags
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   132
ifeq ($(OS_VENDOR), Darwin)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   133
  # Ineffecient 16-byte stack re-alignment on Darwin/IA32
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   134
  ARCHFLAG/i486 += -mstackrealign
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   135
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   136
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   137
CFLAGS     += $(ARCHFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   138
AOUT_FLAGS += $(ARCHFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   139
LFLAGS     += $(ARCHFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   140
ASFLAGS    += $(ARCHFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   141
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   142
ifdef E500V2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   143
CFLAGS += -DE500V2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   144
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   145
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   146
# Use C++ Interpreter
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   147
ifdef CC_INTERP
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   148
  CFLAGS += -DCC_INTERP
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   149
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   150
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   151
# Build for embedded targets
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   152
ifdef JAVASE_EMBEDDED
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   153
  CFLAGS += -DJAVASE_EMBEDDED
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   154
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   155
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   156
# Keep temporary files (.ii, .s)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   157
ifdef NEED_ASM
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   158
  CFLAGS += -save-temps
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   159
else
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   160
  CFLAGS += -pipe
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   161
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   162
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   163
# Compiler warnings are treated as errors
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   164
ifneq ($(COMPILER_WARNINGS_FATAL),false)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   165
  WARNINGS_ARE_ERRORS = -Werror
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   166
endif
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   167
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   168
# Except for a few acceptable ones
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   169
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   170
# conversions which might affect the values. To avoid that, we need to turn
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   171
# it off explicitly. 
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   172
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   173
ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   174
else
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   175
ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   176
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   177
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   178
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   179
# Special cases
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   180
CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) 
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   181
# XXXDARWIN: for _dyld_bind_fully_image_containing_address
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   182
ifeq ($(OS_VENDOR), Darwin)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   183
  CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   184
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   185
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   186
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   187
# The flags to use for an Optimized g++ build
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   188
ifeq ($(OS_VENDOR), Darwin)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   189
  # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   190
  # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers>
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   191
  OPT_CFLAGS += -Os
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   192
else
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   193
  OPT_CFLAGS += -O3
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   194
endif
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   195
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   196
# Hotspot uses very unstrict aliasing turn this optimization off
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   197
OPT_CFLAGS += -fno-strict-aliasing
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   198
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   199
# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp 
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   200
# if we use expensive-optimizations
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   201
ifeq ($(BUILDARCH), ia64)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   202
OPT_CFLAGS += -fno-expensive-optimizations
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   203
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   204
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   205
OPT_CFLAGS/NOOPT=-O0
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   206
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   207
# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. 
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   208
ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   209
OPT_CFLAGS/mulnode.o += -O0
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   210
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   211
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   212
# Flags for generating make dependency flags.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   213
ifneq ("${CC_VER_MAJOR}", "2")
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   214
DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   215
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   216
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   217
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
11205
f07e6dd70a1f 7116081: USE_PRECOMPILED_HEADER=0 triggers a single threaded build of the JVM
stefank
parents: 10830
diff changeset
   218
ifeq ($(USE_PRECOMPILED_HEADER),0)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   219
CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   220
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   221
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   222
#------------------------------------------------------------------------
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   223
# Linker flags
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   224
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   225
# statically link libstdc++.so, work with gcc but ignored by g++
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   226
STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   227
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   228
# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   229
ifneq ("${CC_VER_MAJOR}", "2")
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   230
STATIC_LIBGCC += -static-libgcc
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   231
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   232
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   233
ifeq ($(BUILDARCH), ia64)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   234
LFLAGS += -Wl,-relax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   235
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   236
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   237
# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   238
MAPFLAG = -Xlinker --version-script=FILENAME
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   239
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   240
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   241
# Shared Library
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   242
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   243
ifeq ($(OS_VENDOR), Darwin)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   244
  # Standard linker flags
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   245
  LFLAGS +=
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   246
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   247
  # Darwin doesn't use ELF and doesn't support version scripts
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   248
  LDNOMAP = true
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   249
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   250
  # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   251
  SONAMEFLAG =
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   252
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   253
  # Build shared library
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   254
  SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   255
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   256
  # Keep symbols even they are not used
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   257
  #AOUT_FLAGS += -Xlinker -export-dynamic
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   258
else
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   259
  # Enable linker optimization
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   260
  LFLAGS += -Xlinker -O1
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   261
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   262
  # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   263
  SONAMEFLAG = -Xlinker -soname=SONAME
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   264
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   265
  # Build shared library
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   266
  SHARED_FLAG = -shared $(VM_PICFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   267
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   268
  # Keep symbols even they are not used
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   269
  AOUT_FLAGS += -Xlinker -export-dynamic
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   270
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   271
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   272
#------------------------------------------------------------------------
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   273
# Debug flags
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   274
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   275
# Use the stabs format for debugging information (this is the default
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   276
# on gcc-2.91). It's good enough, has all the information about line
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   277
# numbers and local variables, and libjvm_g.so is only about 16M.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   278
# Change this back to "-g" if you want the most expressive format.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   279
# (warning: that could easily inflate libjvm_g.so to 150M!)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   280
# Note: The Itanium gcc compiler crashes when using -gstabs.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   281
DEBUG_CFLAGS/ia64  = -g
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   282
DEBUG_CFLAGS/amd64 = -g
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   283
DEBUG_CFLAGS/arm   = -g
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   284
DEBUG_CFLAGS/ppc   = -g
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   285
DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   286
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   287
DEBUG_CFLAGS += -gstabs
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   288
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   289
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   290
# DEBUG_BINARIES overrides everything, use full -g debug information
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   291
ifeq ($(DEBUG_BINARIES), true)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   292
  DEBUG_CFLAGS = -g
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   293
  CFLAGS += $(DEBUG_CFLAGS)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   294
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   295
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   296
# If we are building HEADLESS, pass on to VM
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   297
# so it can set the java.awt.headless property
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   298
ifdef HEADLESS
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   299
CFLAGS += -DHEADLESS
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   300
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   301
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   302
# We are building Embedded for a small device
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   303
# favor code space over speed
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   304
ifdef MINIMIZE_RAM_USAGE
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   305
CFLAGS += -DMINIMIZE_RAM_USAGE
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   306
endif