1 #
   2 # Copyright (c) 2013, 2016, 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/JvmFeatures.gmk))
  27 
  28 ################################################################################
  29 # Setup CFLAGS and EXCLUDES for the libjvm compilation, depending on which
  30 # jvm features are selected for this jvm variant.
  31 
  32 ifeq ($(call check-jvm-feature, compiler1), true)
  33   JVM_CFLAGS_FEATURES += -DCOMPILER1
  34 else
  35   JVM_EXCLUDE_PATTERNS += c1_
  36 endif
  37 
  38 ifeq ($(call check-jvm-feature, compiler2), true)
  39   JVM_CFLAGS_FEATURES += -DCOMPILER2
  40   JVM_SRC_DIRS += $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles
  41 else
  42   JVM_EXCLUDES += opto libadt
  43   JVM_EXCLUDE_FILES += bcEscapeAnalyzer.cpp ciTypeFlow.cpp
  44   JVM_EXCLUDE_PATTERNS += c2_ runtime_
  45 endif
  46 
  47 ifeq ($(call check-jvm-feature, zero), true)
  48   JVM_CFLAGS_FEATURES += -DZERO -DCC_INTERP -DZERO_LIBARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' $(LIBFFI_CFLAGS)
  49   JVM_LIBS_FEATURES += $(LIBFFI_LIBS)
  50 endif
  51 
  52 ifeq ($(call check-jvm-feature, shark), true)
  53   JVM_CFLAGS_FEATURES += -DSHARK $(LLVM_CFLAGS)
  54   JVM_LDFLAGS_FEATURES += $(LLVM_LDFLAGS)
  55   JVM_LIBS_FEATURES += $(LLVM_LIBS)
  56 else
  57   JVM_EXCLUDES += shark
  58 endif
  59 
  60 ifeq ($(call check-jvm-feature, minimal), true)
  61   JVM_CFLAGS_FEATURES += -DMINIMAL_JVM -DVMTYPE=\"Minimal\"
  62   ifeq ($(OPENJDK_TARGET_OS), linux)
  63     JVM_STRIPFLAGS := $(STRIPFLAGS) --strip-unneeded
  64   endif
  65 endif
  66 
  67 ifeq ($(call check-jvm-feature, dtrace), true)
  68   JVM_CFLAGS_FEATURES += -DDTRACE_ENABLED
  69 endif
  70 
  71 ifeq ($(call check-jvm-feature, static-build), true)
  72   JVM_CFLAGS_FEATURES += -DSTATIC_BUILD=1
  73 endif
  74 
  75 ifneq ($(call check-jvm-feature, jvmti), true)
  76   JVM_CFLAGS_FEATURES += -DINCLUDE_JVMTI=0
  77   JVM_EXCLUDE_FILES += jvmtiGetLoadedClasses.cpp jvmtiThreadState.cpp jvmtiExtensions.cpp \
  78       jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \
  79       jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \
  80       jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \
  81       jvmtiClassFileReconstituter.cpp
  82 endif
  83 
  84 ifneq ($(call check-jvm-feature, jvmci), true)
  85   JVM_CFLAGS_FEATURES += -DINCLUDE_JVMCI=0
  86   JVM_EXCLUDES += jvmci
  87   JVM_EXCLUDE_FILES += jvmciCodeInstaller_$(HOTSPOT_TARGET_CPU_ARCH).cpp
  88 endif
  89 
  90 ifneq ($(call check-jvm-feature, fprof), true)
  91   JVM_CFLAGS_FEATURES += -DINCLUDE_FPROF=0
  92   JVM_EXCLUDE_FILES += fprofiler.cpp
  93 endif
  94 
  95 ifneq ($(call check-jvm-feature, vm-structs), true)
  96   JVM_CFLAGS_FEATURES += -DINCLUDE_VM_STRUCTS=0
  97   JVM_EXCLUDE_FILES += vmStructs.cpp
  98 endif
  99 
 100 ifneq ($(call check-jvm-feature, jni-check), true)
 101   JVM_CFLAGS_FEATURES += -DINCLUDE_JNI_CHECK=0
 102   JVM_EXCLUDE_FILES += jniCheck.cpp
 103 endif
 104 
 105 ifneq ($(call check-jvm-feature, services), true)
 106   JVM_CFLAGS_FEATURES += -DINCLUDE_SERVICES=0
 107   JVM_EXCLUDE_FILES += heapDumper.cpp heapInspection.cpp \
 108       attachListener_$(HOTSPOT_TARGET_OS).cpp attachListener.cpp
 109 endif
 110 
 111 ifneq ($(call check-jvm-feature, management), true)
 112   JVM_CFLAGS_FEATURES += -DINCLUDE_MANAGEMENT=0
 113 endif
 114 
 115 ifneq ($(call check-jvm-feature, cds), true)
 116   JVM_CFLAGS_FEATURES += -DINCLUDE_CDS=0
 117   JVM_EXCLUDE_FILES += \
 118       classListParser.cpp \
 119       classLoaderExt.cpp \
 120       filemap.cpp \
 121       metaspaceShared.cpp \
 122       metaspaceShared_$(HOTSPOT_TARGET_CPU).cpp \
 123       metaspaceShared_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
 124       sharedClassUtil.cpp \
 125       sharedPathsMiscInfo.cpp \
 126       systemDictionaryShared.cpp \
 127       #
 128 endif
 129 
 130 ifneq ($(call check-jvm-feature, all-gcs), true)
 131   JVM_CFLAGS_FEATURES += -DINCLUDE_ALL_GCS=0
 132   JVM_EXCLUDE_PATTERNS += \
 133       cms/ g1/ parallel/
 134   JVM_EXCLUDE_FILES += \
 135       concurrentGCThread.cpp \
 136       plab.cpp
 137   JVM_EXCLUDE_FILES += \
 138       g1MemoryPool.cpp \
 139       psMemoryPool.cpp
 140 endif
 141 
 142 ifneq ($(call check-jvm-feature, nmt), true)
 143   JVM_CFLAGS_FEATURES += -DINCLUDE_NMT=0
 144   JVM_EXCLUDE_FILES += \
 145       memBaseline.cpp memReporter.cpp mallocTracker.cpp virtualMemoryTracker.cpp nmtCommon.cpp \
 146       memTracker.cpp nmtDCmd.cpp mallocSiteTable.cpp
 147 endif