Android.mk revision f6c387128427e121477c1b32ad35cdcaa5101ba3
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# 19LOCAL_PATH:= $(call my-dir) 20include $(CLEAR_VARS) 21 22 23# 24# Compiler defines. 25# 26LOCAL_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# 31LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER 32 33# 0=full cache, 1/2=reduced, 3=no cache 34LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0 35 36ifeq ($(WITH_DEADLOCK_PREDICTION),true) 37 LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION 38 WITH_MONITOR_TRACKING := true 39endif 40ifeq ($(WITH_MONITOR_TRACKING),true) 41 LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING 42endif 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# 54ifeq ($(TARGET_BUILD_TYPE),debug) 55LOCAL_CFLAGS += -DWITH_INSTR_CHECKS -DWITH_EXTRA_OBJECT_VALIDATION 56LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS 57LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS 58#LOCAL_CFLAGS += -DCHECK_MUTEX 59#LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS 60LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3 61# add some extra stuff to make it easier to examine with GDB 62LOCAL_CFLAGS += -DEASY_GDB 63endif 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# 72ifeq ($(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 76LOCAL_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 79endif 80 81# bug hunting: checksum and verify interpreted stack when making JNI calls 82#LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK 83 84LOCAL_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 178WITH_HPROF := $(strip $(WITH_HPROF)) 179ifeq ($(WITH_HPROF),) 180 WITH_HPROF := true 181endif 182ifeq ($(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 201endif # WITH_HPROF 202 203ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true) 204 LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1 205endif 206 207LOCAL_C_INCLUDES += \ 208 $(JNI_H_INCLUDE) \ 209 dalvik \ 210 dalvik/vm \ 211 external/zlib \ 212 $(KERNEL_HEADERS) 213 214 215ifeq ($(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 221else 222 LOCAL_SHARED_LIBRARIES += libdl 223endif 224 225ifeq ($(TARGET_ARCH),arm) 226 LOCAL_SRC_FILES += \ 227 arch/arm/CallOldABI.S \ 228 arch/arm/CallEABI.S \ 229 arch/arm/HintsEABI.c 230 # TODO: select sources for ARMv4 vs. ARMv5TE 231 LOCAL_SRC_FILES += \ 232 mterp/out/InterpC-armv5te.c.arm \ 233 mterp/out/InterpAsm-armv5te.S 234 LOCAL_SHARED_LIBRARIES += libdl 235else 236 ifeq ($(TARGET_ARCH),x86) 237 LOCAL_SRC_FILES += \ 238 arch/x86/Call386ABI.S \ 239 arch/x86/Hints386ABI.c 240 LOCAL_SRC_FILES += \ 241 mterp/out/InterpC-x86.c \ 242 mterp/out/InterpAsm-x86.S 243 else 244 # unknown architecture, try to use FFI 245 LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH) 246 LOCAL_SRC_FILES += \ 247 arch/generic/Call.c \ 248 arch/generic/Hints.c 249 LOCAL_SHARED_LIBRARIES += libffi 250 251 LOCAL_SRC_FILES += \ 252 mterp/out/InterpC-allstubs.c \ 253 mterp/out/InterpAsm-allstubs.S 254 endif 255endif 256 257 258LOCAL_MODULE := libdvm 259 260LOCAL_SHARED_LIBRARIES += \ 261 liblog \ 262 libcutils \ 263 libnativehelper \ 264 libz 265 266LOCAL_STATIC_LIBRARIES += \ 267 libdex 268 269include $(BUILD_SHARED_LIBRARY) 270