Android.mk revision f5098f40cdbf360f9fb7e6c1e3ffdad231c03058
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 LOCAL_CFLAGS += -DWITH_JIT 195 LOCAL_SRC_FILES += \ 196 ../dexdump/OpCodeNames.c \ 197 compiler/Compiler.c \ 198 compiler/Frontend.c \ 199 compiler/Utility.c \ 200 compiler/IntermediateRep.c \ 201 interp/Jit.c 202endif 203 204WITH_HPROF := $(strip $(WITH_HPROF)) 205ifeq ($(WITH_HPROF),) 206 WITH_HPROF := true 207endif 208ifeq ($(WITH_HPROF),true) 209 LOCAL_SRC_FILES += \ 210 hprof/Hprof.c \ 211 hprof/HprofClass.c \ 212 hprof/HprofHeap.c \ 213 hprof/HprofOutput.c \ 214 hprof/HprofString.c 215 LOCAL_CFLAGS += -DWITH_HPROF=1 216 217 ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true) 218 LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1 219 endif 220 221 ifeq ($(strip $(WITH_HPROF_STACK)),true) 222 LOCAL_SRC_FILES += \ 223 hprof/HprofStack.c \ 224 hprof/HprofStackFrame.c 225 LOCAL_CFLAGS += -DWITH_HPROF_STACK=1 226 endif # WITH_HPROF_STACK 227endif # WITH_HPROF 228 229ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true) 230 LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1 231endif 232 233LOCAL_C_INCLUDES += \ 234 $(JNI_H_INCLUDE) \ 235 dalvik \ 236 dalvik/vm \ 237 external/zlib \ 238 $(KERNEL_HEADERS) 239 240 241ifeq ($(TARGET_SIMULATOR),true) 242 LOCAL_LDLIBS += -lpthread -ldl 243 ifeq ($(HOST_OS),linux) 244 # need this for clock_gettime() in profiling 245 LOCAL_LDLIBS += -lrt 246 endif 247else 248 LOCAL_SHARED_LIBRARIES += libdl 249endif 250 251MTERP_ARCH_KNOWN := false 252 253ifeq ($(TARGET_ARCH),arm) 254 #TARGET_ARCH_VARIANT := armv5te-vfp 255 MTERP_ARCH_KNOWN := true 256 # Select architecture-specific sources (armv4t, armv5te etc.) 257 LOCAL_SRC_FILES += \ 258 arch/arm/CallOldABI.S \ 259 arch/arm/CallEABI.S \ 260 arch/arm/HintsEABI.c \ 261 mterp/out/InterpC-$(TARGET_ARCH_VARIANT).c.arm \ 262 mterp/out/InterpAsm-$(TARGET_ARCH_VARIANT).S 263 264 ifeq ($(WITH_JIT),true) 265 LOCAL_SRC_FILES += \ 266 compiler/codegen/armv5te/Codegen.c \ 267 compiler/codegen/armv5te/Assemble.c \ 268 compiler/codegen/armv5te/ArchUtility.c \ 269 compiler/codegen/armv5te/FpCodegen-$(TARGET_ARCH_VARIANT).c \ 270 compiler/codegen/armv5te/LocalOptimizations.c \ 271 compiler/codegen/armv5te/GlobalOptimizations.c \ 272 compiler/template/out/CompilerTemplateAsm-armv5te.S 273 endif 274endif 275 276ifeq ($(TARGET_ARCH),x86) 277 MTERP_ARCH_KNOWN := true 278 LOCAL_SRC_FILES += \ 279 arch/x86/Call386ABI.S \ 280 arch/x86/Hints386ABI.c \ 281 mterp/out/InterpC-x86.c \ 282 mterp/out/InterpAsm-x86.S 283endif 284 285ifeq ($(MTERP_ARCH_KNOWN),false) 286 # unknown architecture, try to use FFI 287 LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH) 288 LOCAL_SHARED_LIBRARIES += libffi 289 290 LOCAL_SRC_FILES += \ 291 arch/generic/Call.c \ 292 arch/generic/Hints.c \ 293 mterp/out/InterpC-allstubs.c \ 294 mterp/out/InterpAsm-allstubs.S 295endif 296 297 298LOCAL_MODULE := libdvm 299 300LOCAL_SHARED_LIBRARIES += \ 301 liblog \ 302 libcutils \ 303 libnativehelper \ 304 libz 305 306LOCAL_STATIC_LIBRARIES += \ 307 libdex 308 309include $(BUILD_SHARED_LIBRARY) 310