OSDN Git Service

48b53af984b959f0bd3800158d478c584c022bae
[android-x86/dalvik.git] / vm / Android.mk
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 #
19 LOCAL_PATH:= $(call my-dir)
20 include $(CLEAR_VARS)
21
22
23 #
24 # Compiler defines.
25 #
26 LOCAL_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 #
31 LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER
32
33 # 0=full cache, 1/2=reduced, 3=no cache
34 LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0
35
36 ifeq ($(WITH_DEADLOCK_PREDICTION),true)
37   LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION
38   WITH_MONITOR_TRACKING := true
39 endif
40 ifeq ($(WITH_MONITOR_TRACKING),true)
41   LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING
42 endif
43
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
48   endif
49 endif
50
51 ifeq ($(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()
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
72   # overall config may be for a "release" build, so reconfigure these
73   LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
74 else  # !DALVIK_VM_DEBUG
75   #
76   # "Performance" profile:
77   # - all development features disabled
78   # - compiler optimizations enabled (redundant for "release" builds)
79   # - (debugging and profiling still enabled)
80   #
81   #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
82   # "-O2" is redundant for device (release) but useful for sim (debug)
83   #LOCAL_CFLAGS += -O2 -Winline
84   #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
85   LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
86   LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
87   # if you want to try with assertions on the device, add:
88   #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
89 endif  # !DALVIK_VM_DEBUG
90
91 # bug hunting: checksum and verify interpreted stack when making JNI calls
92 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
93
94 LOCAL_SRC_FILES := \
95         AllocTracker.c \
96         AtomicCache.c \
97         CheckJni.c \
98         Ddm.c \
99         Debugger.c \
100         DvmDex.c \
101         Exception.c \
102         Hash.c \
103         IndirectRefTable.c.arm \
104         Init.c \
105         InlineNative.c.arm \
106         Inlines.c \
107         Intern.c \
108         Jni.c \
109         JarFile.c \
110         LinearAlloc.c \
111         Misc.c.arm \
112         Native.c \
113         PointerSet.c \
114         Profile.c \
115         Properties.c \
116         RawDexFile.c \
117         ReferenceTable.c \
118         SignalCatcher.c \
119         StdioConverter.c \
120         Sync.c \
121         Thread.c \
122         UtfString.c \
123         alloc/clz.c.arm \
124         alloc/Alloc.c \
125         alloc/HeapBitmap.c.arm \
126         alloc/HeapDebug.c \
127         alloc/HeapSource.c \
128         alloc/HeapTable.c \
129         alloc/HeapWorker.c \
130         alloc/Heap.c.arm \
131         alloc/MarkSweep.c.arm \
132         alloc/DdmHeap.c \
133         analysis/CodeVerify.c \
134         analysis/DexOptimize.c \
135         analysis/DexVerify.c \
136         analysis/ReduceConstants.c \
137         analysis/RegisterMap.c \
138         analysis/VerifySubs.c \
139         interp/Interp.c.arm \
140         interp/Stack.c \
141         jdwp/ExpandBuf.c \
142         jdwp/JdwpAdb.c \
143         jdwp/JdwpConstants.c \
144         jdwp/JdwpEvent.c \
145         jdwp/JdwpHandler.c \
146         jdwp/JdwpMain.c \
147         jdwp/JdwpSocket.c \
148         mterp/Mterp.c.arm \
149         mterp/out/InterpC-portstd.c.arm \
150         mterp/out/InterpC-portdbg.c.arm \
151         native/InternalNative.c \
152         native/dalvik_system_DexFile.c \
153         native/dalvik_system_VMDebug.c \
154         native/dalvik_system_VMRuntime.c \
155         native/dalvik_system_VMStack.c \
156         native/dalvik_system_Zygote.c \
157         native/java_lang_Class.c \
158         native/java_lang_Object.c \
159         native/java_lang_Runtime.c \
160         native/java_lang_String.c \
161         native/java_lang_System.c \
162         native/java_lang_SystemProperties.c \
163         native/java_lang_Throwable.c \
164         native/java_lang_VMClassLoader.c \
165         native/java_lang_VMThread.c \
166         native/java_lang_reflect_AccessibleObject.c \
167         native/java_lang_reflect_Array.c \
168         native/java_lang_reflect_Constructor.c \
169         native/java_lang_reflect_Field.c \
170         native/java_lang_reflect_Method.c \
171         native/java_lang_reflect_Proxy.c \
172         native/java_security_AccessController.c \
173         native/java_util_concurrent_atomic_AtomicLong.c \
174         native/org_apache_harmony_dalvik_NativeTestTarget.c \
175         native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
176         native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
177         native/sun_misc_Unsafe.c \
178         oo/AccessCheck.c \
179         oo/Array.c \
180         oo/Class.c \
181         oo/Object.c \
182         oo/Resolve.c \
183         oo/TypeCheck.c \
184         reflect/Annotation.c \
185         reflect/Proxy.c \
186         reflect/Reflect.c \
187         test/AtomicSpeed.c \
188         test/TestHash.c \
189         test/TestIndirectRefTable.c
190
191 ifeq ($(WITH_JIT_TUNING),true)
192   LOCAL_CFLAGS += -DWITH_JIT_TUNING
193 endif
194
195 ifeq ($(WITH_JIT),true)
196   # NOTE: Turn on assertion for JIT for now
197   LOCAL_CFLAGS += -DWITH_DALVIK_ASSERT
198   # NOTE: Also turn on tuning when JIT is enabled for now
199   LOCAL_CFLAGS += -DWITH_JIT_TUNING
200   LOCAL_CFLAGS += -DWITH_JIT
201   LOCAL_SRC_FILES += \
202         ../dexdump/OpCodeNames.c \
203         compiler/Compiler.c \
204         compiler/Frontend.c \
205         compiler/Utility.c \
206         compiler/IntermediateRep.c \
207         interp/Jit.c
208 endif
209
210 WITH_HPROF := $(strip $(WITH_HPROF))
211 ifeq ($(WITH_HPROF),)
212   WITH_HPROF := true
213 endif
214 ifeq ($(WITH_HPROF),true)
215   LOCAL_SRC_FILES += \
216         hprof/Hprof.c \
217         hprof/HprofClass.c \
218         hprof/HprofHeap.c \
219         hprof/HprofOutput.c \
220         hprof/HprofString.c
221   LOCAL_CFLAGS += -DWITH_HPROF=1
222
223   ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
224     LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
225   endif
226
227   ifeq ($(strip $(WITH_HPROF_STACK)),true)
228     LOCAL_SRC_FILES += \
229         hprof/HprofStack.c \
230         hprof/HprofStackFrame.c
231     LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
232   endif # WITH_HPROF_STACK
233 endif   # WITH_HPROF
234
235 ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
236   LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
237 endif
238
239 LOCAL_C_INCLUDES += \
240         $(JNI_H_INCLUDE) \
241         dalvik \
242         dalvik/vm \
243         external/zlib \
244         $(KERNEL_HEADERS)
245
246
247 ifeq ($(TARGET_SIMULATOR),true)
248   LOCAL_LDLIBS += -lpthread -ldl
249   ifeq ($(HOST_OS),linux)
250     # need this for clock_gettime() in profiling
251     LOCAL_LDLIBS += -lrt
252   endif
253 else
254   LOCAL_SHARED_LIBRARIES += libdl
255 endif
256
257 MTERP_ARCH_KNOWN := false
258
259 ifeq ($(TARGET_ARCH),arm)
260   #TARGET_ARCH_VARIANT := armv7-a
261   #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
262   MTERP_ARCH_KNOWN := true
263   # Select architecture-specific sources (armv4t, armv5te etc.)
264   LOCAL_SRC_FILES += \
265                 arch/arm/CallOldABI.S \
266                 arch/arm/CallEABI.S \
267                 arch/arm/HintsEABI.c \
268                 mterp/out/InterpC-$(TARGET_ARCH_VARIANT).c.arm \
269                 mterp/out/InterpAsm-$(TARGET_ARCH_VARIANT).S
270
271   ifeq ($(WITH_JIT),true)
272     LOCAL_SRC_FILES += \
273                 compiler/codegen/arm/Codegen-$(TARGET_ARCH_VARIANT).c \
274                 compiler/codegen/arm/Assemble.c \
275                 compiler/codegen/arm/ArchUtility.c \
276                 compiler/codegen/arm/LocalOptimizations.c \
277                 compiler/codegen/arm/GlobalOptimizations.c \
278                 compiler/template/out/CompilerTemplateAsm-$(TARGET_ARCH_VARIANT).S
279   endif
280 endif
281
282 ifeq ($(TARGET_ARCH),x86)
283   MTERP_ARCH_KNOWN := true
284   LOCAL_SRC_FILES += \
285                 arch/x86/Call386ABI.S \
286                 arch/x86/Hints386ABI.c \
287                 mterp/out/InterpC-x86.c \
288                 mterp/out/InterpAsm-x86.S
289 endif
290
291 ifeq ($(TARGET_ARCH),sh)
292   MTERP_ARCH_KNOWN := true
293   LOCAL_SRC_FILES += \
294                 arch/sh/CallSH4ABI.S \
295                 arch/generic/Hints.c \
296                 mterp/out/InterpC-allstubs.c \
297                 mterp/out/InterpAsm-allstubs.S
298 endif
299
300 ifeq ($(MTERP_ARCH_KNOWN),false)
301   # unknown architecture, try to use FFI
302   LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
303   LOCAL_SHARED_LIBRARIES += libffi
304
305   LOCAL_SRC_FILES += \
306                 arch/generic/Call.c \
307                 arch/generic/Hints.c \
308                 mterp/out/InterpC-allstubs.c \
309                 mterp/out/InterpAsm-allstubs.S
310 endif
311
312
313 LOCAL_MODULE := libdvm
314
315 LOCAL_SHARED_LIBRARIES += \
316         liblog \
317         libcutils \
318         libnativehelper \
319         libz
320
321 LOCAL_STATIC_LIBRARIES += \
322         libdex
323
324 include $(BUILD_SHARED_LIBRARY)