blob: 9f5030b32e7f33ecc4699492b45dc9f2e2ef1a0f [file] [log] [blame]
The Android Open Source Projectf6c38712009-03-03 19:28:47 -08001# 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#
Dan Bornstein42122412009-07-21 16:08:39 -070016# 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#
Andy McFadden12def722009-12-01 15:53:41 -080022# 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
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080027#
Dan Bornstein42122412009-07-21 16:08:39 -070028
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080029LOCAL_PATH:= $(call my-dir)
Dan Bornstein42122412009-07-21 16:08:39 -070030
31#
32# Build for the target (device).
33#
34
Ben Chengbb0dce52009-11-03 16:19:11 -080035# Build the installed version (libdvm.so) first
36include $(LOCAL_PATH)/ReconfigureDvm.mk
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080037
Ben Chengbb0dce52009-11-03 16:19:11 -080038# Overwrite default settings
39ifeq ($(TARGET_SIMULATOR),false)
40 LOCAL_PRELINK_MODULE := true
41endif
42LOCAL_MODULE_TAGS := user
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080043LOCAL_MODULE := libdvm
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080044include $(BUILD_SHARED_LIBRARY)
Dan Bornstein42122412009-07-21 16:08:39 -070045
Ben Chengbb0dce52009-11-03 16:19:11 -080046# If WITH_JIT is configured, build multiple versions of libdvm.so to facilitate
47# correctness/performance bugs triage
48ifeq ($(WITH_JIT),true)
49
50 # Derivation #1
51 # Enable assert and JIT tuning
52 include $(LOCAL_PATH)/ReconfigureDvm.mk
53
54 # Enable asserion and JIT-tuning
55 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT \
56 -DWITH_JIT_TUNING -DEXIT_STATS
57 LOCAL_MODULE := libdvm_assert
58 include $(BUILD_SHARED_LIBRARY)
59
60 # Derivation #2
61 # Enable assert and self-verification
62 include $(LOCAL_PATH)/ReconfigureDvm.mk
63
64 # Enable asserion and JIT self-verification
65 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT \
66 -DWITH_SELF_VERIFICATION
67 LOCAL_MODULE := libdvm_sv
68 include $(BUILD_SHARED_LIBRARY)
69
70 # Devivation #3
71 # Compile out the JIT
72 WITH_JIT := false
73 include $(LOCAL_PATH)/ReconfigureDvm.mk
74
75 LOCAL_MODULE := libdvm_interp
76 include $(BUILD_SHARED_LIBRARY)
77
78endif
Dan Bornstein42122412009-07-21 16:08:39 -070079
80#
81# Build for the host.
82#
83
84ifeq ($(WITH_HOST_DALVIK),true)
85
86 include $(CLEAR_VARS)
87
88 # Variables used in the included Dvm.mk.
89 dvm_os := $(HOST_OS)
90 dvm_arch := $(HOST_ARCH)
91 dvm_arch_variant := $(HOST_ARCH_VARIANT)
92 dvm_simulator := false
93
94 include $(LOCAL_PATH)/Dvm.mk
95
Dan Bornstein524fea12009-10-23 13:25:03 -070096 # We need to include all of these libraries. The end result of this
97 # section is a static library, but LOCAL_STATIC_LIBRARIES doesn't
98 # actually cause any code from the specified libraries to be included,
99 # whereas LOCAL_WHOLE_STATIC_LIBRARIES does. No, I (danfuzz) am not
100 # entirely sure what LOCAL_STATIC_LIBRARIES is even supposed to mean
101 # in this context, but it is in (apparently) meaningfully used in
102 # other parts of the build.
Dan Bornstein22620b82009-10-16 10:51:23 -0700103 LOCAL_WHOLE_STATIC_LIBRARIES += \
Dan Bornstein524fea12009-10-23 13:25:03 -0700104 libnativehelper-host libdex liblog libcutils
Dan Bornstein42122412009-07-21 16:08:39 -0700105
Dan Bornsteind45a48f2009-10-22 15:58:32 -0700106 # The libffi from the source tree should never be used by host builds.
107 # The recommendation is that host builds should always either
108 # have sufficient custom code so that libffi isn't needed at all,
109 # or they should use the platform's provided libffi. So, if the common
110 # build rules decided to include it, axe it back out here.
Dan Bornstein93194e92009-08-24 17:50:34 -0700111 ifneq (,$(findstring libffi,$(LOCAL_SHARED_LIBRARIES)))
112 LOCAL_SHARED_LIBRARIES := \
113 $(patsubst libffi, ,$(LOCAL_SHARED_LIBRARIES))
Dan Bornstein93194e92009-08-24 17:50:34 -0700114 endif
Dan Bornsteind45a48f2009-10-22 15:58:32 -0700115
Dan Bornstein42122412009-07-21 16:08:39 -0700116 LOCAL_MODULE := libdvm-host
117
Dan Bornstein93194e92009-08-24 17:50:34 -0700118 include $(BUILD_HOST_STATIC_LIBRARY)
Dan Bornstein42122412009-07-21 16:08:39 -0700119
120endif