1 # 2 # Copyright (c) 2013, 2025, 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 ################################################################################ 27 28 include MakeIncludeStart.gmk 29 ifeq ($(INCLUDE), true) 30 31 ################################################################################ 32 # Setup CFLAGS and EXCLUDES for the libjvm compilation, depending on which 33 # jvm features are selected for this jvm variant. 34 ################################################################################ 35 36 ifeq ($(call check-jvm-feature, compiler1), true) 37 JVM_CFLAGS_FEATURES += -DCOMPILER1 38 else 39 JVM_EXCLUDE_PATTERNS += c1_ c1/ 40 endif 41 42 ifeq ($(call check-jvm-feature, compiler2), true) 43 JVM_CFLAGS_FEATURES += -DCOMPILER2 44 JVM_SRC_DIRS += $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles 45 else 46 JVM_EXCLUDES += opto libadt 47 JVM_EXCLUDE_FILES += bcEscapeAnalyzer.cpp ciTypeFlow.cpp 48 JVM_EXCLUDE_PATTERNS += c2_ runtime_ /c2/ 49 endif 50 51 ifeq ($(call check-jvm-feature, zero), true) 52 JVM_EXCLUDES += opto libadt 53 JVM_EXCLUDE_PATTERNS += c1_ c1/ c2_ runtime_ /c2/ 54 JVM_EXCLUDE_FILES += templateInterpreter.cpp templateInterpreterGenerator.cpp \ 55 bcEscapeAnalyzer.cpp ciTypeFlow.cpp macroAssembler_common.cpp 56 JVM_CFLAGS_FEATURES += -DZERO -DZERO_LIBARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' $(LIBFFI_CFLAGS) 57 JVM_LIBS_FEATURES += $(LIBFFI_LIBS) 58 ifeq ($(ENABLE_LIBFFI_BUNDLING), true) 59 JVM_LDFLAGS_FEATURES += $(call SET_EXECUTABLE_ORIGIN,/..) 60 endif 61 else 62 JVM_EXCLUDE_PATTERNS += /zero/ 63 endif 64 65 ifeq ($(JVM_VARIANT), core) 66 JVM_CFLAGS_FEATURES += -DVMTYPE=\"Core\" 67 endif 68 69 ifeq ($(JVM_VARIANT), custom) 70 JVM_CFLAGS_FEATURES += -DVMTYPE=\"Custom\" 71 endif 72 73 ifeq ($(call check-jvm-feature, minimal), true) 74 JVM_CFLAGS_FEATURES += -DMINIMAL_JVM -DVMTYPE=\"Minimal\" 75 ifeq ($(call isTargetOs, linux), true) 76 # Override the default -g with a more liberal strip policy for the 77 # minimal JVM 78 JVM_STRIPFLAGS := --strip-unneeded 79 endif 80 endif 81 82 ifeq ($(call check-jvm-feature, dtrace), true) 83 JVM_CFLAGS_FEATURES += -DDTRACE_ENABLED 84 endif 85 86 ifneq ($(call check-jvm-feature, jvmti), true) 87 JVM_CFLAGS_FEATURES += -DINCLUDE_JVMTI=0 88 JVM_EXCLUDE_FILES += jvmtiGetLoadedClasses.cpp jvmtiThreadState.cpp \ 89 jvmtiExtensions.cpp jvmtiImpl.cpp jvmtiManageCapabilities.cpp \ 90 jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp jvmtiCodeBlobEvents.cpp \ 91 jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp \ 92 jvmtiEnvThreadState.cpp jvmtiTagMap.cpp jvmtiEventController.cpp \ 93 evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \ 94 jvmtiClassFileReconstituter.cpp jvmtiTagMapTable.cpp jvmtiAgent.cpp \ 95 jvmtiAgentList.cpp jfrJvmtiAgent.cpp 96 endif 97 98 ifneq ($(call check-jvm-feature, jvmci), true) 99 JVM_CFLAGS_FEATURES += -DINCLUDE_JVMCI=0 100 JVM_EXCLUDES += jvmci 101 JVM_EXCLUDE_FILES += jvmciCodeInstaller_$(HOTSPOT_TARGET_CPU_ARCH).cpp 102 endif 103 104 ifneq ($(call check-jvm-feature, vm-structs), true) 105 JVM_CFLAGS_FEATURES += -DINCLUDE_VM_STRUCTS=0 106 JVM_EXCLUDE_FILES += vmStructs.cpp 107 endif 108 109 ifneq ($(call check-jvm-feature, jni-check), true) 110 JVM_CFLAGS_FEATURES += -DINCLUDE_JNI_CHECK=0 111 JVM_EXCLUDE_FILES += jniCheck.cpp 112 endif 113 114 ifneq ($(call check-jvm-feature, services), true) 115 JVM_CFLAGS_FEATURES += -DINCLUDE_SERVICES=0 116 JVM_EXCLUDE_FILES += heapDumper.cpp heapInspection.cpp \ 117 attachListener_$(HOTSPOT_TARGET_OS).cpp attachListener.cpp 118 endif 119 120 ifneq ($(call check-jvm-feature, management), true) 121 JVM_CFLAGS_FEATURES += -DINCLUDE_MANAGEMENT=0 122 endif 123 124 ifneq ($(call check-jvm-feature, cds), true) 125 JVM_CFLAGS_FEATURES += -DINCLUDE_CDS=0 126 JVM_EXCLUDE_FILES += \ 127 classLoaderDataShared.cpp \ 128 classLoaderExt.cpp \ 129 systemDictionaryShared.cpp 130 JVM_EXCLUDE_PATTERNS += cds/ 131 endif 132 133 ifneq ($(call check-jvm-feature, g1gc), true) 134 JVM_CFLAGS_FEATURES += -DINCLUDE_G1GC=0 135 JVM_EXCLUDE_PATTERNS += gc/g1 136 endif 137 138 ifneq ($(call check-jvm-feature, parallelgc), true) 139 JVM_CFLAGS_FEATURES += -DINCLUDE_PARALLELGC=0 140 JVM_EXCLUDE_PATTERNS += gc/parallel 141 endif 142 143 ifneq ($(call check-jvm-feature, serialgc), true) 144 JVM_CFLAGS_FEATURES += -DINCLUDE_SERIALGC=0 145 JVM_EXCLUDE_PATTERNS += gc/serial 146 endif 147 148 ifneq ($(call check-jvm-feature, epsilongc), true) 149 JVM_CFLAGS_FEATURES += -DINCLUDE_EPSILONGC=0 150 JVM_EXCLUDE_PATTERNS += gc/epsilon 151 endif 152 153 ifneq ($(call check-jvm-feature, zgc), true) 154 JVM_CFLAGS_FEATURES += -DINCLUDE_ZGC=0 155 JVM_EXCLUDE_PATTERNS += gc/z 156 endif 157 158 ifneq ($(call check-jvm-feature, shenandoahgc), true) 159 JVM_CFLAGS_FEATURES += -DINCLUDE_SHENANDOAHGC=0 160 JVM_EXCLUDE_PATTERNS += gc/shenandoah 161 endif 162 163 ifneq ($(call check-jvm-feature, jfr), true) 164 JVM_CFLAGS_FEATURES += -DINCLUDE_JFR=0 165 JVM_EXCLUDE_PATTERNS += jfr 166 JVM_EXCLUDE_FILES += compilerEvent.cpp 167 endif 168 169 ################################################################################ 170 171 ifeq ($(call check-jvm-feature, link-time-opt), true) 172 # Set JVM_OPTIMIZATION directly so other jvm-feature flags can override it 173 # later on if desired 174 JVM_OPTIMIZATION := HIGHEST_JVM 175 ifeq ($(call isCompiler, gcc), true) 176 JVM_CFLAGS_FEATURES += -flto=auto -fuse-linker-plugin -fno-strict-aliasing \ 177 -fno-fat-lto-objects 178 JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto=auto \ 179 -fuse-linker-plugin -fno-strict-aliasing 180 else ifeq ($(call isCompiler, clang), true) 181 JVM_CFLAGS_FEATURES += -flto -fno-strict-aliasing 182 ifeq ($(call isBuildOs, aix), true) 183 JVM_CFLAGS_FEATURES += -ffat-lto-objects 184 endif 185 JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto -fno-strict-aliasing 186 else ifeq ($(call isCompiler, microsoft), true) 187 JVM_CFLAGS_FEATURES += -GL 188 JVM_LDFLAGS_FEATURES += -LTCG:INCREMENTAL 189 endif 190 else 191 ifeq ($(call isCompiler, gcc), true) 192 JVM_LDFLAGS_FEATURES += -O1 193 endif 194 endif 195 196 ifeq ($(call check-jvm-feature, opt-size), true) 197 JVM_OPTIMIZATION := SIZE 198 OPT_SPEED_SRC := \ 199 allocation.cpp \ 200 assembler.cpp \ 201 barrierSet.cpp \ 202 basicLock.cpp \ 203 bytecode.cpp \ 204 bytecodeInterpreter.cpp \ 205 c1_Compilation.cpp \ 206 c1_Compiler.cpp \ 207 c1_GraphBuilder.cpp \ 208 c1_LinearScan.cpp \ 209 c1_LIR.cpp \ 210 ciEnv.cpp \ 211 ciObjectFactory.cpp \ 212 codeBlob.cpp \ 213 constantPool.cpp \ 214 constMethod.cpp \ 215 classLoader.cpp \ 216 classLoaderData.cpp \ 217 classFileParser.cpp \ 218 classFileStream.cpp \ 219 cpCache.cpp \ 220 defNewGeneration.cpp \ 221 frame_arm.cpp \ 222 frame_aarch64.cpp \ 223 frame_ppc.cpp \ 224 frame_s390.cpp \ 225 frame_x86.cpp \ 226 generation.cpp \ 227 growableArray.cpp \ 228 handles.cpp \ 229 heap.cpp \ 230 icache.cpp \ 231 icache_arm.cpp \ 232 icache_aarch64.cpp \ 233 icache_ppc.cpp \ 234 icache_s390.cpp \ 235 icache_x86.cpp \ 236 instanceKlass.cpp \ 237 invocationCounter.cpp \ 238 iterator.cpp \ 239 javaCalls.cpp \ 240 javaClasses.cpp \ 241 jniFastGetField_arm.cpp \ 242 jvm.cpp \ 243 linkResolver.cpp \ 244 klass.cpp \ 245 klassVtable.cpp \ 246 memRegion.cpp \ 247 memoryPool.cpp \ 248 method.cpp \ 249 methodHandles.cpp \ 250 methodHandles_arm.cpp \ 251 methodLiveness.cpp \ 252 metaspace.cpp \ 253 mutex.cpp \ 254 mutexLocker.cpp \ 255 nativeLookup.cpp \ 256 objArrayKlass.cpp \ 257 os_linux.cpp \ 258 os_linux_arm.cpp \ 259 resourceArea.cpp \ 260 rewriter.cpp \ 261 sharedRuntime.cpp \ 262 signature.cpp \ 263 space.cpp \ 264 stackMapTable.cpp \ 265 symbolTable.cpp \ 266 systemDictionary.cpp \ 267 symbol.cpp \ 268 synchronizer.cpp \ 269 timer.cpp \ 270 typeArrayKlass.cpp \ 271 unsafe.cpp \ 272 utf8.cpp \ 273 vmSymbols.cpp \ 274 # 275 276 $(foreach s, $(OPT_SPEED_SRC), \ 277 $(eval BUILD_LIBJVM_$s_OPTIMIZATION := HIGHEST_JVM)) 278 279 ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), ) 280 BUILD_LIBJVM_systemDictionary.cpp_CXXFLAGS := -fno-optimize-sibling-calls 281 endif 282 endif 283 284 ################################################################################ 285 286 endif # include guard 287 include MakeIncludeEnd.gmk