2
# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation. Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
26
$(eval $(call IncludeCustomExtension, hotspot/lib/JvmFlags.gmk))
28
################################################################################
29
# Setup JVM_CFLAGS. These are shared between GensrcDtrace.gmk and CompileJvm.gmk.
31
# This variable may be added to by a custom extension
32
JVM_SRC_ROOTS += $(TOPDIR)/src/hotspot
34
JVM_SRC_DIRS += $(call uniq, $(wildcard $(foreach d, $(JVM_SRC_ROOTS), \
36
$d/os/$(HOTSPOT_TARGET_OS) \
37
$d/os/$(HOTSPOT_TARGET_OS_TYPE) \
38
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH) \
39
$d/os_cpu/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH) \
41
$(JVM_VARIANT_OUTPUTDIR)/gensrc
44
JVM_CFLAGS_INCLUDES += \
45
$(patsubst %,-I%,$(JVM_SRC_DIRS)) \
46
-I$(TOPDIR)/src/hotspot/share/precompiled \
47
-I$(TOPDIR)/src/hotspot/share/include \
48
-I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
49
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
50
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
51
-I$(TOPDIR)/src/java.base/share/native/libjimage \
54
# INCLUDE_SUFFIX_* is only meant for including the proper
55
# platform files. Don't use it to guard code. Use the value of
56
# HOTSPOT_TARGET_CPU_DEFINE etc. instead.
57
# Remaining TARGET_ARCH_* is needed to select the cpu specific
58
# sources for 64-bit ARM ports (arm versus aarch64).
59
JVM_CFLAGS_TARGET_DEFINES += \
60
-DTARGET_ARCH_$(HOTSPOT_TARGET_CPU_ARCH) \
61
-DINCLUDE_SUFFIX_OS=_$(HOTSPOT_TARGET_OS) \
62
-DINCLUDE_SUFFIX_CPU=_$(HOTSPOT_TARGET_CPU_ARCH) \
63
-DINCLUDE_SUFFIX_COMPILER=_$(HOTSPOT_TOOLCHAIN_TYPE) \
64
-DTARGET_COMPILER_$(HOTSPOT_TOOLCHAIN_TYPE) \
65
-D$(HOTSPOT_TARGET_CPU_DEFINE) \
66
-DHOTSPOT_LIB_ARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' \
69
ifeq ($(DEBUG_LEVEL), release)
70
# release builds disable uses of assert macro from <assert.h>.
71
JVM_CFLAGS_DEBUGLEVEL := -DNDEBUG
72
# For hotspot, release builds differ internally between "optimized" and "product"
73
# in that "optimize" does not define PRODUCT.
74
ifneq ($(HOTSPOT_DEBUG_LEVEL), optimized)
75
JVM_CFLAGS_DEBUGLEVEL += -DPRODUCT
77
else ifeq ($(DEBUG_LEVEL), fastdebug)
78
JVM_CFLAGS_DEBUGLEVEL := -DASSERT
79
ifeq ($(call isTargetOs, aix), false)
80
# NOTE: Old build did not define CHECK_UNHANDLED_OOPS on AIX.
81
JVM_CFLAGS_DEBUGLEVEL += -DCHECK_UNHANDLED_OOPS
83
else ifeq ($(DEBUG_LEVEL), slowdebug)
84
# _NMT_NOINLINE_ informs NMT that no inlining is done by the compiler
85
JVM_CFLAGS_DEBUGLEVEL := -DASSERT -D_NMT_NOINLINE_
89
$(JVM_CFLAGS_DEBUGLEVEL) \
90
$(JVM_CFLAGS_TARGET_DEFINES) \
91
$(JVM_CFLAGS_FEATURES) \
92
$(JVM_CFLAGS_INCLUDES) \
96
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
97
ifeq ($(USE_PRECOMPILED_HEADER), false)
98
JVM_CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
101
ifneq ($(HOTSPOT_OVERRIDE_LIBPATH), )
102
JVM_CFLAGS += -DOVERRIDE_LIBPATH='"$(HOTSPOT_OVERRIDE_LIBPATH)"'
105
ifeq ($(ENABLE_COMPATIBLE_CDS_ALIGNMENT), true)
106
JVM_CFLAGS += -DCOMPATIBLE_CDS_ALIGNMENT