Android.mk revision a80b76553c2b9f33c4063ae8c69c5362d961de81
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 187WITH_HPROF := $(strip $(WITH_HPROF)) 188ifeq ($(WITH_HPROF),) 189 WITH_HPROF := true 190endif 191ifeq ($(WITH_HPROF),true) 192 LOCAL_SRC_FILES += \ 193 hprof/Hprof.c \ 194 hprof/HprofClass.c \ 195 hprof/HprofHeap.c \ 196 hprof/HprofOutput.c \ 197 hprof/HprofString.c 198 LOCAL_CFLAGS += -DWITH_HPROF=1 199 200 ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true) 201 LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1 202 endif 203 204 ifeq ($(strip $(WITH_HPROF_STACK)),true) 205 LOCAL_SRC_FILES += \ 206 hprof/HprofStack.c \ 207 hprof/HprofStackFrame.c 208 LOCAL_CFLAGS += -DWITH_HPROF_STACK=1 209 endif # WITH_HPROF_STACK 210endif # WITH_HPROF 211 212ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true) 213 LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1 214endif 215 216LOCAL_C_INCLUDES += \ 217 $(JNI_H_INCLUDE) \ 218 dalvik \ 219 dalvik/vm \ 220 external/zlib \ 221 $(KERNEL_HEADERS) 222 223 224ifeq ($(TARGET_SIMULATOR),true) 225 LOCAL_LDLIBS += -lpthread -ldl 226 ifeq ($(HOST_OS),linux) 227 # need this for clock_gettime() in profiling 228 LOCAL_LDLIBS += -lrt 229 endif 230else 231 LOCAL_SHARED_LIBRARIES += libdl 232endif 233 234ifeq ($(TARGET_ARCH),arm) 235 #TARGET_ARCH_VERSION := armv5te-vfp 236 LOCAL_SRC_FILES += \ 237 arch/arm/CallOldABI.S \ 238 arch/arm/CallEABI.S \ 239 arch/arm/HintsEABI.c 240 # Select architecture specific sources (armv4t,armv5te etc) 241 LOCAL_SRC_FILES += \ 242 mterp/out/InterpC-$(TARGET_ARCH_VERSION).c.arm \ 243 mterp/out/InterpAsm-$(TARGET_ARCH_VERSION).S 244 LOCAL_SHARED_LIBRARIES += libdl 245else 246 ifeq ($(TARGET_ARCH),x86) 247 LOCAL_SRC_FILES += \ 248 arch/x86/Call386ABI.S \ 249 arch/x86/Hints386ABI.c 250 LOCAL_SRC_FILES += \ 251 mterp/out/InterpC-x86.c \ 252 mterp/out/InterpAsm-x86.S 253 else 254 # unknown architecture, try to use FFI 255 LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH) 256 LOCAL_SRC_FILES += \ 257 arch/generic/Call.c \ 258 arch/generic/Hints.c 259 LOCAL_SHARED_LIBRARIES += libffi 260 261 LOCAL_SRC_FILES += \ 262 mterp/out/InterpC-allstubs.c \ 263 mterp/out/InterpAsm-allstubs.S 264 endif 265endif 266 267 268LOCAL_MODULE := libdvm 269 270LOCAL_SHARED_LIBRARIES += \ 271 liblog \ 272 libcutils \ 273 libnativehelper \ 274 libz 275 276LOCAL_STATIC_LIBRARIES += \ 277 libdex 278 279include $(BUILD_SHARED_LIBRARY) 280