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 += -Wall -Wextra -Wno-unused-parameter
29 LOCAL_CFLAGS += -DARCH_VARIANT=\"$(dvm_arch_variant)\"
32 # Optional features. These may impact the size or performance of the VM.
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 ifneq ($(strip $(DEBUG_DALVIK_VM)),)
39 dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
42 ifeq ($(dvm_make_debug_vm),true)
47 # - tracked-reference verification enabled
48 # - allocation limits enabled
49 # - GDB helpers enabled
53 LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
54 LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
55 LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
56 LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
57 #LOCAL_CFLAGS += -DCHECK_MUTEX
58 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
59 # add some extra stuff to make it easier to examine with GDB
60 LOCAL_CFLAGS += -DEASY_GDB
61 # overall config may be for a "release" build, so reconfigure these
62 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
63 else # !dvm_make_debug_vm
65 # "Performance" profile:
66 # - all development features disabled
67 # - compiler optimizations enabled (redundant for "release" builds)
68 # - (debugging and profiling still enabled)
70 #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
71 # "-O2" is redundant for device (release) but useful for sim (debug)
72 #LOCAL_CFLAGS += -O2 -Winline
73 #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
74 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
75 # if you want to try with assertions on the device, add:
76 #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
77 endif # !dvm_make_debug_vm
79 # bug hunting: checksum and verify interpreted stack when making JNI calls
80 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
93 IndirectRefTable.cpp.arm \
96 InlineNative.cpp.arm \
114 alloc/CardTable.cpp \
115 alloc/HeapBitmap.cpp.arm \
116 alloc/HeapDebug.cpp \
121 analysis/CodeVerify.cpp \
122 analysis/DexPrepare.cpp \
123 analysis/DexVerify.cpp \
124 analysis/Liveness.cpp \
125 analysis/Optimize.cpp \
126 analysis/RegisterMap.cpp \
127 analysis/VerifySubs.cpp \
128 analysis/VfyBasicBlock.cpp \
130 hprof/HprofClass.cpp \
131 hprof/HprofHeap.cpp \
132 hprof/HprofOutput.cpp \
133 hprof/HprofString.cpp \
134 interp/Interp.cpp.arm \
138 jdwp/JdwpConstants.cpp \
140 jdwp/JdwpHandler.cpp \
142 jdwp/JdwpSocket.cpp \
143 mterp/Mterp.cpp.arm \
144 mterp/out/InterpC-portable.cpp.arm \
145 native/InternalNative.cpp \
146 native/dalvik_bytecode_OpcodeInfo.cpp \
147 native/dalvik_system_DexFile.cpp \
148 native/dalvik_system_VMDebug.cpp \
149 native/dalvik_system_VMRuntime.cpp \
150 native/dalvik_system_VMStack.cpp \
151 native/dalvik_system_Zygote.cpp \
152 native/java_lang_Class.cpp \
153 native/java_lang_Double.cpp \
154 native/java_lang_Float.cpp \
155 native/java_lang_Math.cpp \
156 native/java_lang_Object.cpp \
157 native/java_lang_Runtime.cpp \
158 native/java_lang_String.cpp \
159 native/java_lang_System.cpp \
160 native/java_lang_Throwable.cpp \
161 native/java_lang_VMClassLoader.cpp \
162 native/java_lang_VMThread.cpp \
163 native/java_lang_reflect_AccessibleObject.cpp \
164 native/java_lang_reflect_Array.cpp \
165 native/java_lang_reflect_Constructor.cpp \
166 native/java_lang_reflect_Field.cpp \
167 native/java_lang_reflect_Method.cpp \
168 native/java_lang_reflect_Proxy.cpp \
169 native/java_util_concurrent_atomic_AtomicLong.cpp \
170 native/org_apache_harmony_dalvik_NativeTestTarget.cpp \
171 native/org_apache_harmony_dalvik_ddmc_DdmServer.cpp \
172 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cpp \
173 native/sun_misc_Unsafe.cpp \
180 reflect/Annotation.cpp \
182 reflect/Reflect.cpp \
183 test/AtomicTest.cpp.arm \
185 test/TestIndirectRefTable.cpp
187 # TODO: this is the wrong test, but what's the right one?
188 ifneq ($(filter arm mips,$(dvm_arch)),)
189 LOCAL_SRC_FILES += os/android.cpp
191 LOCAL_SRC_FILES += os/linux.cpp
194 WITH_COPYING_GC := $(strip $(WITH_COPYING_GC))
196 ifeq ($(WITH_COPYING_GC),true)
197 LOCAL_CFLAGS += -DWITH_COPYING_GC
199 alloc/Copying.cpp.arm
202 alloc/HeapSource.cpp \
203 alloc/MarkSweep.cpp.arm
206 WITH_JIT := $(strip $(WITH_JIT))
208 ifeq ($(WITH_JIT),true)
209 LOCAL_CFLAGS += -DWITH_JIT
211 compiler/Compiler.cpp \
212 compiler/Frontend.cpp \
213 compiler/Utility.cpp \
214 compiler/InlineTransformation.cpp \
215 compiler/IntermediateRep.cpp \
216 compiler/Dataflow.cpp \
217 compiler/SSATransformation.cpp \
219 compiler/Ralloc.cpp \
223 LOCAL_C_INCLUDES += \
230 MTERP_ARCH_KNOWN := false
232 ifeq ($(dvm_arch),arm)
233 #dvm_arch_variant := armv7-a
234 #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
235 LOCAL_CFLAGS += -Werror
236 MTERP_ARCH_KNOWN := true
237 # Select architecture-specific sources (armv5te, armv7-a, etc.)
239 arch/arm/CallOldABI.S \
240 arch/arm/CallEABI.S \
241 arch/arm/HintsEABI.cpp \
242 mterp/out/InterpC-$(dvm_arch_variant).cpp.arm \
243 mterp/out/InterpAsm-$(dvm_arch_variant).S
245 ifeq ($(WITH_JIT),true)
247 compiler/codegen/RallocUtil.cpp \
248 compiler/codegen/arm/$(dvm_arch_variant)/Codegen.cpp \
249 compiler/codegen/arm/$(dvm_arch_variant)/CallingConvention.S \
250 compiler/codegen/arm/Assemble.cpp \
251 compiler/codegen/arm/ArchUtility.cpp \
252 compiler/codegen/arm/LocalOptimizations.cpp \
253 compiler/codegen/arm/GlobalOptimizations.cpp \
254 compiler/codegen/arm/ArmRallocUtil.cpp \
255 compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
259 ifeq ($(dvm_arch),mips)
260 MTERP_ARCH_KNOWN := true
261 LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
262 LOCAL_SHARED_LIBRARIES += libffi
264 arch/mips/CallO32.S \
265 arch/mips/HintsO32.cpp \
266 arch/generic/Call.cpp \
267 mterp/out/InterpC-mips.cpp \
268 mterp/out/InterpAsm-mips.S
270 ifeq ($(WITH_JIT),true)
271 dvm_arch_variant := mips
273 compiler/codegen/mips/RallocUtil.cpp \
274 compiler/codegen/mips/$(dvm_arch_variant)/Codegen.cpp \
275 compiler/codegen/mips/$(dvm_arch_variant)/CallingConvention.S \
276 compiler/codegen/mips/Assemble.cpp \
277 compiler/codegen/mips/ArchUtility.cpp \
278 compiler/codegen/mips/LocalOptimizations.cpp \
279 compiler/codegen/mips/GlobalOptimizations.cpp \
280 compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
284 ifeq ($(dvm_arch),x86)
285 ifeq ($(dvm_os),linux)
286 MTERP_ARCH_KNOWN := true
287 LOCAL_CFLAGS += -DDVM_JMP_TABLE_MTERP=1
289 arch/$(dvm_arch_variant)/Call386ABI.S \
290 arch/$(dvm_arch_variant)/Hints386ABI.cpp \
291 mterp/out/InterpC-$(dvm_arch_variant).cpp \
292 mterp/out/InterpAsm-$(dvm_arch_variant).S
293 ifeq ($(WITH_JIT),true)
295 compiler/codegen/x86/Assemble.cpp \
296 compiler/codegen/x86/ArchUtility.cpp \
297 compiler/codegen/x86/ia32/Codegen.cpp \
298 compiler/codegen/x86/ia32/CallingConvention.S \
299 compiler/template/out/CompilerTemplateAsm-ia32.S
304 ifeq ($(dvm_arch),sh)
305 MTERP_ARCH_KNOWN := true
307 arch/sh/CallSH4ABI.S \
308 arch/generic/Hints.cpp \
309 mterp/out/InterpC-allstubs.cpp \
310 mterp/out/InterpAsm-allstubs.S
313 ifeq ($(MTERP_ARCH_KNOWN),false)
314 # unknown architecture, try to use FFI
315 LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch)
317 ifeq ($(dvm_os)-$(dvm_arch),darwin-x86)
318 # OSX includes libffi, so just make the linker aware of it directly.
319 LOCAL_LDLIBS += -lffi
321 LOCAL_SHARED_LIBRARIES += libffi
325 arch/generic/Call.cpp \
326 arch/generic/Hints.cpp \
327 mterp/out/InterpC-allstubs.cpp
329 # The following symbols are usually defined in the asm file, but
330 # since we don't have an asm file in this case, we instead just
331 # peg them at 0 here, and we add an #ifdef'able define for good
333 LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
334 -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1