1 #
   2 # Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  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.
  10 #
  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).
  16 #
  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.
  20 #
  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
  23 # questions.
  24 #
  25 
  26 $(eval $(call IncludeCustomExtension, hotspot/lib/JvmFlags.gmk))
  27 
  28 ################################################################################
  29 # Setup JVM_CFLAGS. These are shared between GensrcDtrace.gmk and CompileJvm.gmk.
  30 
  31 # This variable may be added to by a custom extension
  32 JVM_SRC_ROOTS += $(TOPDIR)/src/hotspot
  33 
  34 JVM_SRC_DIRS += $(call uniq, $(wildcard $(foreach d, $(JVM_SRC_ROOTS), \
  35         $d/share \
  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) \
  40     ))) \
  41     $(JVM_VARIANT_OUTPUTDIR)/gensrc
  42     #
  43 
  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 \
  52     #
  53 
  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)"' \
  67     #
  68 
  69 ifeq ($(DEBUG_LEVEL), release)
  70   # For hotspot, release builds differ internally between "optimized" and "product"
  71   # in that "optimize" does not define PRODUCT.
  72   ifneq ($(HOTSPOT_DEBUG_LEVEL), optimized)
  73     JVM_CFLAGS_DEBUGLEVEL := -DPRODUCT
  74   endif
  75 else ifeq ($(DEBUG_LEVEL), fastdebug)
  76   JVM_CFLAGS_DEBUGLEVEL := -DASSERT
  77   ifeq ($(filter $(OPENJDK_TARGET_OS), windows aix), )
  78     # NOTE: Old build did not define CHECK_UNHANDLED_OOPS on Windows and AIX.
  79     JVM_CFLAGS_DEBUGLEVEL += -DCHECK_UNHANDLED_OOPS
  80   endif
  81 else ifeq ($(DEBUG_LEVEL), slowdebug)
  82   # _NMT_NOINLINE_ informs NMT that no inlining is done by the compiler
  83   JVM_CFLAGS_DEBUGLEVEL := -DASSERT -D_NMT_NOINLINE_
  84 endif
  85 
  86 JVM_CFLAGS += \
  87     $(JVM_CFLAGS_DEBUGLEVEL) \
  88     $(JVM_CFLAGS_TARGET_DEFINES) \
  89     $(JVM_CFLAGS_FEATURES) \
  90     $(JVM_CFLAGS_INCLUDES) \
  91     $(SOFTFLOAT_CFLAGS) \
  92     $(EXTRA_CFLAGS) \
  93     #
  94 
  95 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
  96 ifeq ($(USE_PRECOMPILED_HEADER), false)
  97   JVM_CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
  98 endif
  99 
 100 ifneq ($(HOTSPOT_OVERRIDE_LIBPATH), )
 101   JVM_CFLAGS += -DOVERRIDE_LIBPATH='"$(HOTSPOT_OVERRIDE_LIBPATH)"'
 102 endif