hotspot/make/bsd/makefiles/gcc.make
author mikael
Tue, 09 Oct 2012 10:09:34 -0700
changeset 13963 e5b53c306fb5
parent 12943 5ebbcf0cb20f
child 13977 92de166c91b3
permissions -rw-r--r--
7197424: update copyright year to match last edit in jdk8 hotspot repository Summary: Update copyright year to 2012 for relevant files Reviewed-by: dholmes, coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     1
#
13963
e5b53c306fb5 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 12943
diff changeset
     2
# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
10565
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
#------------------------------------------------------------------------
11721
dcd1f62c9caf 7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents: 11205
diff changeset
    28
# CC, CXX & AS
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    29
11955
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    30
# If a SPEC is not set already, then use these defaults.
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    31
ifeq ($(SPEC),)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    32
  # When cross-compiling the ALT_COMPILER_PATH points
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    33
  # to the cross-compilation toolset
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    34
  ifdef CROSS_COMPILE_ARCH
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    35
    CXX = $(ALT_COMPILER_PATH)/g++
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    36
    CC  = $(ALT_COMPILER_PATH)/gcc
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    37
    HOSTCXX = g++
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    38
    HOSTCC  = gcc
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    39
  else ifneq ($(OS_VENDOR), Darwin)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    40
    CXX = g++
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    41
    CC  = gcc
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    42
    HOSTCXX = $(CXX)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    43
    HOSTCC  = $(CC)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    44
  endif
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    45
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    46
  # i486 hotspot requires -mstackrealign on Darwin.
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    47
  # llvm-gcc supports this in Xcode 3.2.6 and 4.0.
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    48
  # gcc-4.0 supports this on earlier versions.
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    49
  # Prefer llvm-gcc where available.
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    50
  ifeq ($(OS_VENDOR), Darwin)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    51
    ifeq ($(origin CXX), default)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    52
      CXX = llvm-g++
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    53
    endif
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    54
    ifeq ($(origin CC), default)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    55
      CC  = llvm-gcc
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    56
    endif
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    57
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    58
    ifeq ($(ARCH), i486)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    59
      LLVM_SUPPORTS_STACKREALIGN := $(shell \
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    60
       [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    61
       && echo true || echo false)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    62
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    63
      ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    64
        CXX32 ?= llvm-g++
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    65
        CC32  ?= llvm-gcc
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    66
      else
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    67
        CXX32 ?= g++-4.0
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    68
        CC32  ?= gcc-4.0
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    69
      endif
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    70
      CXX = $(CXX32)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    71
      CC  = $(CC32)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    72
    endif
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    73
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    74
    HOSTCXX = $(CXX)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    75
    HOSTCC  = $(CC)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    76
  endif
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    77
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    78
  AS   = $(CC) -c -x assembler-with-cpp
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    79
endif
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
    80
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    81
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    82
# -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
    83
# prints the numbers (e.g. "2.95", "3.2.1")
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    84
CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    85
CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    86
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    87
# check for precompiled headers support
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    88
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
    89
# Allow the user to turn off precompiled headers from the command line.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    90
ifneq ($(USE_PRECOMPILED_HEADER),0)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    91
PRECOMPILED_HEADER_DIR=.
10830
f3fedfa29811 7106766: Move the precompiled header from the src/share/vm directory
brutisso
parents: 10739
diff changeset
    92
PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    93
PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    94
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    95
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    96
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    97
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    98
#------------------------------------------------------------------------
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    99
# Compiler flags
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   100
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   101
# position-independent code
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   102
PICFLAG = -fPIC
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   103
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   104
VM_PICFLAG/LIBJVM = $(PICFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   105
VM_PICFLAG/AOUT   =
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   106
VM_PICFLAG        = $(VM_PICFLAG/$(LINK_INTO))
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   107
12156
fb31de03f649 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 11955
diff changeset
   108
ifeq ($(JVM_VARIANT_ZERO), true)
fb31de03f649 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 11955
diff changeset
   109
  CFLAGS += $(LIBFFI_CFLAGS)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   110
endif
12156
fb31de03f649 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 11955
diff changeset
   111
ifeq ($(JVM_VARIANT_ZEROSHARK), true)
fb31de03f649 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 11955
diff changeset
   112
  CFLAGS += $(LIBFFI_CFLAGS)
fb31de03f649 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 11955
diff changeset
   113
  CFLAGS += $(LLVM_CFLAGS)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   114
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   115
CFLAGS += $(VM_PICFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   116
CFLAGS += -fno-rtti
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   117
CFLAGS += -fno-exceptions
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   118
CFLAGS += -pthread
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   119
CFLAGS += -fcheck-new
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   120
# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   121
# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   122
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
   123
CFLAGS += -fvisibility=hidden
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   124
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   125
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   126
ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   127
ARCHFLAG/i486    = -m32 -march=i586
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   128
ARCHFLAG/amd64   = -m64
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   129
ARCHFLAG/ia64    =
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   130
ARCHFLAG/sparc   = -m32 -mcpu=v9
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   131
ARCHFLAG/sparcv9 = -m64 -mcpu=v9
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   132
ARCHFLAG/zero    = $(ZERO_ARCHFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   133
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   134
# Darwin-specific build flags
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   135
ifeq ($(OS_VENDOR), Darwin)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   136
  # Ineffecient 16-byte stack re-alignment on Darwin/IA32
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   137
  ARCHFLAG/i486 += -mstackrealign
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   138
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   139
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   140
CFLAGS     += $(ARCHFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   141
AOUT_FLAGS += $(ARCHFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   142
LFLAGS     += $(ARCHFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   143
ASFLAGS    += $(ARCHFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   144
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   145
ifdef E500V2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   146
CFLAGS += -DE500V2
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   147
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   148
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   149
# Use C++ Interpreter
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   150
ifdef CC_INTERP
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   151
  CFLAGS += -DCC_INTERP
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   152
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   153
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   154
# Build for embedded targets
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   155
ifdef JAVASE_EMBEDDED
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   156
  CFLAGS += -DJAVASE_EMBEDDED
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   157
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   158
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   159
# Keep temporary files (.ii, .s)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   160
ifdef NEED_ASM
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   161
  CFLAGS += -save-temps
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   162
else
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   163
  CFLAGS += -pipe
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   164
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   165
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   166
# Compiler warnings are treated as errors
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   167
ifneq ($(COMPILER_WARNINGS_FATAL),false)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   168
  WARNINGS_ARE_ERRORS = -Werror
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   169
endif
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   170
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   171
# Except for a few acceptable ones
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   172
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   173
# conversions which might affect the values. To avoid that, we need to turn
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   174
# it off explicitly. 
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   175
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
   176
ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   177
else
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   178
ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   179
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   180
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   181
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   182
# Special cases
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   183
CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) 
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   184
# XXXDARWIN: for _dyld_bind_fully_image_containing_address
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   185
ifeq ($(OS_VENDOR), Darwin)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   186
  CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   187
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   188
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   189
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   190
# The flags to use for an Optimized g++ build
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   191
ifeq ($(OS_VENDOR), Darwin)
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   192
  # 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
   193
  # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers>
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   194
  OPT_CFLAGS += -Os
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   195
else
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   196
  OPT_CFLAGS += -O3
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   197
endif
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   198
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   199
# Hotspot uses very unstrict aliasing turn this optimization off
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   200
OPT_CFLAGS += -fno-strict-aliasing
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   201
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   202
# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp 
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   203
# if we use expensive-optimizations
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   204
ifeq ($(BUILDARCH), ia64)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   205
OPT_CFLAGS += -fno-expensive-optimizations
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   206
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   207
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   208
OPT_CFLAGS/NOOPT=-O0
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   209
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   210
# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. 
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   211
ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   212
OPT_CFLAGS/mulnode.o += -O0
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   213
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   214
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   215
# Flags for generating make dependency flags.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   216
ifneq ("${CC_VER_MAJOR}", "2")
12943
5ebbcf0cb20f 7175914: Usage of gcc with precompiled headers produces wrong build dependencies
kamg
parents: 12156
diff changeset
   217
DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   218
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   219
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   220
# -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
   221
ifeq ($(USE_PRECOMPILED_HEADER),0)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   222
CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   223
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   224
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   225
#------------------------------------------------------------------------
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   226
# Linker flags
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   227
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   228
# statically link libstdc++.so, work with gcc but ignored by g++
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   229
STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   230
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   231
# 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
   232
ifneq ("${CC_VER_MAJOR}", "2")
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   233
STATIC_LIBGCC += -static-libgcc
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   234
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   235
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   236
ifeq ($(BUILDARCH), ia64)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   237
LFLAGS += -Wl,-relax
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   238
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   239
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   240
# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   241
MAPFLAG = -Xlinker --version-script=FILENAME
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   242
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   243
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   244
# Shared Library
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   245
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   246
ifeq ($(OS_VENDOR), Darwin)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   247
  # Standard linker flags
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   248
  LFLAGS +=
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   249
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   250
  # Darwin doesn't use ELF and doesn't support version scripts
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   251
  LDNOMAP = true
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   252
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   253
  # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   254
  SONAMEFLAG =
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   255
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   256
  # Build shared library
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 10565
diff changeset
   257
  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
   258
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   259
  # Keep symbols even they are not used
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   260
  #AOUT_FLAGS += -Xlinker -export-dynamic
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   261
else
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   262
  # Enable linker optimization
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   263
  LFLAGS += -Xlinker -O1
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   264
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   265
  # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   266
  SONAMEFLAG = -Xlinker -soname=SONAME
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   267
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   268
  # Build shared library
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   269
  SHARED_FLAG = -shared $(VM_PICFLAG)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   270
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   271
  # Keep symbols even they are not used
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   272
  AOUT_FLAGS += -Xlinker -export-dynamic
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   273
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   274
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   275
#------------------------------------------------------------------------
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   276
# Debug flags
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   277
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   278
# Use the stabs format for debugging information (this is the default
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   279
# on gcc-2.91). It's good enough, has all the information about line
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   280
# numbers and local variables, and libjvm_g.so is only about 16M.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   281
# Change this back to "-g" if you want the most expressive format.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   282
# (warning: that could easily inflate libjvm_g.so to 150M!)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   283
# Note: The Itanium gcc compiler crashes when using -gstabs.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   284
DEBUG_CFLAGS/ia64  = -g
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   285
DEBUG_CFLAGS/amd64 = -g
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   286
DEBUG_CFLAGS/arm   = -g
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   287
DEBUG_CFLAGS/ppc   = -g
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   288
DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   289
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   290
DEBUG_CFLAGS += -gstabs
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   291
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   292
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   293
# DEBUG_BINARIES overrides everything, use full -g debug information
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   294
ifeq ($(DEBUG_BINARIES), true)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   295
  DEBUG_CFLAGS = -g
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   296
  CFLAGS += $(DEBUG_CFLAGS)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   297
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   298
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   299
# If we are building HEADLESS, pass on to VM
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   300
# so it can set the java.awt.headless property
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   301
ifdef HEADLESS
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   302
CFLAGS += -DHEADLESS
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   303
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   304
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   305
# We are building Embedded for a small device
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   306
# favor code space over speed
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   307
ifdef MINIMIZE_RAM_USAGE
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   308
CFLAGS += -DMINIMIZE_RAM_USAGE
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   309
endif