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