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