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
48 # - tracked-reference verification enabled
49 # - allocation limits enabled
50 # - GDB helpers enabled
52 # - assert() (NDEBUG is handled in the build system)
54 ifeq ($(TARGET_BUILD_TYPE),debug)
55 LOCAL_CFLAGS += -DWITH_INSTR_CHECKS -DWITH_EXTRA_OBJECT_VALIDATION
56 LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
57 LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
58 #LOCAL_CFLAGS += -DCHECK_MUTEX
59 #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
60 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
61 # add some extra stuff to make it easier to examine with GDB
62 LOCAL_CFLAGS += -DEASY_GDB
67 # "Performance" profile:
68 # - all development features disabled
69 # - compiler optimizations enabled (redundant for "release" builds)
70 # - (debugging and profiling still enabled)
72 ifeq ($(TARGET_BUILD_TYPE),release)
73 #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
74 # "-O2" is redundant for device (release) but useful for sim (debug)
75 #LOCAL_CFLAGS += -O2 -Winline
76 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
77 # if you want to try with assertions on the device, add:
78 #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
81 # bug hunting: checksum and verify interpreted stack when making JNI calls
82 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
114 alloc/HeapBitmap.c.arm \
120 alloc/MarkSweep.c.arm \
122 analysis/CodeVerify.c \
123 analysis/DexOptimize.c \
124 analysis/DexVerify.c \
125 analysis/ReduceConstants.c \
126 analysis/RegisterMap.c \
127 analysis/VerifySubs.c \
128 interp/Interp.c.arm \
132 jdwp/JdwpConstants.c \
138 mterp/out/InterpC-portstd.c.arm \
139 mterp/out/InterpC-portdbg.c.arm \
140 native/InternalNative.c \
141 native/dalvik_system_DexFile.c \
142 native/dalvik_system_VMDebug.c \
143 native/dalvik_system_VMRuntime.c \
144 native/dalvik_system_VMStack.c \
145 native/dalvik_system_Zygote.c \
146 native/java_lang_Class.c \
147 native/java_lang_Object.c \
148 native/java_lang_Runtime.c \
149 native/java_lang_String.c \
150 native/java_lang_System.c \
151 native/java_lang_SystemProperties.c \
152 native/java_lang_Throwable.c \
153 native/java_lang_VMClassLoader.c \
154 native/java_lang_VMThread.c \
155 native/java_lang_reflect_AccessibleObject.c \
156 native/java_lang_reflect_Array.c \
157 native/java_lang_reflect_Constructor.c \
158 native/java_lang_reflect_Field.c \
159 native/java_lang_reflect_Method.c \
160 native/java_lang_reflect_Proxy.c \
161 native/java_security_AccessController.c \
162 native/java_util_concurrent_atomic_AtomicLong.c \
163 native/org_apache_harmony_dalvik_NativeTestTarget.c \
164 native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
165 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
166 native/sun_misc_Unsafe.c \
173 reflect/Annotation.c \
178 WITH_HPROF := $(strip $(WITH_HPROF))
179 ifeq ($(WITH_HPROF),)
182 ifeq ($(WITH_HPROF),true)
187 hprof/HprofOutput.c \
189 LOCAL_CFLAGS += -DWITH_HPROF=1
191 ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
192 LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
195 ifeq ($(strip $(WITH_HPROF_STACK)),true)
198 hprof/HprofStackFrame.c
199 LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
200 endif # WITH_HPROF_STACK
203 ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
204 LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
207 LOCAL_C_INCLUDES += \
215 ifeq ($(TARGET_SIMULATOR),true)
216 LOCAL_LDLIBS += -lpthread -ldl
217 ifeq ($(HOST_OS),linux)
218 # need this for clock_gettime() in profiling
222 LOCAL_SHARED_LIBRARIES += libdl
225 ifeq ($(TARGET_ARCH),arm)
227 arch/arm/CallOldABI.S \
228 arch/arm/CallEABI.S \
231 # The armv4 configation in mterp is actually armv4t, it's just
234 # TODO: Rename mterp/config-armv4 and mterp/armv4 (to armv4t)
235 # then remove this ifeq.
237 ifeq ($(TARGET_ARCH_VERSION),armv4t)
239 mterp/out/InterpC-armv4.c.arm \
240 mterp/out/InterpAsm-armv4.S
242 # Select architecture specific sources (armv4,armv5te etc)
244 mterp/out/InterpC-$(TARGET_ARCH_VERSION).c.arm \
245 mterp/out/InterpAsm-$(TARGET_ARCH_VERSION).S
247 LOCAL_SHARED_LIBRARIES += libdl
249 ifeq ($(TARGET_ARCH),x86)
251 arch/x86/Call386ABI.S \
252 arch/x86/Hints386ABI.c
254 mterp/out/InterpC-x86.c \
255 mterp/out/InterpAsm-x86.S
257 ifeq ($(TARGET_ARCH),sh)
259 arch/sh/CallSH4ABI.S \
262 mterp/out/InterpC-allstubs.c \
263 mterp/out/InterpAsm-allstubs.S
265 # unknown architecture, try to use FFI
266 LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
268 arch/generic/Call.c \
270 LOCAL_SHARED_LIBRARIES += libffi
273 mterp/out/InterpC-allstubs.c \
274 mterp/out/InterpAsm-allstubs.S
280 LOCAL_MODULE := libdvm
282 LOCAL_SHARED_LIBRARIES += \
288 LOCAL_STATIC_LIBRARIES += \
291 include $(BUILD_SHARED_LIBRARY)