Android.mk revision 99409883d9c4c0ffb49b070ce307bb33a9dfe9f1
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#
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
56LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
57LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
58LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
59LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
60#LOCAL_CFLAGS += -DCHECK_MUTEX
61#LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
62LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
63# add some extra stuff to make it easier to examine with GDB
64LOCAL_CFLAGS += -DEASY_GDB
65endif
66
67
68#
69# "Performance" profile:
70# - all development features disabled
71# - compiler optimizations enabled (redundant for "release" builds)
72# - (debugging and profiling still enabled)
73#
74ifeq ($(TARGET_BUILD_TYPE),release)
75#LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
76# "-O2" is redundant for device (release) but useful for sim (debug)
77#LOCAL_CFLAGS += -O2 -Winline
78#LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
79LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
80LOCAL_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
83endif
84
85# bug hunting: checksum and verify interpreted stack when making JNI calls
86#LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
87
88LOCAL_SRC_FILES := \
89	AllocTracker.c \
90	AtomicCache.c \
91	CheckJni.c \
92	Ddm.c \
93	Debugger.c \
94	DvmDex.c \
95	Exception.c \
96	Hash.c \
97	Init.c \
98	InlineNative.c.arm \
99	Inlines.c \
100	Intern.c \
101	Jni.c \
102	JarFile.c \
103	LinearAlloc.c \
104	Misc.c.arm \
105	Native.c \
106	PointerSet.c \
107	Profile.c \
108	Properties.c \
109	RawDexFile.c \
110	ReferenceTable.c \
111	SignalCatcher.c \
112	StdioConverter.c \
113	Sync.c \
114	Thread.c \
115	UtfString.c \
116	alloc/clz.c.arm \
117	alloc/Alloc.c \
118	alloc/HeapBitmap.c.arm \
119	alloc/HeapDebug.c \
120	alloc/HeapSource.c \
121	alloc/HeapTable.c \
122	alloc/HeapWorker.c \
123	alloc/Heap.c.arm \
124	alloc/MarkSweep.c.arm \
125	alloc/DdmHeap.c \
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 \
133	interp/Stack.c \
134	jdwp/ExpandBuf.c \
135	jdwp/JdwpAdb.c \
136	jdwp/JdwpConstants.c \
137	jdwp/JdwpEvent.c \
138	jdwp/JdwpHandler.c \
139	jdwp/JdwpMain.c \
140	jdwp/JdwpSocket.c \
141	mterp/Mterp.c.arm \
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 \
171	oo/AccessCheck.c \
172	oo/Array.c \
173	oo/Class.c \
174	oo/Object.c \
175	oo/Resolve.c \
176	oo/TypeCheck.c \
177	reflect/Annotation.c \
178	reflect/Proxy.c \
179	reflect/Reflect.c \
180	test/AtomicSpeed.c \
181	test/TestHash.c
182
183WITH_HPROF := $(strip $(WITH_HPROF))
184ifeq ($(WITH_HPROF),)
185  WITH_HPROF := true
186endif
187ifeq ($(WITH_HPROF),true)
188  LOCAL_SRC_FILES += \
189	hprof/Hprof.c \
190	hprof/HprofClass.c \
191	hprof/HprofHeap.c \
192	hprof/HprofOutput.c \
193	hprof/HprofString.c
194  LOCAL_CFLAGS += -DWITH_HPROF=1
195
196  ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
197    LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
198  endif
199
200  ifeq ($(strip $(WITH_HPROF_STACK)),true)
201    LOCAL_SRC_FILES += \
202	hprof/HprofStack.c \
203	hprof/HprofStackFrame.c
204    LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
205  endif # WITH_HPROF_STACK
206endif   # WITH_HPROF
207
208ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
209  LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
210endif
211
212LOCAL_C_INCLUDES += \
213	$(JNI_H_INCLUDE) \
214	dalvik \
215	dalvik/vm \
216	external/zlib \
217	$(KERNEL_HEADERS)
218
219
220ifeq ($(TARGET_SIMULATOR),true)
221  LOCAL_LDLIBS += -lpthread -ldl
222  ifeq ($(HOST_OS),linux)
223    # need this for clock_gettime() in profiling
224    LOCAL_LDLIBS += -lrt
225  endif
226else
227  LOCAL_SHARED_LIBRARIES += libdl
228endif
229
230ifeq ($(TARGET_ARCH),arm)
231  LOCAL_SRC_FILES += \
232		arch/arm/CallOldABI.S \
233		arch/arm/CallEABI.S \
234		arch/arm/HintsEABI.c
235  # TODO: select sources for ARMv4 vs. ARMv5TE
236  LOCAL_SRC_FILES += \
237		mterp/out/InterpC-armv5te.c.arm \
238		mterp/out/InterpAsm-armv5te.S
239  LOCAL_SHARED_LIBRARIES += libdl
240else
241  ifeq ($(TARGET_ARCH),x86)
242    LOCAL_SRC_FILES += \
243		arch/x86/Call386ABI.S \
244		arch/x86/Hints386ABI.c
245    LOCAL_SRC_FILES += \
246		mterp/out/InterpC-x86.c \
247		mterp/out/InterpAsm-x86.S
248  else
249	# unknown architecture, try to use FFI
250    LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
251    LOCAL_SRC_FILES += \
252		arch/generic/Call.c \
253		arch/generic/Hints.c
254    LOCAL_SHARED_LIBRARIES += libffi
255	
256    LOCAL_SRC_FILES += \
257		mterp/out/InterpC-allstubs.c \
258		mterp/out/InterpAsm-allstubs.S
259  endif
260endif
261
262
263LOCAL_MODULE := libdvm
264
265LOCAL_SHARED_LIBRARIES += \
266	liblog \
267	libcutils \
268	libnativehelper \
269	libz
270
271LOCAL_STATIC_LIBRARIES += \
272	libdex
273
274include $(BUILD_SHARED_LIBRARY)
275