1 # Copyright (C) 2008 The Android Open Source Project
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
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".
19 LOCAL_PATH:= $(call my-dir)
26 LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
29 # Optional features. These may impact the size or performance of the VM.
31 LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER
33 # 0=full cache, 1/2=reduced, 3=no cache
34 LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0
36 ifeq ($(WITH_DEADLOCK_PREDICTION),true)
37 LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION
38 WITH_MONITOR_TRACKING := true
40 ifeq ($(WITH_MONITOR_TRACKING),true)
41 LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING
44 # Make DEBUG_DALVIK_VM default to true when building the simulator.
45 ifeq ($(TARGET_SIMULATOR),true)
46 ifeq ($(strip $(DEBUG_DALVIK_VM)),)
47 DEBUG_DALVIK_VM := true
51 ifeq ($(strip $(DEBUG_DALVIK_VM)),true)
56 # - tracked-reference verification enabled
57 # - allocation limits enabled
58 # - GDB helpers enabled
60 # - assert() (NDEBUG is handled in the build system)
62 LOCAL_CFLAGS += -DWITH_INSTR_CHECKS -DWITH_EXTRA_OBJECT_VALIDATION
63 LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
64 LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
65 #LOCAL_CFLAGS += -DCHECK_MUTEX
66 #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
67 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
68 # add some extra stuff to make it easier to examine with GDB
69 LOCAL_CFLAGS += -DEASY_GDB
70 else # !DALVIK_VM_DEBUG
72 # "Performance" profile:
73 # - all development features disabled
74 # - compiler optimizations enabled (redundant for "release" builds)
75 # - (debugging and profiling still enabled)
77 #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
78 # "-O2" is redundant for device (release) but useful for sim (debug)
79 #LOCAL_CFLAGS += -O2 -Winline
80 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
81 # if you want to try with assertions on the device, add:
82 #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
83 endif # !DALVIK_VM_DEBUG
85 # bug hunting: checksum and verify interpreted stack when making JNI calls
86 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
118 alloc/HeapBitmap.c.arm \
124 alloc/MarkSweep.c.arm \
126 analysis/CodeVerify.c \
127 analysis/DexOptimize.c \
128 analysis/DexVerify.c \
129 analysis/ReduceConstants.c \
130 analysis/RegisterMap.c \
131 analysis/VerifySubs.c \
132 interp/Interp.c.arm \
136 jdwp/JdwpConstants.c \
142 mterp/out/InterpC-portstd.c.arm \
143 mterp/out/InterpC-portdbg.c.arm \
144 native/InternalNative.c \
145 native/dalvik_system_DexFile.c \
146 native/dalvik_system_VMDebug.c \
147 native/dalvik_system_VMRuntime.c \
148 native/dalvik_system_VMStack.c \
149 native/dalvik_system_Zygote.c \
150 native/java_lang_Class.c \
151 native/java_lang_Object.c \
152 native/java_lang_Runtime.c \
153 native/java_lang_String.c \
154 native/java_lang_System.c \
155 native/java_lang_SystemProperties.c \
156 native/java_lang_Throwable.c \
157 native/java_lang_VMClassLoader.c \
158 native/java_lang_VMThread.c \
159 native/java_lang_reflect_AccessibleObject.c \
160 native/java_lang_reflect_Array.c \
161 native/java_lang_reflect_Constructor.c \
162 native/java_lang_reflect_Field.c \
163 native/java_lang_reflect_Method.c \
164 native/java_lang_reflect_Proxy.c \
165 native/java_security_AccessController.c \
166 native/java_util_concurrent_atomic_AtomicLong.c \
167 native/org_apache_harmony_dalvik_NativeTestTarget.c \
168 native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
169 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
170 native/sun_misc_Unsafe.c \
177 reflect/Annotation.c \
182 WITH_HPROF := $(strip $(WITH_HPROF))
183 ifeq ($(WITH_HPROF),)
186 ifeq ($(WITH_HPROF),true)
191 hprof/HprofOutput.c \
193 LOCAL_CFLAGS += -DWITH_HPROF=1
195 ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
196 LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
199 ifeq ($(strip $(WITH_HPROF_STACK)),true)
202 hprof/HprofStackFrame.c
203 LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
204 endif # WITH_HPROF_STACK
207 ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
208 LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
211 LOCAL_C_INCLUDES += \
219 ifeq ($(TARGET_SIMULATOR),true)
220 LOCAL_LDLIBS += -lpthread -ldl
221 ifeq ($(HOST_OS),linux)
222 # need this for clock_gettime() in profiling
226 LOCAL_SHARED_LIBRARIES += libdl
229 ifeq ($(TARGET_ARCH),arm)
231 arch/arm/CallOldABI.S \
232 arch/arm/CallEABI.S \
234 # TODO: select sources for ARMv4 vs. ARMv5TE
236 mterp/out/InterpC-armv5te.c.arm \
237 mterp/out/InterpAsm-armv5te.S
238 LOCAL_SHARED_LIBRARIES += libdl
240 ifeq ($(TARGET_ARCH),x86)
242 arch/x86/Call386ABI.S \
243 arch/x86/Hints386ABI.c
245 mterp/out/InterpC-x86.c \
246 mterp/out/InterpAsm-x86.S
248 # unknown architecture, try to use FFI
249 LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
251 arch/generic/Call.c \
253 LOCAL_SHARED_LIBRARIES += libffi
256 mterp/out/InterpC-allstubs.c \
257 mterp/out/InterpAsm-allstubs.S
262 LOCAL_MODULE := libdvm
264 LOCAL_SHARED_LIBRARIES += \
270 LOCAL_STATIC_LIBRARIES += \
273 include $(BUILD_SHARED_LIBRARY)