OSDN Git Service

Merge "Kill off code, and leave a note." into dalvik-dev
[android-x86/dalvik.git] / vm / Dvm.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 # Common definitions for host or target builds of libdvm.
17 #
18 # If you enable or disable optional features here, make sure you do
19 # a "clean" build -- not everything depends on Dalvik.h.  (See Android.mk
20 # for the exact command.)
21 #
22
23
24 #
25 # Compiler defines.
26 #
27 LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
28 LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wc++-compat
29 LOCAL_CFLAGS += -DARCH_VARIANT=\"$(dvm_arch_variant)\"
30
31 #
32 # Optional features.  These may impact the size or performance of the VM.
33 #
34
35 # Make a debugging version when building the simulator (if not told
36 # otherwise) and when explicitly asked.
37 dvm_make_debug_vm := false
38 ifeq ($(strip $(DEBUG_DALVIK_VM)),)
39   ifeq ($(dvm_simulator),true)
40     dvm_make_debug_vm := true
41   endif
42 else
43   dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
44 endif
45
46 ifeq ($(dvm_make_debug_vm),true)
47   #
48   # "Debug" profile:
49   # - debugger enabled
50   # - profiling enabled
51   # - tracked-reference verification enabled
52   # - allocation limits enabled
53   # - GDB helpers enabled
54   # - LOGV
55   # - assert()
56   #
57   LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
58   LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
59   LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
60   LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
61   #LOCAL_CFLAGS += -DCHECK_MUTEX
62   #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
63   LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
64   # add some extra stuff to make it easier to examine with GDB
65   LOCAL_CFLAGS += -DEASY_GDB
66   # overall config may be for a "release" build, so reconfigure these
67   LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
68 else  # !dvm_make_debug_vm
69   #
70   # "Performance" profile:
71   # - all development features disabled
72   # - compiler optimizations enabled (redundant for "release" builds)
73   # - (debugging and profiling still enabled)
74   #
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
79   LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
80   # if you want to try with assertions on the device, add:
81   #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
82 endif  # !dvm_make_debug_vm
83
84 # bug hunting: checksum and verify interpreted stack when making JNI calls
85 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
86
87 LOCAL_SRC_FILES := \
88         AllocTracker.c \
89         Atomic.c.arm \
90         AtomicCache.c \
91         BitVector.c.arm \
92         CheckJni.c \
93         Ddm.c \
94         Debugger.c \
95         DvmDex.c \
96         Exception.c \
97         Hash.c \
98         IndirectRefTable.c.arm \
99         Init.c \
100         InitRefs.c \
101         InlineNative.c.arm \
102         Inlines.c \
103         Intern.c \
104         Jni.c \
105         JarFile.c \
106         LinearAlloc.c \
107         Misc.c \
108         Native.c \
109         PointerSet.c \
110         Profile.c \
111         Properties.c \
112         RawDexFile.c \
113         ReferenceTable.c \
114         SignalCatcher.c \
115         StdioConverter.c \
116         Sync.c \
117         Thread.c \
118         UtfString.c \
119         alloc/Alloc.c \
120         alloc/CardTable.c \
121         alloc/HeapBitmap.c.arm \
122         alloc/HeapDebug.c \
123         alloc/HeapTable.c \
124         alloc/HeapWorker.c \
125         alloc/Heap.c.arm \
126         alloc/DdmHeap.c \
127         alloc/Verify.c \
128         alloc/Visit.c \
129         analysis/CodeVerify.c \
130         analysis/DexPrepare.c \
131         analysis/DexVerify.c \
132         analysis/Liveness.c \
133         analysis/Optimize.c \
134         analysis/RegisterMap.c \
135         analysis/VerifySubs.c \
136         analysis/VfyBasicBlock.c \
137         hprof/Hprof.c \
138         hprof/HprofClass.c \
139         hprof/HprofHeap.c \
140         hprof/HprofOutput.c \
141         hprof/HprofString.c \
142         interp/Interp.c.arm \
143         interp/Stack.c \
144         jdwp/ExpandBuf.c \
145         jdwp/JdwpAdb.c \
146         jdwp/JdwpConstants.c \
147         jdwp/JdwpEvent.c \
148         jdwp/JdwpHandler.c \
149         jdwp/JdwpMain.c \
150         jdwp/JdwpSocket.c \
151         mterp/Mterp.c.arm \
152         mterp/out/InterpC-portable.c.arm \
153         native/InternalNative.c \
154         native/dalvik_bytecode_OpcodeInfo.c \
155         native/dalvik_system_DexFile.c \
156         native/dalvik_system_VMDebug.c \
157         native/dalvik_system_VMRuntime.c \
158         native/dalvik_system_VMStack.c \
159         native/dalvik_system_Zygote.c \
160         native/java_lang_Class.c \
161         native/java_lang_Double.c \
162         native/java_lang_Float.c \
163         native/java_lang_Math.c \
164         native/java_lang_Object.c \
165         native/java_lang_Runtime.c \
166         native/java_lang_String.c \
167         native/java_lang_System.c \
168         native/java_lang_Throwable.c \
169         native/java_lang_VMClassLoader.c \
170         native/java_lang_VMThread.c \
171         native/java_lang_reflect_AccessibleObject.c \
172         native/java_lang_reflect_Array.c \
173         native/java_lang_reflect_Constructor.c \
174         native/java_lang_reflect_Field.c \
175         native/java_lang_reflect_Method.c \
176         native/java_lang_reflect_Proxy.c \
177         native/java_util_concurrent_atomic_AtomicLong.c \
178         native/org_apache_harmony_dalvik_NativeTestTarget.c \
179         native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
180         native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
181         native/sun_misc_Unsafe.c \
182         oo/AccessCheck.c \
183         oo/Array.c \
184         oo/Class.c \
185         oo/Object.c \
186         oo/Resolve.c \
187         oo/TypeCheck.c \
188         reflect/Annotation.c \
189         reflect/Proxy.c \
190         reflect/Reflect.c \
191         test/AtomicTest.c.arm \
192         test/TestHash.c \
193         test/TestIndirectRefTable.c
194
195 WITH_COPYING_GC := $(strip $(WITH_COPYING_GC))
196
197 ifeq ($(WITH_COPYING_GC),true)
198   LOCAL_CFLAGS += -DWITH_COPYING_GC
199   LOCAL_SRC_FILES += \
200         alloc/Copying.c.arm
201 else
202   LOCAL_SRC_FILES += \
203         alloc/HeapSource.c \
204         alloc/MarkSweep.c.arm
205 endif
206
207 WITH_JIT := $(strip $(WITH_JIT))
208
209 ifeq ($(WITH_JIT),true)
210   LOCAL_CFLAGS += -DWITH_JIT
211   LOCAL_SRC_FILES += \
212         compiler/Compiler.c \
213         compiler/Frontend.c \
214         compiler/Utility.c \
215         compiler/InlineTransformation.c \
216         compiler/IntermediateRep.c \
217         compiler/Dataflow.c \
218         compiler/SSATransformation.c \
219         compiler/Loop.c \
220         compiler/Ralloc.c \
221         interp/Jit.c
222 endif
223
224 LOCAL_C_INCLUDES += \
225         $(JNI_H_INCLUDE) \
226         dalvik \
227         dalvik/vm \
228         external/zlib \
229         $(KERNEL_HEADERS)
230
231
232 ifeq ($(dvm_simulator),true)
233   LOCAL_LDLIBS += -lpthread -ldl
234   ifeq ($(HOST_OS),linux)
235     # need this for clock_gettime() in profiling
236     LOCAL_LDLIBS += -lrt
237   endif
238 endif
239
240 MTERP_ARCH_KNOWN := false
241
242 ifeq ($(dvm_arch),arm)
243   #dvm_arch_variant := armv7-a
244   #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
245   LOCAL_CFLAGS += -Werror
246   MTERP_ARCH_KNOWN := true
247   # Select architecture-specific sources (armv5te, armv7-a, etc.)
248   LOCAL_SRC_FILES += \
249                 arch/arm/CallOldABI.S \
250                 arch/arm/CallEABI.S \
251                 arch/arm/HintsEABI.c \
252                 mterp/out/InterpC-$(dvm_arch_variant).c.arm \
253                 mterp/out/InterpAsm-$(dvm_arch_variant).S
254
255   ifeq ($(WITH_JIT),true)
256     LOCAL_SRC_FILES += \
257                 compiler/codegen/RallocUtil.c \
258                 compiler/codegen/arm/$(dvm_arch_variant)/Codegen.c \
259                 compiler/codegen/arm/$(dvm_arch_variant)/CallingConvention.S \
260                 compiler/codegen/arm/Assemble.c \
261                 compiler/codegen/arm/ArchUtility.c \
262                 compiler/codegen/arm/LocalOptimizations.c \
263                 compiler/codegen/arm/GlobalOptimizations.c \
264                 compiler/codegen/arm/ArmRallocUtil.c \
265                 compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
266   endif
267 endif
268
269 ifeq ($(dvm_arch),x86)
270   ifeq ($(dvm_os),linux)
271     MTERP_ARCH_KNOWN := true
272     LOCAL_CFLAGS += -DDVM_JMP_TABLE_MTERP=1
273     LOCAL_SRC_FILES += \
274                 arch/$(dvm_arch_variant)/Call386ABI.S \
275                 arch/$(dvm_arch_variant)/Hints386ABI.c \
276                 mterp/out/InterpC-$(dvm_arch_variant).c \
277                 mterp/out/InterpAsm-$(dvm_arch_variant).S
278     ifeq ($(WITH_JIT),true)
279       LOCAL_SRC_FILES += \
280                 compiler/codegen/x86/Assemble.c \
281                 compiler/codegen/x86/ArchUtility.c \
282                 compiler/codegen/x86/ia32/Codegen.c \
283                 compiler/codegen/x86/ia32/CallingConvention.S \
284                 compiler/template/out/CompilerTemplateAsm-ia32.S
285     endif
286   endif
287 endif
288
289 ifeq ($(dvm_arch),sh)
290   MTERP_ARCH_KNOWN := true
291   LOCAL_SRC_FILES += \
292                 arch/sh/CallSH4ABI.S \
293                 arch/generic/Hints.c \
294                 mterp/out/InterpC-allstubs.c \
295                 mterp/out/InterpAsm-allstubs.S
296 endif
297
298 ifeq ($(MTERP_ARCH_KNOWN),false)
299   # unknown architecture, try to use FFI
300   LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch)
301
302   ifeq ($(dvm_os)-$(dvm_arch),darwin-x86)
303       # OSX includes libffi, so just make the linker aware of it directly.
304       LOCAL_LDLIBS += -lffi
305   else
306       LOCAL_SHARED_LIBRARIES += libffi
307   endif
308
309   LOCAL_SRC_FILES += \
310                 arch/generic/Call.c \
311                 arch/generic/Hints.c \
312                 mterp/out/InterpC-allstubs.c
313
314   # The following symbols are usually defined in the asm file, but
315   # since we don't have an asm file in this case, we instead just
316   # peg them at 0 here, and we add an #ifdef'able define for good
317   # measure, too.
318   LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
319         -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1
320 endif