Android.mk revision 4d92e68103159bea0e36b98d9f18473e5805f52b
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. 17# 18# This makefile builds both for host and target, and so the very large 19# swath of common definitions are factored out into a separate file to 20# minimize duplication. 21# 22# If you enable or disable optional features here (or in Dvm.mk), 23# rebuild the VM with: 24# 25# make clean-libdvm clean-libdvm_assert clean-libdvm_sv clean-libdvm_interp 26# make -j4 libdvm 27# 28 29LOCAL_PATH:= $(call my-dir) 30 31# 32# Build for the target (device). 33# 34 35ifeq ($(TARGET_CPU_SMP),true) 36 target_smp_flag := -DANDROID_SMP=1 37else 38 target_smp_flag := -DANDROID_SMP=0 39endif 40host_smp_flag := -DANDROID_SMP=1 41 42# Build the installed version (libdvm.so) first 43include $(LOCAL_PATH)/ReconfigureDvm.mk 44 45# Overwrite default settings 46ifneq ($(TARGET_ARCH),x86) 47ifeq ($(TARGET_SIMULATOR),false) 48 LOCAL_PRELINK_MODULE := true 49endif 50endif 51LOCAL_MODULE_TAGS := user 52LOCAL_MODULE := libdvm 53LOCAL_CFLAGS += $(target_smp_flag) 54include $(BUILD_SHARED_LIBRARY) 55 56# If WITH_JIT is configured, build multiple versions of libdvm.so to facilitate 57# correctness/performance bugs triage 58ifeq ($(WITH_JIT),true) 59 60 # Derivation #1 61 # Enable assert and JIT tuning 62 include $(LOCAL_PATH)/ReconfigureDvm.mk 63 64 # Enable assertions and JIT-tuning 65 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT \ 66 -DWITH_JIT_TUNING $(target_smp_flag) 67 LOCAL_MODULE := libdvm_assert 68 include $(BUILD_SHARED_LIBRARY) 69 70 # Derivation #2 71 # Enable assert and self-verification 72 include $(LOCAL_PATH)/ReconfigureDvm.mk 73 74 # Enable assertions and JIT self-verification 75 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT \ 76 -DWITH_SELF_VERIFICATION $(target_smp_flag) 77 LOCAL_MODULE := libdvm_sv 78 include $(BUILD_SHARED_LIBRARY) 79 80 # Devivation #3 81 # Compile out the JIT 82 WITH_JIT := false 83 include $(LOCAL_PATH)/ReconfigureDvm.mk 84 85 LOCAL_CFLAGS += $(target_smp_flag) 86 LOCAL_MODULE := libdvm_interp 87 include $(BUILD_SHARED_LIBRARY) 88 89endif 90 91# 92# Build for the host. 93# 94 95ifeq ($(WITH_HOST_DALVIK),true) 96 97 include $(CLEAR_VARS) 98 99 # Variables used in the included Dvm.mk. 100 dvm_os := $(HOST_OS) 101 dvm_arch := $(HOST_ARCH) 102 # Note: HOST_ARCH_VARIANT isn't defined. 103 dvm_arch_variant := $(HOST_ARCH) 104 dvm_simulator := false 105 106 include $(LOCAL_PATH)/Dvm.mk 107 108 # We need to include all of these libraries. The end result of this 109 # section is a static library, but LOCAL_STATIC_LIBRARIES doesn't 110 # actually cause any code from the specified libraries to be included, 111 # whereas LOCAL_WHOLE_STATIC_LIBRARIES does. No, I (danfuzz) am not 112 # entirely sure what LOCAL_STATIC_LIBRARIES is even supposed to mean 113 # in this context, but it is in (apparently) meaningfully used in 114 # other parts of the build. 115 LOCAL_WHOLE_STATIC_LIBRARIES += \ 116 libnativehelper-host libdex liblog libcutils 117 118 # The libffi from the source tree should never be used by host builds. 119 # The recommendation is that host builds should always either 120 # have sufficient custom code so that libffi isn't needed at all, 121 # or they should use the platform's provided libffi. So, if the common 122 # build rules decided to include it, axe it back out here. 123 ifneq (,$(findstring libffi,$(LOCAL_SHARED_LIBRARIES))) 124 LOCAL_SHARED_LIBRARIES := \ 125 $(patsubst libffi, ,$(LOCAL_SHARED_LIBRARIES)) 126 endif 127 128 LOCAL_CFLAGS += $(host_smp_flag) 129 LOCAL_MODULE := libdvm-host 130 131 include $(BUILD_HOST_STATIC_LIBRARY) 132 133endif 134