blob: 8a4f292fc053b9a960777b93a12fccd4d9de53da [file] [log] [blame]
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -07001# 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,
The Android Open Source Project89c1feb2008-12-17 18:03:55 -080017# rebuild the VM with "make clean-libdvm && make -j4 libdvm".
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -070018#
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
The Android Open Source Project89c1feb2008-12-17 18:03:55 -080033# 0=full cache, 1/2=reduced, 3=no cache
34LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0
35
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -070036ifeq ($(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#
45# "Debug" profile:
46# - debugger enabled
47# - profiling enabled
48# - tracked-reference verification enabled
49# - allocation limits enabled
50# - GDB helpers enabled
51# - LOGV
52# - assert() (NDEBUG is handled in the build system)
53#
54ifeq ($(TARGET_BUILD_TYPE),debug)
55LOCAL_CFLAGS += -DWITH_INSTR_CHECKS -DWITH_EXTRA_OBJECT_VALIDATION
56LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
57LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
58#LOCAL_CFLAGS += -DCHECK_MUTEX
59#LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
60LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
61# add some extra stuff to make it easier to examine with GDB
62LOCAL_CFLAGS += -DEASY_GDB
63endif
64
65
66#
67# "Performance" profile:
68# - all development features disabled
69# - compiler optimizations enabled (redundant for "release" builds)
70# - (debugging and profiling still enabled)
71#
72ifeq ($(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
76LOCAL_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
79endif
80
81# bug hunting: checksum and verify interpreted stack when making JNI calls
82#LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
83
84LOCAL_SRC_FILES := \
85 AllocTracker.c \
86 AtomicCache.c \
87 CheckJni.c \
88 Ddm.c \
89 Debugger.c \
90 DvmDex.c \
91 Exception.c \
92 Hash.c \
93 Init.c \
94 InlineNative.c.arm \
95 Inlines.c \
96 Intern.c \
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -070097 Jni.c \
98 JarFile.c \
99 LinearAlloc.c \
100 Misc.c.arm \
101 Native.c \
102 PointerSet.c \
103 Profile.c \
104 Properties.c \
105 RawDexFile.c \
106 ReferenceTable.c \
107 SignalCatcher.c \
108 StdioConverter.c \
109 Sync.c \
110 Thread.c \
111 UtfString.c \
112 alloc/clz.c.arm \
113 alloc/Alloc.c \
114 alloc/HeapBitmap.c.arm \
115 alloc/HeapDebug.c \
116 alloc/HeapSource.c \
117 alloc/HeapTable.c \
118 alloc/HeapWorker.c \
119 alloc/Heap.c.arm \
120 alloc/MarkSweep.c.arm \
121 alloc/DdmHeap.c \
122 analysis/CodeVerify.c \
123 analysis/DexOptimize.c \
124 analysis/DexVerify.c \
The Android Open Source Project89c1feb2008-12-17 18:03:55 -0800125 analysis/ReduceConstants.c \
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -0700126 interp/Interp.c.arm \
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -0700127 interp/Stack.c \
128 jdwp/ExpandBuf.c \
129 jdwp/JdwpAdb.c \
130 jdwp/JdwpConstants.c \
131 jdwp/JdwpEvent.c \
132 jdwp/JdwpHandler.c \
133 jdwp/JdwpMain.c \
134 jdwp/JdwpSocket.c \
135 mterp/Mterp.c.arm \
The Android Open Source Project89c1feb2008-12-17 18:03:55 -0800136 mterp/out/InterpC-portstd.c.arm \
137 mterp/out/InterpC-portdbg.c.arm \
138 native/InternalNative.c \
139 native/dalvik_system_DexFile.c \
140 native/dalvik_system_VMDebug.c \
141 native/dalvik_system_VMRuntime.c \
142 native/dalvik_system_VMStack.c \
143 native/dalvik_system_Zygote.c \
144 native/java_lang_Class.c \
145 native/java_lang_Object.c \
146 native/java_lang_Runtime.c \
147 native/java_lang_String.c \
148 native/java_lang_System.c \
149 native/java_lang_SystemProperties.c \
150 native/java_lang_Throwable.c \
151 native/java_lang_VMClassLoader.c \
152 native/java_lang_VMThread.c \
153 native/java_lang_reflect_AccessibleObject.c \
154 native/java_lang_reflect_Array.c \
155 native/java_lang_reflect_Constructor.c \
156 native/java_lang_reflect_Field.c \
157 native/java_lang_reflect_Method.c \
158 native/java_lang_reflect_Proxy.c \
159 native/java_security_AccessController.c \
160 native/java_util_concurrent_atomic_AtomicLong.c \
161 native/org_apache_harmony_dalvik_NativeTestTarget.c \
162 native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
163 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
164 native/sun_misc_Unsafe.c \
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -0700165 oo/AccessCheck.c \
166 oo/Array.c \
167 oo/Class.c \
168 oo/Object.c \
169 oo/Resolve.c \
170 oo/TypeCheck.c \
171 reflect/Annotation.c \
172 reflect/Proxy.c \
173 reflect/Reflect.c \
174 test/TestHash.c
175
176WITH_HPROF := $(strip $(WITH_HPROF))
177ifeq ($(WITH_HPROF),)
178 WITH_HPROF := true
179endif
180ifeq ($(WITH_HPROF),true)
181 LOCAL_SRC_FILES += \
182 hprof/Hprof.c \
183 hprof/HprofClass.c \
184 hprof/HprofHeap.c \
185 hprof/HprofOutput.c \
186 hprof/HprofString.c
187 LOCAL_CFLAGS += -DWITH_HPROF=1
188
189 ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
190 LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
191 endif
192
193 ifeq ($(strip $(WITH_HPROF_STACK)),true)
194 LOCAL_SRC_FILES += \
195 hprof/HprofStack.c \
196 hprof/HprofStackFrame.c
197 LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
198 endif # WITH_HPROF_STACK
199endif # WITH_HPROF
200
201ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
202 LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
203endif
204
205LOCAL_C_INCLUDES += \
206 $(JNI_H_INCLUDE) \
207 dalvik \
208 dalvik/vm \
209 external/zlib \
210 $(KERNEL_HEADERS)
211
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -0700212
213ifeq ($(TARGET_SIMULATOR),true)
The Android Open Source Project89c1feb2008-12-17 18:03:55 -0800214 LOCAL_LDLIBS += -lpthread -ldl
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -0700215 ifeq ($(HOST_OS),linux)
216 # need this for clock_gettime() in profiling
217 LOCAL_LDLIBS += -lrt
218 endif
The Android Open Source Project89c1feb2008-12-17 18:03:55 -0800219else
220 LOCAL_SHARED_LIBRARIES += libdl
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -0700221endif
222
223ifeq ($(TARGET_ARCH),arm)
The Android Open Source Project89c1feb2008-12-17 18:03:55 -0800224 LOCAL_SRC_FILES += \
225 arch/arm/CallOldABI.S \
226 arch/arm/CallEABI.S \
227 arch/arm/HintsEABI.c
228 # TODO: select sources for ARMv4 vs. ARMv5TE
229 LOCAL_SRC_FILES += \
230 mterp/out/InterpC-armv5te.c.arm \
231 mterp/out/InterpAsm-armv5te.S
232 LOCAL_SHARED_LIBRARIES += libdl
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -0700233else
The Android Open Source Project89c1feb2008-12-17 18:03:55 -0800234 ifeq ($(TARGET_ARCH),x86)
235 LOCAL_SRC_FILES += \
236 arch/x86/Call386ABI.S \
237 arch/x86/Hints386ABI.c
238 LOCAL_SRC_FILES += \
239 mterp/out/InterpC-x86.c \
240 mterp/out/InterpAsm-x86.S
241 else
242 # unknown architecture, try to use FFI
243 LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
244 LOCAL_SRC_FILES += \
245 arch/generic/Call.c \
246 arch/generic/Hints.c
247 LOCAL_SHARED_LIBRARIES += libffi
248
249 LOCAL_SRC_FILES += \
250 mterp/out/InterpC-allstubs.c \
251 mterp/out/InterpAsm-allstubs.S
252 endif
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -0700253endif
254
The Android Open Source Project89c1feb2008-12-17 18:03:55 -0800255
The Android Open Source Project2ad60cf2008-10-21 07:00:00 -0700256LOCAL_MODULE := libdvm
257
258LOCAL_SHARED_LIBRARIES += \
259 liblog \
260 libcutils \
261 libnativehelper \
262 libz
263
264LOCAL_STATIC_LIBRARIES += \
265 libdex
266
267include $(BUILD_SHARED_LIBRARY)