OSDN Git Service

added/modified to support SuperH architecture
[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 #
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 #
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
63 endif
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 #
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
79 endif
80
81 # bug hunting: checksum and verify interpreted stack when making JNI calls
82 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
83
84 LOCAL_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 \
97         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 \
125         analysis/ReduceConstants.c \
126         analysis/RegisterMap.c \
127         analysis/VerifySubs.c \
128         interp/Interp.c.arm \
129         interp/Stack.c \
130         jdwp/ExpandBuf.c \
131         jdwp/JdwpAdb.c \
132         jdwp/JdwpConstants.c \
133         jdwp/JdwpEvent.c \
134         jdwp/JdwpHandler.c \
135         jdwp/JdwpMain.c \
136         jdwp/JdwpSocket.c \
137         mterp/Mterp.c.arm \
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 \
167         oo/AccessCheck.c \
168         oo/Array.c \
169         oo/Class.c \
170         oo/Object.c \
171         oo/Resolve.c \
172         oo/TypeCheck.c \
173         reflect/Annotation.c \
174         reflect/Proxy.c \
175         reflect/Reflect.c \
176         test/TestHash.c
177
178 WITH_HPROF := $(strip $(WITH_HPROF))
179 ifeq ($(WITH_HPROF),)
180   WITH_HPROF := true
181 endif
182 ifeq ($(WITH_HPROF),true)
183   LOCAL_SRC_FILES += \
184         hprof/Hprof.c \
185         hprof/HprofClass.c \
186         hprof/HprofHeap.c \
187         hprof/HprofOutput.c \
188         hprof/HprofString.c
189   LOCAL_CFLAGS += -DWITH_HPROF=1
190
191   ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
192     LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
193   endif
194
195   ifeq ($(strip $(WITH_HPROF_STACK)),true)
196     LOCAL_SRC_FILES += \
197         hprof/HprofStack.c \
198         hprof/HprofStackFrame.c
199     LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
200   endif # WITH_HPROF_STACK
201 endif   # WITH_HPROF
202
203 ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
204   LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
205 endif
206
207 LOCAL_C_INCLUDES += \
208         $(JNI_H_INCLUDE) \
209         dalvik \
210         dalvik/vm \
211         external/zlib \
212         $(KERNEL_HEADERS)
213
214
215 ifeq ($(TARGET_SIMULATOR),true)
216   LOCAL_LDLIBS += -lpthread -ldl
217   ifeq ($(HOST_OS),linux)
218     # need this for clock_gettime() in profiling
219     LOCAL_LDLIBS += -lrt
220   endif
221 else
222   LOCAL_SHARED_LIBRARIES += libdl
223 endif
224
225 ifeq ($(TARGET_ARCH),arm)
226   LOCAL_SRC_FILES += \
227                 arch/arm/CallOldABI.S \
228                 arch/arm/CallEABI.S \
229                 arch/arm/HintsEABI.c
230   #
231   # The armv4 configation in mterp is actually armv4t, it's just
232   # wrongly named
233   #
234   # TODO: Rename mterp/config-armv4 and mterp/armv4 (to armv4t)
235   #       then remove this ifeq.
236   #
237   ifeq ($(TARGET_ARCH_VERSION),armv4t)
238     LOCAL_SRC_FILES += \
239                 mterp/out/InterpC-armv4.c.arm \
240                 mterp/out/InterpAsm-armv4.S
241   else
242     # Select architecture specific sources (armv4,armv5te etc)
243     LOCAL_SRC_FILES += \
244                 mterp/out/InterpC-$(TARGET_ARCH_VERSION).c.arm \
245                 mterp/out/InterpAsm-$(TARGET_ARCH_VERSION).S
246   endif
247   LOCAL_SHARED_LIBRARIES += libdl
248 else
249   ifeq ($(TARGET_ARCH),x86)
250     LOCAL_SRC_FILES += \
251                 arch/x86/Call386ABI.S \
252                 arch/x86/Hints386ABI.c
253     LOCAL_SRC_FILES += \
254                 mterp/out/InterpC-x86.c \
255                 mterp/out/InterpAsm-x86.S
256   else
257     ifeq ($(TARGET_ARCH),sh)
258       LOCAL_SRC_FILES += \
259                         arch/sh/CallSH4ABI.S \
260                         arch/generic/Hints.c
261       LOCAL_SRC_FILES += \
262                         mterp/out/InterpC-allstubs.c \
263                         mterp/out/InterpAsm-allstubs.S
264     else
265         # unknown architecture, try to use FFI
266       LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
267       LOCAL_SRC_FILES += \
268                         arch/generic/Call.c \
269                         arch/generic/Hints.c
270       LOCAL_SHARED_LIBRARIES += libffi
271                         
272       LOCAL_SRC_FILES += \
273                         mterp/out/InterpC-allstubs.c \
274                         mterp/out/InterpAsm-allstubs.S
275     endif
276   endif
277 endif
278
279
280 LOCAL_MODULE := libdvm
281
282 LOCAL_SHARED_LIBRARIES += \
283         liblog \
284         libcutils \
285         libnativehelper \
286         libz
287
288 LOCAL_STATIC_LIBRARIES += \
289         libdex
290
291 include $(BUILD_SHARED_LIBRARY)