1 # Copyright (C) 2008 The Android Open Source Project
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 # Common definitions for host or target builds of libdvm.
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.)
27 LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
28 #LOCAL_CFLAGS += -DUSE_INDIRECT_REF
29 LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter
32 # Optional features. These may impact the size or performance of the VM.
34 LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER
36 # 0=full cache, 1/2=reduced, 3=no cache
37 LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0
39 ifeq ($(WITH_DEADLOCK_PREDICTION),true)
40 LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION
41 WITH_MONITOR_TRACKING := true
43 ifeq ($(WITH_MONITOR_TRACKING),true)
44 LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING
47 # Make a debugging version when building the simulator (if not told
48 # otherwise) and when explicitly asked.
49 dvm_make_debug_vm := false
50 ifeq ($(strip $(DEBUG_DALVIK_VM)),)
51 ifeq ($(dvm_simulator),true)
52 dvm_make_debug_vm := true
55 dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
58 ifeq ($(dvm_make_debug_vm),true)
63 # - tracked-reference verification enabled
64 # - allocation limits enabled
65 # - GDB helpers enabled
69 LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
70 LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
71 LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
72 LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
73 LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
74 #LOCAL_CFLAGS += -DCHECK_MUTEX
75 #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
76 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
77 # add some extra stuff to make it easier to examine with GDB
78 LOCAL_CFLAGS += -DEASY_GDB
79 # overall config may be for a "release" build, so reconfigure these
80 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
81 else # !dvm_make_debug_vm
83 # "Performance" profile:
84 # - all development features disabled
85 # - compiler optimizations enabled (redundant for "release" builds)
86 # - (debugging and profiling still enabled)
88 #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
89 # "-O2" is redundant for device (release) but useful for sim (debug)
90 #LOCAL_CFLAGS += -O2 -Winline
91 #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
92 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
93 # if you want to try with assertions on the device, add:
94 #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
95 endif # !dvm_make_debug_vm
97 # bug hunting: checksum and verify interpreted stack when making JNI calls
98 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
110 IndirectRefTable.c.arm \
134 alloc/HeapBitmap.c.arm \
142 analysis/CodeVerify.c \
143 analysis/DexPrepare.c \
144 analysis/DexVerify.c \
145 analysis/Optimize.c \
146 analysis/ReduceConstants.c \
147 analysis/RegisterMap.c \
148 analysis/VerifySubs.c \
149 interp/Interp.c.arm \
153 jdwp/JdwpConstants.c \
159 mterp/out/InterpC-portstd.c.arm \
160 mterp/out/InterpC-portdbg.c.arm \
161 native/InternalNative.c \
162 native/dalvik_system_DexFile.c \
163 native/dalvik_system_SamplingProfiler.c \
164 native/dalvik_system_VMDebug.c \
165 native/dalvik_system_VMRuntime.c \
166 native/dalvik_system_VMStack.c \
167 native/dalvik_system_Zygote.c \
168 native/java_lang_Class.c \
169 native/java_lang_Object.c \
170 native/java_lang_Runtime.c \
171 native/java_lang_String.c \
172 native/java_lang_System.c \
173 native/java_lang_SystemProperties.c \
174 native/java_lang_Throwable.c \
175 native/java_lang_VMClassLoader.c \
176 native/java_lang_VMThread.c \
177 native/java_lang_reflect_AccessibleObject.c \
178 native/java_lang_reflect_Array.c \
179 native/java_lang_reflect_Constructor.c \
180 native/java_lang_reflect_Field.c \
181 native/java_lang_reflect_Method.c \
182 native/java_lang_reflect_Proxy.c \
183 native/java_security_AccessController.c \
184 native/java_util_concurrent_atomic_AtomicLong.c \
185 native/org_apache_harmony_dalvik_NativeTestTarget.c \
186 native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
187 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
188 native/sun_misc_Unsafe.c \
189 native/SystemThread.c \
196 reflect/Annotation.c \
199 test/AtomicTest.c.arm \
201 test/TestIndirectRefTable.c
203 WITH_COPYING_GC := $(strip $(WITH_COPYING_GC))
205 ifeq ($(WITH_COPYING_GC),true)
206 LOCAL_CFLAGS += -DWITH_COPYING_GC
212 alloc/MarkSweep.c.arm
215 WITH_JIT := $(strip $(WITH_JIT))
217 ifeq ($(WITH_JIT),true)
218 LOCAL_CFLAGS += -DWITH_JIT
220 compiler/Compiler.c \
221 compiler/Frontend.c \
223 compiler/InlineTransformation.c \
224 compiler/IntermediateRep.c \
225 compiler/Dataflow.c \
231 WITH_HPROF := $(strip $(WITH_HPROF))
232 ifeq ($(WITH_HPROF),)
235 ifeq ($(WITH_HPROF),true)
240 hprof/HprofOutput.c \
242 LOCAL_CFLAGS += -DWITH_HPROF=1
244 ifeq ($(strip $(WITH_HPROF_STACK)),true)
247 hprof/HprofStackFrame.c
248 LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
249 endif # WITH_HPROF_STACK
252 LOCAL_C_INCLUDES += \
260 ifeq ($(dvm_simulator),true)
261 LOCAL_LDLIBS += -lpthread -ldl
262 ifeq ($(HOST_OS),linux)
263 # need this for clock_gettime() in profiling
268 MTERP_ARCH_KNOWN := false
270 ifeq ($(dvm_arch),arm)
271 #dvm_arch_variant := armv7-a
272 #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
273 LOCAL_CFLAGS += -Werror
274 MTERP_ARCH_KNOWN := true
275 # Select architecture-specific sources (armv4t, armv5te etc.)
277 arch/arm/CallOldABI.S \
278 arch/arm/CallEABI.S \
279 arch/arm/HintsEABI.c \
280 mterp/out/InterpC-$(dvm_arch_variant).c.arm \
281 mterp/out/InterpAsm-$(dvm_arch_variant).S
283 ifeq ($(WITH_JIT),true)
285 compiler/codegen/arm/RallocUtil.c \
286 compiler/codegen/arm/$(dvm_arch_variant)/Codegen.c \
287 compiler/codegen/arm/$(dvm_arch_variant)/CallingConvention.S \
288 compiler/codegen/arm/Assemble.c \
289 compiler/codegen/arm/ArchUtility.c \
290 compiler/codegen/arm/LocalOptimizations.c \
291 compiler/codegen/arm/GlobalOptimizations.c \
292 compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
296 ifeq ($(dvm_arch),x86)
297 ifeq ($(dvm_os),linux)
298 MTERP_ARCH_KNOWN := true
300 arch/$(dvm_arch_variant)/Call386ABI.S \
301 arch/$(dvm_arch_variant)/Hints386ABI.c \
302 mterp/out/InterpC-$(dvm_arch_variant).c \
303 mterp/out/InterpAsm-$(dvm_arch_variant).S
307 ifeq ($(dvm_arch),sh)
308 MTERP_ARCH_KNOWN := true
310 arch/sh/CallSH4ABI.S \
311 arch/generic/Hints.c \
312 mterp/out/InterpC-allstubs.c \
313 mterp/out/InterpAsm-allstubs.S
316 ifeq ($(MTERP_ARCH_KNOWN),false)
317 # unknown architecture, try to use FFI
318 LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch)
320 ifeq ($(dvm_os)-$(dvm_arch),darwin-x86)
321 # OSX includes libffi, so just make the linker aware of it directly.
322 LOCAL_LDLIBS += -lffi
324 LOCAL_SHARED_LIBRARIES += libffi
328 arch/generic/Call.c \
329 arch/generic/Hints.c \
330 mterp/out/InterpC-allstubs.c
332 # The following symbols are usually defined in the asm file, but
333 # since we don't have an asm file in this case, we instead just
334 # peg them at 0 here, and we add an #ifdef'able define for good
336 LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
337 -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1
340 ifeq ($(TEST_VM_IN_ECLAIR),true)
341 LOCAL_CFLAGS += -DTEST_VM_IN_ECLAIR