Dan Bornstein | 4212241 | 2009-07-21 16:08:39 -0700 | [diff] [blame] | 1 | # Copyright (C) 2008 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | # |
| 16 | # Common definitions for host or target builds of libdvm. |
| 17 | # |
| 18 | # If you enable or disable optional features here, |
| 19 | # rebuild the VM with "make clean-libdvm && make -j4 libdvm". |
| 20 | # |
| 21 | |
| 22 | |
| 23 | # |
| 24 | # Compiler defines. |
| 25 | # |
| 26 | LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps |
| 27 | |
| 28 | # |
| 29 | # Optional features. These may impact the size or performance of the VM. |
| 30 | # |
| 31 | LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER |
| 32 | |
| 33 | # 0=full cache, 1/2=reduced, 3=no cache |
| 34 | LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0 |
| 35 | |
| 36 | ifeq ($(WITH_DEADLOCK_PREDICTION),true) |
| 37 | LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION |
| 38 | WITH_MONITOR_TRACKING := true |
| 39 | endif |
| 40 | ifeq ($(WITH_MONITOR_TRACKING),true) |
| 41 | LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING |
| 42 | endif |
| 43 | |
| 44 | # Make a debugging version when building the simulator (if not told |
| 45 | # otherwise) and when explicitly asked. |
| 46 | dvm_make_debug_vm := false |
| 47 | ifeq ($(strip $(DEBUG_DALVIK_VM)),) |
| 48 | ifeq ($(dvm_simulator),true) |
| 49 | dvm_make_debug_vm := true |
| 50 | endif |
| 51 | else |
| 52 | dvm_make_debug_vm := $(DEBUG_DALVIK_VM) |
| 53 | endif |
| 54 | |
| 55 | ifeq ($(dvm_make_debug_vm),true) |
| 56 | # |
| 57 | # "Debug" profile: |
| 58 | # - debugger enabled |
| 59 | # - profiling enabled |
| 60 | # - tracked-reference verification enabled |
| 61 | # - allocation limits enabled |
| 62 | # - GDB helpers enabled |
| 63 | # - LOGV |
| 64 | # - assert() |
| 65 | # |
| 66 | LOCAL_CFLAGS += -DWITH_INSTR_CHECKS |
| 67 | LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION |
| 68 | LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS |
| 69 | LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS |
| 70 | LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1 |
| 71 | #LOCAL_CFLAGS += -DCHECK_MUTEX |
| 72 | #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS |
| 73 | LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3 |
| 74 | # add some extra stuff to make it easier to examine with GDB |
| 75 | LOCAL_CFLAGS += -DEASY_GDB |
| 76 | # overall config may be for a "release" build, so reconfigure these |
| 77 | LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT |
| 78 | else # !dvm_make_debug_vm |
| 79 | # |
| 80 | # "Performance" profile: |
| 81 | # - all development features disabled |
| 82 | # - compiler optimizations enabled (redundant for "release" builds) |
| 83 | # - (debugging and profiling still enabled) |
| 84 | # |
| 85 | #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1 |
| 86 | # "-O2" is redundant for device (release) but useful for sim (debug) |
| 87 | #LOCAL_CFLAGS += -O2 -Winline |
| 88 | #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION |
| 89 | LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1 |
| 90 | LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1 |
| 91 | # if you want to try with assertions on the device, add: |
| 92 | #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT |
| 93 | endif # !dvm_make_debug_vm |
| 94 | |
| 95 | # bug hunting: checksum and verify interpreted stack when making JNI calls |
| 96 | #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK |
| 97 | |
| 98 | LOCAL_SRC_FILES := \ |
| 99 | AllocTracker.c \ |
| 100 | AtomicCache.c \ |
| 101 | CheckJni.c \ |
| 102 | Ddm.c \ |
| 103 | Debugger.c \ |
| 104 | DvmDex.c \ |
| 105 | Exception.c \ |
| 106 | Hash.c \ |
| 107 | IndirectRefTable.c.arm \ |
| 108 | Init.c \ |
| 109 | InlineNative.c.arm \ |
| 110 | Inlines.c \ |
| 111 | Intern.c \ |
| 112 | Jni.c \ |
| 113 | JarFile.c \ |
| 114 | LinearAlloc.c \ |
| 115 | Misc.c.arm \ |
| 116 | Native.c \ |
| 117 | PointerSet.c \ |
| 118 | Profile.c \ |
| 119 | Properties.c \ |
| 120 | RawDexFile.c \ |
| 121 | ReferenceTable.c \ |
| 122 | SignalCatcher.c \ |
| 123 | StdioConverter.c \ |
| 124 | Sync.c \ |
| 125 | Thread.c \ |
| 126 | UtfString.c \ |
| 127 | alloc/clz.c.arm \ |
| 128 | alloc/Alloc.c \ |
| 129 | alloc/HeapBitmap.c.arm \ |
| 130 | alloc/HeapDebug.c \ |
| 131 | alloc/HeapSource.c \ |
| 132 | alloc/HeapTable.c \ |
| 133 | alloc/HeapWorker.c \ |
| 134 | alloc/Heap.c.arm \ |
| 135 | alloc/MarkSweep.c.arm \ |
| 136 | alloc/DdmHeap.c \ |
| 137 | analysis/CodeVerify.c \ |
| 138 | analysis/DexOptimize.c \ |
| 139 | analysis/DexVerify.c \ |
| 140 | analysis/ReduceConstants.c \ |
| 141 | analysis/RegisterMap.c \ |
| 142 | analysis/VerifySubs.c \ |
| 143 | interp/Interp.c.arm \ |
| 144 | interp/Stack.c \ |
| 145 | jdwp/ExpandBuf.c \ |
| 146 | jdwp/JdwpAdb.c \ |
| 147 | jdwp/JdwpConstants.c \ |
| 148 | jdwp/JdwpEvent.c \ |
| 149 | jdwp/JdwpHandler.c \ |
| 150 | jdwp/JdwpMain.c \ |
| 151 | jdwp/JdwpSocket.c \ |
| 152 | mterp/Mterp.c.arm \ |
| 153 | mterp/out/InterpC-portstd.c.arm \ |
| 154 | mterp/out/InterpC-portdbg.c.arm \ |
| 155 | native/InternalNative.c \ |
| 156 | native/dalvik_system_DexFile.c \ |
| 157 | native/dalvik_system_SamplingProfiler.c \ |
| 158 | native/dalvik_system_VMDebug.c \ |
| 159 | native/dalvik_system_VMRuntime.c \ |
| 160 | native/dalvik_system_VMStack.c \ |
| 161 | native/dalvik_system_Zygote.c \ |
| 162 | native/java_lang_Class.c \ |
| 163 | native/java_lang_Object.c \ |
| 164 | native/java_lang_Runtime.c \ |
| 165 | native/java_lang_String.c \ |
| 166 | native/java_lang_System.c \ |
| 167 | native/java_lang_SystemProperties.c \ |
| 168 | native/java_lang_Throwable.c \ |
| 169 | native/java_lang_VMClassLoader.c \ |
| 170 | native/java_lang_VMThread.c \ |
| 171 | native/java_lang_reflect_AccessibleObject.c \ |
| 172 | native/java_lang_reflect_Array.c \ |
| 173 | native/java_lang_reflect_Constructor.c \ |
| 174 | native/java_lang_reflect_Field.c \ |
| 175 | native/java_lang_reflect_Method.c \ |
| 176 | native/java_lang_reflect_Proxy.c \ |
| 177 | native/java_security_AccessController.c \ |
| 178 | native/java_util_concurrent_atomic_AtomicLong.c \ |
| 179 | native/org_apache_harmony_dalvik_NativeTestTarget.c \ |
| 180 | native/org_apache_harmony_dalvik_ddmc_DdmServer.c \ |
| 181 | native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \ |
| 182 | native/sun_misc_Unsafe.c \ |
| 183 | oo/AccessCheck.c \ |
| 184 | oo/Array.c \ |
| 185 | oo/Class.c \ |
| 186 | oo/Object.c \ |
| 187 | oo/Resolve.c \ |
| 188 | oo/TypeCheck.c \ |
| 189 | reflect/Annotation.c \ |
| 190 | reflect/Proxy.c \ |
| 191 | reflect/Reflect.c \ |
| 192 | test/AtomicSpeed.c \ |
| 193 | test/TestHash.c \ |
| 194 | test/TestIndirectRefTable.c |
| 195 | |
Ben Cheng | 3f02aa4 | 2009-08-14 13:52:09 -0700 | [diff] [blame^] | 196 | WITH_JIT := $(strip $(WITH_JIT)) |
Dan Bornstein | 4212241 | 2009-07-21 16:08:39 -0700 | [diff] [blame] | 197 | |
| 198 | ifeq ($(WITH_JIT),true) |
Dan Bornstein | 4212241 | 2009-07-21 16:08:39 -0700 | [diff] [blame] | 199 | LOCAL_CFLAGS += -DWITH_JIT |
Ben Cheng | 3f02aa4 | 2009-08-14 13:52:09 -0700 | [diff] [blame^] | 200 | # Enable assert and JIT_TUNING for now |
| 201 | LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT |
| 202 | WITH_JIT_TUNING := true |
Dan Bornstein | 4212241 | 2009-07-21 16:08:39 -0700 | [diff] [blame] | 203 | LOCAL_SRC_FILES += \ |
| 204 | ../dexdump/OpCodeNames.c \ |
| 205 | compiler/Compiler.c \ |
| 206 | compiler/Frontend.c \ |
| 207 | compiler/Utility.c \ |
| 208 | compiler/IntermediateRep.c \ |
| 209 | interp/Jit.c |
| 210 | endif |
| 211 | |
Ben Cheng | 3f02aa4 | 2009-08-14 13:52:09 -0700 | [diff] [blame^] | 212 | ifeq ($(strip $(WITH_JIT_TUNING)),true) |
| 213 | LOCAL_CFLAGS += -DWITH_JIT_TUNING |
| 214 | endif |
| 215 | |
Dan Bornstein | 4212241 | 2009-07-21 16:08:39 -0700 | [diff] [blame] | 216 | WITH_HPROF := $(strip $(WITH_HPROF)) |
| 217 | ifeq ($(WITH_HPROF),) |
| 218 | WITH_HPROF := true |
| 219 | endif |
| 220 | ifeq ($(WITH_HPROF),true) |
| 221 | LOCAL_SRC_FILES += \ |
| 222 | hprof/Hprof.c \ |
| 223 | hprof/HprofClass.c \ |
| 224 | hprof/HprofHeap.c \ |
| 225 | hprof/HprofOutput.c \ |
| 226 | hprof/HprofString.c |
| 227 | LOCAL_CFLAGS += -DWITH_HPROF=1 |
| 228 | |
| 229 | ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true) |
| 230 | LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1 |
| 231 | endif |
| 232 | |
| 233 | ifeq ($(strip $(WITH_HPROF_STACK)),true) |
| 234 | LOCAL_SRC_FILES += \ |
| 235 | hprof/HprofStack.c \ |
| 236 | hprof/HprofStackFrame.c |
| 237 | LOCAL_CFLAGS += -DWITH_HPROF_STACK=1 |
| 238 | endif # WITH_HPROF_STACK |
| 239 | endif # WITH_HPROF |
| 240 | |
| 241 | ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true) |
| 242 | LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1 |
| 243 | endif |
| 244 | |
| 245 | LOCAL_C_INCLUDES += \ |
| 246 | $(JNI_H_INCLUDE) \ |
| 247 | dalvik \ |
| 248 | dalvik/vm \ |
| 249 | external/zlib \ |
| 250 | $(KERNEL_HEADERS) |
| 251 | |
| 252 | |
| 253 | ifeq ($(dvm_simulator),true) |
| 254 | LOCAL_LDLIBS += -lpthread -ldl |
| 255 | ifeq ($(HOST_OS),linux) |
| 256 | # need this for clock_gettime() in profiling |
| 257 | LOCAL_LDLIBS += -lrt |
| 258 | endif |
| 259 | else |
| 260 | ifeq ($(dvm_os),linux) |
| 261 | LOCAL_SHARED_LIBRARIES += libdl |
| 262 | endif |
| 263 | endif |
| 264 | |
| 265 | MTERP_ARCH_KNOWN := false |
| 266 | |
| 267 | ifeq ($(dvm_arch),arm) |
| 268 | #dvm_arch_variant := armv7-a |
| 269 | #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp |
| 270 | MTERP_ARCH_KNOWN := true |
| 271 | # Select architecture-specific sources (armv4t, armv5te etc.) |
| 272 | LOCAL_SRC_FILES += \ |
| 273 | arch/arm/CallOldABI.S \ |
| 274 | arch/arm/CallEABI.S \ |
| 275 | arch/arm/HintsEABI.c \ |
| 276 | mterp/out/InterpC-$(dvm_arch_variant).c.arm \ |
| 277 | mterp/out/InterpAsm-$(dvm_arch_variant).S |
| 278 | |
| 279 | ifeq ($(WITH_JIT),true) |
| 280 | LOCAL_SRC_FILES += \ |
| 281 | compiler/codegen/arm/Codegen-$(dvm_arch_variant).c \ |
| 282 | compiler/codegen/arm/Assemble.c \ |
| 283 | compiler/codegen/arm/ArchUtility.c \ |
| 284 | compiler/codegen/arm/LocalOptimizations.c \ |
| 285 | compiler/codegen/arm/GlobalOptimizations.c \ |
| 286 | compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S |
| 287 | endif |
| 288 | endif |
| 289 | |
| 290 | ifeq ($(dvm_arch),x86) |
| 291 | ifeq ($(dvm_os),linux) |
| 292 | MTERP_ARCH_KNOWN := true |
| 293 | LOCAL_SRC_FILES += \ |
| 294 | arch/x86/Call386ABI.S \ |
| 295 | arch/x86/Hints386ABI.c \ |
| 296 | mterp/out/InterpC-x86.c \ |
| 297 | mterp/out/InterpAsm-x86.S |
| 298 | endif |
| 299 | endif |
| 300 | |
| 301 | ifeq ($(dvm_arch),sh) |
| 302 | MTERP_ARCH_KNOWN := true |
| 303 | LOCAL_SRC_FILES += \ |
| 304 | arch/sh/CallSH4ABI.S \ |
| 305 | arch/generic/Hints.c \ |
| 306 | mterp/out/InterpC-allstubs.c \ |
| 307 | mterp/out/InterpAsm-allstubs.S |
| 308 | endif |
| 309 | |
| 310 | ifeq ($(MTERP_ARCH_KNOWN),false) |
| 311 | # unknown architecture, try to use FFI |
| 312 | LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch) |
| 313 | LOCAL_SHARED_LIBRARIES += libffi |
| 314 | |
| 315 | LOCAL_SRC_FILES += \ |
| 316 | arch/generic/Call.c \ |
| 317 | arch/generic/Hints.c \ |
| 318 | mterp/out/InterpC-allstubs.c |
| 319 | |
| 320 | # The following symbols are usually defined in the asm file, but |
| 321 | # since we don't have an asm file in this case, we instead just |
| 322 | # peg them at 0 here, and we add an #ifdef'able define for good |
| 323 | # measure, too. |
| 324 | LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \ |
| 325 | -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1 |
| 326 | endif |
| 327 | |
| 328 | LOCAL_SHARED_LIBRARIES += \ |
| 329 | libnativehelper \ |
| 330 | libz |
| 331 | |
| 332 | LOCAL_STATIC_LIBRARIES += \ |
| 333 | libdex |