The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 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, |
The Android Open Source Project | 89c1feb | 2008-12-17 18:03:55 -0800 | [diff] [blame] | 17 | # rebuild the VM with "make clean-libdvm && make -j4 libdvm". |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 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 | |
The Android Open Source Project | 89c1feb | 2008-12-17 18:03:55 -0800 | [diff] [blame] | 33 | # 0=full cache, 1/2=reduced, 3=no cache |
| 34 | LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0 |
| 35 | |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 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 \ |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 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 \ |
The Android Open Source Project | 89c1feb | 2008-12-17 18:03:55 -0800 | [diff] [blame] | 125 | analysis/ReduceConstants.c \ |
The Android Open Source Project | cc05ad2 | 2009-01-09 17:50:54 -0800 | [diff] [blame] | 126 | analysis/RegisterMap.c \ |
| 127 | analysis/VerifySubs.c \ |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 128 | interp/Interp.c.arm \ |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 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 \ |
The Android Open Source Project | 89c1feb | 2008-12-17 18:03:55 -0800 | [diff] [blame] | 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 \ |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 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 | |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 214 | |
| 215 | ifeq ($(TARGET_SIMULATOR),true) |
The Android Open Source Project | 89c1feb | 2008-12-17 18:03:55 -0800 | [diff] [blame] | 216 | LOCAL_LDLIBS += -lpthread -ldl |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 217 | ifeq ($(HOST_OS),linux) |
| 218 | # need this for clock_gettime() in profiling |
| 219 | LOCAL_LDLIBS += -lrt |
| 220 | endif |
The Android Open Source Project | 89c1feb | 2008-12-17 18:03:55 -0800 | [diff] [blame] | 221 | else |
| 222 | LOCAL_SHARED_LIBRARIES += libdl |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 223 | endif |
| 224 | |
| 225 | ifeq ($(TARGET_ARCH),arm) |
The Android Open Source Project | 89c1feb | 2008-12-17 18:03:55 -0800 | [diff] [blame] | 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 |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 235 | else |
The Android Open Source Project | 89c1feb | 2008-12-17 18:03:55 -0800 | [diff] [blame] | 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 |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 255 | endif |
| 256 | |
The Android Open Source Project | 89c1feb | 2008-12-17 18:03:55 -0800 | [diff] [blame] | 257 | |
The Android Open Source Project | 2ad60cf | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 258 | LOCAL_MODULE := libdvm |
| 259 | |
| 260 | LOCAL_SHARED_LIBRARIES += \ |
| 261 | liblog \ |
| 262 | libcutils \ |
| 263 | libnativehelper \ |
| 264 | libz |
| 265 | |
| 266 | LOCAL_STATIC_LIBRARIES += \ |
| 267 | libdex |
| 268 | |
| 269 | include $(BUILD_SHARED_LIBRARY) |