annotate make/bsd/makefiles/gcc.make @ 12176:88c255656030

8016155: SIGBUS when running Kitchensink with ParallelScavenge and ParallelOld Summary: When using NUMA and large pages we need to ease the requirement on which node the memory should be allocated on. To avoid the SIGBUS we now use the memory policy MPOL_PREFERRED, which prefers a certain node, instead of MPOL_BIND, which requires a certain node. Reviewed-by: jmasa, pliden Contributed-by: stefan.johansson@oracle.com
author mgerdin
date Thu, 22 Aug 2013 10:50:41 +0200
parents e16282db4946
children dfc126b2f659
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
1 #
11026
91acb82a8b7a 8014326: [OSX] All libjvm symbols are exported
dholmes
parents: 10398
diff changeset
2 # Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
4 #
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
5 # This code is free software; you can redistribute it and/or modify it
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
6 # under the terms of the GNU General Public License version 2 only, as
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
7 # published by the Free Software Foundation.
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
8 #
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
9 # This code is distributed in the hope that it will be useful, but WITHOUT
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
12 # version 2 for more details (a copy is included in the LICENSE file that
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
13 # accompanied this code).
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
14 #
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License version
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
16 # 2 along with this work; if not, write to the Free Software Foundation,
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
18 #
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
20 # or visit www.oracle.com if you need additional information or have any
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
21 # questions.
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
22 #
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
23 #
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
24
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
25 OS_VENDOR = $(shell uname -s)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
26
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
27 #------------------------------------------------------------------------
4891
719f7007c8e8 7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents: 4129
diff changeset
28 # CC, CXX & AS
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
29
5897
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
30 # If a SPEC is not set already, then use these defaults.
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
31 ifeq ($(SPEC),)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
32 # When cross-compiling the ALT_COMPILER_PATH points
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
33 # to the cross-compilation toolset
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
34 ifdef CROSS_COMPILE_ARCH
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
35 CXX = $(ALT_COMPILER_PATH)/g++
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
36 CC = $(ALT_COMPILER_PATH)/gcc
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
37 HOSTCXX = g++
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
38 HOSTCC = gcc
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
39 else ifneq ($(OS_VENDOR), Darwin)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
40 CXX = g++
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
41 CC = gcc
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
42 HOSTCXX = $(CXX)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
43 HOSTCC = $(CC)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
44 endif
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
45
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
46 # i486 hotspot requires -mstackrealign on Darwin.
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
47 # llvm-gcc supports this in Xcode 3.2.6 and 4.0.
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
48 # gcc-4.0 supports this on earlier versions.
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
49 # Prefer llvm-gcc where available.
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
50 ifeq ($(OS_VENDOR), Darwin)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
51 ifeq ($(origin CXX), default)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
52 CXX = llvm-g++
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
53 endif
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
54 ifeq ($(origin CC), default)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
55 CC = llvm-gcc
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
56 endif
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
57
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
58 ifeq ($(ARCH), i486)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
59 LLVM_SUPPORTS_STACKREALIGN := $(shell \
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
60 [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
61 && echo true || echo false)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
62
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
63 ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
64 CXX32 ?= llvm-g++
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
65 CC32 ?= llvm-gcc
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
66 else
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
67 CXX32 ?= g++-4.0
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
68 CC32 ?= gcc-4.0
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
69 endif
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
70 CXX = $(CXX32)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
71 CC = $(CC32)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
72 endif
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
73
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
74 ifeq ($(USE_CLANG), true)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
75 CXX = clang++
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
76 CC = clang
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
77 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
78
5897
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
79 HOSTCXX = $(CXX)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
80 HOSTCC = $(CC)
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
81 endif
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
82
7292cff45988 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 4891
diff changeset
83 AS = $(CC) -c -x assembler-with-cpp
4006
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
84 endif
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
85
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
86
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
87 ifeq ($(USE_CLANG), true)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
88 CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
89 CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
90 else
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
91 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
92 # prints the numbers (e.g. "2.95", "3.2.1")
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
93 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
94 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
95 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
96
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
97 ifeq ($(USE_CLANG), true)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
98 # clang has precompiled headers support by default, but the user can switch
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
99 # it off by using 'USE_PRECOMPILED_HEADER=0'.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
100 ifdef LP64
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
101 ifeq ($(USE_PRECOMPILED_HEADER),)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
102 USE_PRECOMPILED_HEADER=1
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
103 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
104 else
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
105 # We don't support precompiled headers on 32-bit builds because there some files are
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
106 # compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
107 # Clang produces an error if the PCH file was compiled with other options than the actual compilation unit.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
108 USE_PRECOMPILED_HEADER=0
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
109 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
110
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
111 ifeq ($(USE_PRECOMPILED_HEADER),1)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
112
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
113 ifndef LP64
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
114 $(error " Precompiled Headers only supported on 64-bit platforms!")
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
115 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
116
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
117 PRECOMPILED_HEADER_DIR=.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
118 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
119 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
120
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
121 PCH_FLAG = -include precompiled.hpp
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
122 PCH_FLAG/DEFAULT = $(PCH_FLAG)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
123 PCH_FLAG/NO_PCH = -DNO_PCH
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
124 PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@))
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
125
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
126 VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
127 VM_PCH_FLAG/AOUT =
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
128 VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO))
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
129
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
130 # We only use precompiled headers for the JVM build
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
131 CFLAGS += $(VM_PCH_FLAG)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
132
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
133 # There are some files which don't like precompiled headers
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
134 # The following files are build with 'OPT_CFLAGS/NOOPT' (-O0) in the opt build.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
135 # But Clang doesn't support a precompiled header which was compiled with -O3
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
136 # to be used in a compilation unit which uses '-O0'. We could also prepare an
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
137 # extra '-O0' PCH file for the opt build and use it here, but it's probably
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
138 # not worth the effort as long as only two files need this special handling.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
139 PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
140 PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
141 PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
142
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
143 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
144 else # ($(USE_CLANG), true)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
145 # check for precompiled headers support
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
146 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
147 # Allow the user to turn off precompiled headers from the command line.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
148 ifneq ($(USE_PRECOMPILED_HEADER),0)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
149 PRECOMPILED_HEADER_DIR=.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
150 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
151 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
152 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
153 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
154 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
155
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
156 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
157 ifeq ($(USE_PRECOMPILED_HEADER),0)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
158 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
159 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
160
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
161 #------------------------------------------------------------------------
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
162 # Compiler flags
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
163
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
164 # position-independent code
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
165 PICFLAG = -fPIC
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
166
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
167 VM_PICFLAG/LIBJVM = $(PICFLAG)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
168 VM_PICFLAG/AOUT =
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
169 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
170
5946
3d7ea1dbe0de 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 5897
diff changeset
171 ifeq ($(JVM_VARIANT_ZERO), true)
3d7ea1dbe0de 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 5897
diff changeset
172 CFLAGS += $(LIBFFI_CFLAGS)
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
173 endif
5946
3d7ea1dbe0de 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 5897
diff changeset
174 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
3d7ea1dbe0de 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 5897
diff changeset
175 CFLAGS += $(LIBFFI_CFLAGS)
3d7ea1dbe0de 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 5897
diff changeset
176 CFLAGS += $(LLVM_CFLAGS)
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
177 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
178 CFLAGS += $(VM_PICFLAG)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
179 CFLAGS += -fno-rtti
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
180 CFLAGS += -fno-exceptions
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
181 ifeq ($(USE_CLANG),)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
182 CFLAGS += -pthread
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
183 CFLAGS += -fcheck-new
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
184 # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
185 # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
186 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
187 CFLAGS += -fvisibility=hidden
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
188 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
189 else
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
190 CFLAGS += -fvisibility=hidden
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
191 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
192
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
193 ifeq ($(USE_CLANG), true)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
194 # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
195 # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment')
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
196 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0"
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
197 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
198 else
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
199 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
200 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
201 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
202
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
203 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
204 ARCHFLAG/i486 = -m32 -march=i586
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
205 ARCHFLAG/amd64 = -m64 $(STACK_ALIGNMENT_OPT)
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
206 ARCHFLAG/ia64 =
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
207 ARCHFLAG/sparc = -m32 -mcpu=v9
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
208 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
209 ARCHFLAG/zero = $(ZERO_ARCHFLAG)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
210
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
211 # Darwin-specific build flags
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
212 ifeq ($(OS_VENDOR), Darwin)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
213 # Ineffecient 16-byte stack re-alignment on Darwin/IA32
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
214 ARCHFLAG/i486 += -mstackrealign
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
215 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
216
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
217 CFLAGS += $(ARCHFLAG)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
218 AOUT_FLAGS += $(ARCHFLAG)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
219 LFLAGS += $(ARCHFLAG)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
220 ASFLAGS += $(ARCHFLAG)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
221
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
222 ifdef E500V2
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
223 CFLAGS += -DE500V2
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
224 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
225
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
226 # Use C++ Interpreter
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
227 ifdef CC_INTERP
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
228 CFLAGS += -DCC_INTERP
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
229 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
230
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
231 # Keep temporary files (.ii, .s)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
232 ifdef NEED_ASM
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
233 CFLAGS += -save-temps
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
234 else
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
235 CFLAGS += -pipe
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
236 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
237
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
238 # Compiler warnings are treated as errors
4006
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
239 ifneq ($(COMPILER_WARNINGS_FATAL),false)
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
240 WARNINGS_ARE_ERRORS = -Werror
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
241 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
242
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
243 ifeq ($(USE_CLANG), true)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
244 # However we need to clean the code up before we can unrestrictedly enable this option with Clang
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
245 WARNINGS_ARE_ERRORS += -Wno-unused-value -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
246 WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-compare
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
247 # Not yet supported by clang in Xcode 4.6.2
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
248 # WARNINGS_ARE_ERRORS += -Wno-tautological-constant-out-of-range-compare
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
249 WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess
12077
e16282db4946 8022956: Clang: enable return type warnings on BSD
twisti
parents: 11026
diff changeset
250 WARNINGS_ARE_ERRORS += -Wno-empty-body
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
251 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
252
8722
67342b960b47 8008474: Add -Wundef to warning flags.
jprovino
parents: 7408
diff changeset
253 WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
254
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
255 ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
256 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
257 # conversions which might affect the values. Only enable it in earlier versions.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
258 WARNING_FLAGS = -Wunused-function
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
259 ifeq ($(USE_CLANG),)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
260 WARNINGS_FLAGS += -Wconversion
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
261 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
262 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
263
8722
67342b960b47 8008474: Add -Wundef to warning flags.
jprovino
parents: 7408
diff changeset
264 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
265 # Special cases
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
266 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
267 # XXXDARWIN: for _dyld_bind_fully_image_containing_address
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
268 ifeq ($(OS_VENDOR), Darwin)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
269 CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
270 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
271
6854
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
272 OPT_CFLAGS/SIZE=-Os
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
273 OPT_CFLAGS/SPEED=-O3
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
274
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
275 # Hotspot uses very unstrict aliasing turn this optimization off
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
276 # This option is added to CFLAGS rather than OPT_CFLAGS
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
277 # so that OPT_CFLAGS overrides get this option too.
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
278 CFLAGS += -fno-strict-aliasing
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
279
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
280 # The flags to use for an Optimized g++ build
4006
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
281 ifeq ($(OS_VENDOR), Darwin)
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
282 # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
283 # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers>
6854
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
284 OPT_CFLAGS_DEFAULT ?= SIZE
4006
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
285 else
6854
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
286 OPT_CFLAGS_DEFAULT ?= SPEED
4006
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
287 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
288
6854
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
289 ifdef OPT_CFLAGS
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
290 ifneq ("$(origin OPT_CFLAGS)", "command line")
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
291 $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
292 endif
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
293 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
294
6854
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
295 OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
296
fb19af007ffc 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 6129
diff changeset
297 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
298 # if we use expensive-optimizations
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
299 ifeq ($(BUILDARCH), ia64)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
300 OPT_CFLAGS += -fno-expensive-optimizations
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
301 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
302
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
303 OPT_CFLAGS/NOOPT=-O0
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
304
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
305 # Work around some compiler bugs.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
306 ifeq ($(USE_CLANG), true)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
307 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
308 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
309 endif
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
310 else
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
311 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
312 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
313 OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
314 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
315 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
316
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
317 # Flags for generating make dependency flags.
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
318 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
319 ifeq ($(USE_CLANG),)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
320 ifneq ($(CC_VER_MAJOR), 2)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
321 DEPFLAGS += -fpch-deps
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
322 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
323 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
324
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
325 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
4129
f4414323345f 7116081: USE_PRECOMPILED_HEADER=0 triggers a single threaded build of the JVM
stefank
parents: 4033
diff changeset
326 ifeq ($(USE_PRECOMPILED_HEADER),0)
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
327 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
328 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
329
8682
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
330 ifeq ($(OS_VENDOR), Darwin)
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
331 # Setting these parameters makes it an error to link to macosx APIs that are
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
332 # newer than the given OS version and makes the linked binaries compatible even
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
333 # if built on a newer version of the OS.
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
334 # The expected format is X.Y.Z
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
335 ifeq ($(MACOSX_VERSION_MIN),)
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
336 MACOSX_VERSION_MIN=10.7.0
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
337 endif
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
338 # The macro takes the version with no dots, ex: 1070
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
339 CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
340 -mmacosx-version-min=$(MACOSX_VERSION_MIN)
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
341 LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
342 endif
d778bb46a9a5 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 7408
diff changeset
343
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
344 #------------------------------------------------------------------------
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
345 # Linker flags
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
346
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
347 # statically link libstdc++.so, work with gcc but ignored by g++
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
348 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
349
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
350 ifeq ($(USE_CLANG),)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
351 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
352 ifneq ("${CC_VER_MAJOR}", "2")
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
353 STATIC_LIBGCC += -static-libgcc
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
354 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
355
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
356 ifeq ($(BUILDARCH), ia64)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
357 LFLAGS += -Wl,-relax
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
358 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
359 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
360
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
361 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
362 MAPFLAG = -Xlinker --version-script=FILENAME
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
363
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
364 #
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
365 # Shared Library
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
366 #
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
367 ifeq ($(OS_VENDOR), Darwin)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
368 # Standard linker flags
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
369 LFLAGS +=
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
370
11026
91acb82a8b7a 8014326: [OSX] All libjvm symbols are exported
dholmes
parents: 10398
diff changeset
371 # The apple linker has its own variant of mapfiles/version-scripts
91acb82a8b7a 8014326: [OSX] All libjvm symbols are exported
dholmes
parents: 10398
diff changeset
372 MAPFLAG = -Xlinker -exported_symbols_list -Xlinker FILENAME
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
373
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
374 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
375 SONAMEFLAG =
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
376
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
377 # Build shared library
4006
436b4a3231bf 7098194: integrate macosx-port changes
dcubed
parents: 3960
diff changeset
378 SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG)
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
379
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
380 # Keep symbols even they are not used
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
381 #AOUT_FLAGS += -Xlinker -export-dynamic
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
382 else
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
383 # Enable linker optimization
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
384 LFLAGS += -Xlinker -O1
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
385
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
386 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
387 SONAMEFLAG = -Xlinker -soname=SONAME
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
388
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
389 # Build shared library
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
390 SHARED_FLAG = -shared $(VM_PICFLAG)
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
391
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
392 # Keep symbols even they are not used
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
393 AOUT_FLAGS += -Xlinker -export-dynamic
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
394 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
395
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
396 #------------------------------------------------------------------------
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
397 # Debug flags
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
398
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
399 ifeq ($(USE_CLANG), true)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
400 # Restrict the debug information created by Clang to avoid
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
401 # too big object files and speed the build up a little bit
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
402 # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
403 CFLAGS += -flimit-debug-info
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
404 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
405
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
406 # DEBUG_BINARIES uses full -g debug information for all configs
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
407 ifeq ($(DEBUG_BINARIES), true)
10398
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
408 CFLAGS += -g
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
409 else
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
410 # Use the stabs format for debugging information (this is the default
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
411 # on gcc-2.91). It's good enough, has all the information about line
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
412 # numbers and local variables, and libjvm.so is only about 16M.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
413 # Change this back to "-g" if you want the most expressive format.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
414 # (warning: that could easily inflate libjvm.so to 150M!)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
415 # Note: The Itanium gcc compiler crashes when using -gstabs.
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
416 DEBUG_CFLAGS/ia64 = -g
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
417 DEBUG_CFLAGS/amd64 = -g
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
418 DEBUG_CFLAGS/arm = -g
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
419 DEBUG_CFLAGS/ppc = -g
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
420 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
421 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
422 DEBUG_CFLAGS += -gstabs
2cb5d5f6d5e5 8015252: Enable HotSpot build with Clang
simonis
parents: 8723
diff changeset
423 endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
424 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
425
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
426 # If we are building HEADLESS, pass on to VM
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
427 # so it can set the java.awt.headless property
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
428 ifdef HEADLESS
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
429 CFLAGS += -DHEADLESS
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
430 endif
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
431
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
432 # We are building Embedded for a small device
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
433 # favor code space over speed
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
434 ifdef MINIMIZE_RAM_USAGE
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
435 CFLAGS += -DMINIMIZE_RAM_USAGE
f08d439fab8c 7089790: integrate bsd-port changes
never
parents:
diff changeset
436 endif