Android.mk revision 89efc3d632adfa076bd622369b1ad8e4b49cf20e
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# Android.mk for Dalvik VM. If you enable or disable optional features here, 17# rebuild the VM with "make clean-libdvm && make -j4 libdvm". 18# 19LOCAL_PATH:= $(call my-dir) 20include $(CLEAR_VARS) 21 22 23# 24# Compiler defines. 25# 26LOCAL_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# 31LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER 32 33# 0=full cache, 1/2=reduced, 3=no cache 34LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0 35 36ifeq ($(WITH_DEADLOCK_PREDICTION),true) 37 LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION 38 WITH_MONITOR_TRACKING := true 39endif 40ifeq ($(WITH_MONITOR_TRACKING),true) 41 LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING 42endif 43 44# Make DEBUG_DALVIK_VM default to true when building the simulator. 45ifeq ($(TARGET_SIMULATOR),true) 46 ifeq ($(strip $(DEBUG_DALVIK_VM)),) 47 DEBUG_DALVIK_VM := true 48 endif 49endif 50 51ifeq ($(strip $(DEBUG_DALVIK_VM)),true) 52 # 53 # "Debug" profile: 54 # - debugger enabled 55 # - profiling enabled 56 # - tracked-reference verification enabled 57 # - allocation limits enabled 58 # - GDB helpers enabled 59 # - LOGV 60 # - assert() (NDEBUG is handled in the build system) 61 # 62 LOCAL_CFLAGS += -DWITH_INSTR_CHECKS 63 LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION 64 LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS 65 LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS 66 LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1 67 #LOCAL_CFLAGS += -DCHECK_MUTEX 68 #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS 69 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3 70 # add some extra stuff to make it easier to examine with GDB 71 LOCAL_CFLAGS += -DEASY_GDB 72else # !DALVIK_VM_DEBUG 73 # 74 # "Performance" profile: 75 # - all development features disabled 76 # - compiler optimizations enabled (redundant for "release" builds) 77 # - (debugging and profiling still enabled) 78 # 79 #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1 80 # "-O2" is redundant for device (release) but useful for sim (debug) 81 #LOCAL_CFLAGS += -O2 -Winline 82 #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION 83 LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1 84 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1 85 # if you want to try with assertions on the device, add: 86 #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT 87endif # !DALVIK_VM_DEBUG 88 89# bug hunting: checksum and verify interpreted stack when making JNI calls 90#LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK 91 92LOCAL_SRC_FILES := \ 93 AllocTracker.c \ 94 AtomicCache.c \ 95 CheckJni.c \ 96 Ddm.c \ 97 Debugger.c \ 98 DvmDex.c \ 99 Exception.c \ 100 Hash.c \ 101 Init.c \ 102 InlineNative.c.arm \ 103 Inlines.c \ 104 Intern.c \ 105 Jni.c \ 106 JarFile.c \ 107 LinearAlloc.c \ 108 Misc.c.arm \ 109 Native.c \ 110 PointerSet.c \ 111 Profile.c \ 112 Properties.c \ 113 RawDexFile.c \ 114 ReferenceTable.c \ 115 SignalCatcher.c \ 116 StdioConverter.c \ 117 Sync.c \ 118 Thread.c \ 119 UtfString.c \ 120 alloc/clz.c.arm \ 121 alloc/Alloc.c \ 122 alloc/HeapBitmap.c.arm \ 123 alloc/HeapDebug.c \ 124 alloc/HeapSource.c \ 125 alloc/HeapTable.c \ 126 alloc/HeapWorker.c \ 127 alloc/Heap.c.arm \ 128 alloc/MarkSweep.c.arm \ 129 alloc/DdmHeap.c \ 130 analysis/CodeVerify.c \ 131 analysis/DexOptimize.c \ 132 analysis/DexVerify.c \ 133 analysis/ReduceConstants.c \ 134 analysis/RegisterMap.c \ 135 analysis/VerifySubs.c \ 136 interp/Interp.c.arm \ 137 interp/Stack.c \ 138 jdwp/ExpandBuf.c \ 139 jdwp/JdwpAdb.c \ 140 jdwp/JdwpConstants.c \ 141 jdwp/JdwpEvent.c \ 142 jdwp/JdwpHandler.c \ 143 jdwp/JdwpMain.c \ 144 jdwp/JdwpSocket.c \ 145 mterp/Mterp.c.arm \ 146 mterp/out/InterpC-portstd.c.arm \ 147 mterp/out/InterpC-portdbg.c.arm \ 148 native/InternalNative.c \ 149 native/dalvik_system_DexFile.c \ 150 native/dalvik_system_VMDebug.c \ 151 native/dalvik_system_VMRuntime.c \ 152 native/dalvik_system_VMStack.c \ 153 native/dalvik_system_Zygote.c \ 154 native/java_lang_Class.c \ 155 native/java_lang_Object.c \ 156 native/java_lang_Runtime.c \ 157 native/java_lang_String.c \ 158 native/java_lang_System.c \ 159 native/java_lang_SystemProperties.c \ 160 native/java_lang_Throwable.c \ 161 native/java_lang_VMClassLoader.c \ 162 native/java_lang_VMThread.c \ 163 native/java_lang_reflect_AccessibleObject.c \ 164 native/java_lang_reflect_Array.c \ 165 native/java_lang_reflect_Constructor.c \ 166 native/java_lang_reflect_Field.c \ 167 native/java_lang_reflect_Method.c \ 168 native/java_lang_reflect_Proxy.c \ 169 native/java_security_AccessController.c \ 170 native/java_util_concurrent_atomic_AtomicLong.c \ 171 native/org_apache_harmony_dalvik_NativeTestTarget.c \ 172 native/org_apache_harmony_dalvik_ddmc_DdmServer.c \ 173 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \ 174 native/sun_misc_Unsafe.c \ 175 oo/AccessCheck.c \ 176 oo/Array.c \ 177 oo/Class.c \ 178 oo/Object.c \ 179 oo/Resolve.c \ 180 oo/TypeCheck.c \ 181 reflect/Annotation.c \ 182 reflect/Proxy.c \ 183 reflect/Reflect.c \ 184 test/AtomicSpeed.c \ 185 test/TestHash.c 186 187ifeq ($(WITH_JIT_TUNING),true) 188 LOCAL_CFLAGS += -DWITH_JIT_TUNING 189endif 190 191ifeq ($(WITH_JIT),true) 192 # NOTE: Turn on assertion for JIT for now 193 LOCAL_CFLAGS += -DWITH_DALVIK_ASSERT 194 # NOTE: Also turn on tuning when JIT is enabled for now 195 LOCAL_CFLAGS += -DWITH_JIT_TUNING 196 LOCAL_CFLAGS += -DWITH_JIT 197 LOCAL_SRC_FILES += \ 198 ../dexdump/OpCodeNames.c \ 199 compiler/Compiler.c \ 200 compiler/Frontend.c \ 201 compiler/Utility.c \ 202 compiler/IntermediateRep.c \ 203 interp/Jit.c 204endif 205 206WITH_HPROF := $(strip $(WITH_HPROF)) 207ifeq ($(WITH_HPROF),) 208 WITH_HPROF := true 209endif 210ifeq ($(WITH_HPROF),true) 211 LOCAL_SRC_FILES += \ 212 hprof/Hprof.c \ 213 hprof/HprofClass.c \ 214 hprof/HprofHeap.c \ 215 hprof/HprofOutput.c \ 216 hprof/HprofString.c 217 LOCAL_CFLAGS += -DWITH_HPROF=1 218 219 ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true) 220 LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1 221 endif 222 223 ifeq ($(strip $(WITH_HPROF_STACK)),true) 224 LOCAL_SRC_FILES += \ 225 hprof/HprofStack.c \ 226 hprof/HprofStackFrame.c 227 LOCAL_CFLAGS += -DWITH_HPROF_STACK=1 228 endif # WITH_HPROF_STACK 229endif # WITH_HPROF 230 231ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true) 232 LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1 233endif 234 235LOCAL_C_INCLUDES += \ 236 $(JNI_H_INCLUDE) \ 237 dalvik \ 238 dalvik/vm \ 239 external/zlib \ 240 $(KERNEL_HEADERS) 241 242 243ifeq ($(TARGET_SIMULATOR),true) 244 LOCAL_LDLIBS += -lpthread -ldl 245 ifeq ($(HOST_OS),linux) 246 # need this for clock_gettime() in profiling 247 LOCAL_LDLIBS += -lrt 248 endif 249else 250 LOCAL_SHARED_LIBRARIES += libdl 251endif 252 253MTERP_ARCH_KNOWN := false 254 255ifeq ($(TARGET_ARCH),arm) 256 #TARGET_ARCH_VARIANT := armv7-a 257 #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp 258 MTERP_ARCH_KNOWN := true 259 # Select architecture-specific sources (armv4t, armv5te etc.) 260 LOCAL_SRC_FILES += \ 261 arch/arm/CallOldABI.S \ 262 arch/arm/CallEABI.S \ 263 arch/arm/HintsEABI.c \ 264 mterp/out/InterpC-$(TARGET_ARCH_VARIANT).c.arm \ 265 mterp/out/InterpAsm-$(TARGET_ARCH_VARIANT).S 266 267 ifeq ($(WITH_JIT),true) 268 LOCAL_SRC_FILES += \ 269 compiler/codegen/arm/Codegen-$(TARGET_ARCH_VARIANT).c \ 270 compiler/codegen/arm/Assemble.c \ 271 compiler/codegen/arm/ArchUtility.c \ 272 compiler/codegen/arm/LocalOptimizations.c \ 273 compiler/codegen/arm/GlobalOptimizations.c \ 274 compiler/template/out/CompilerTemplateAsm-$(TARGET_ARCH_VARIANT).S 275 endif 276endif 277 278ifeq ($(TARGET_ARCH),x86) 279 MTERP_ARCH_KNOWN := true 280 LOCAL_SRC_FILES += \ 281 arch/x86/Call386ABI.S \ 282 arch/x86/Hints386ABI.c \ 283 mterp/out/InterpC-x86.c \ 284 mterp/out/InterpAsm-x86.S 285endif 286 287ifeq ($(TARGET_ARCH),sh) 288 MTERP_ARCH_KNOWN := true 289 LOCAL_SRC_FILES += \ 290 arch/sh/CallSH4ABI.S \ 291 arch/generic/Hints.c \ 292 mterp/out/InterpC-allstubs.c \ 293 mterp/out/InterpAsm-allstubs.S 294endif 295 296ifeq ($(MTERP_ARCH_KNOWN),false) 297 # unknown architecture, try to use FFI 298 LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH) 299 LOCAL_SHARED_LIBRARIES += libffi 300 301 LOCAL_SRC_FILES += \ 302 arch/generic/Call.c \ 303 arch/generic/Hints.c \ 304 mterp/out/InterpC-allstubs.c \ 305 mterp/out/InterpAsm-allstubs.S 306endif 307 308 309LOCAL_MODULE := libdvm 310 311LOCAL_SHARED_LIBRARIES += \ 312 liblog \ 313 libcutils \ 314 libnativehelper \ 315 libz 316 317LOCAL_STATIC_LIBRARIES += \ 318 libdex 319 320include $(BUILD_SHARED_LIBRARY) 321