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