Android.mk revision d45a48f380ba5399caf205c49e714026f0bb8edc
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#
17# Android.mk for Dalvik VM.
18#
19# This makefile builds both for host and target, and so the very large
20# swath of common definitions are factored out into a separate file to
21# minimize duplication.
22#
23# Also, if you enable or disable optional features here (or Dvm.mk),
24# rebuild the VM with "make clean-libdvm && make -j4 libdvm".
25#
26
27LOCAL_PATH:= $(call my-dir)
28
29#
30# Build for the target (device).
31#
32
33include $(CLEAR_VARS)
34
35# Variables used in the included Dvm.mk.
36dvm_os := $(TARGET_OS)
37dvm_arch := $(TARGET_ARCH)
38dvm_arch_variant := $(TARGET_ARCH_VARIANT)
39dvm_simulator := $(TARGET_SIMULATOR)
40
41include $(LOCAL_PATH)/Dvm.mk
42
43# liblog and libcutils are shared in this case.
44LOCAL_SHARED_LIBRARIES += \
45	liblog libcutils
46
47# libdex is static in this case. (That is, on device, we only include
48# whatever we specifically need from it directly in libdvm.)
49LOCAL_STATIC_LIBRARIES += libdex
50
51LOCAL_MODULE := libdvm
52
53include $(BUILD_SHARED_LIBRARY)
54
55
56#
57# Build for the host.
58#
59
60ifeq ($(WITH_HOST_DALVIK),true)
61
62    include $(CLEAR_VARS)
63
64    # Variables used in the included Dvm.mk.
65    dvm_os := $(HOST_OS)
66    dvm_arch := $(HOST_ARCH)
67    dvm_arch_variant := $(HOST_ARCH_VARIANT)
68    dvm_simulator := false
69
70    include $(LOCAL_PATH)/Dvm.mk
71
72    # And we need to include all of liblog, libcutils, and libdex:
73    # The result itself is a static library, and LOCAL_STATIC_LIBRARIES
74    # doesn't actually cause any code from the specified libraries to
75    # be included. No I'm not entirely sure what LOCAL_STATIC_LIBRARIES
76    # is even supposed to mean in this context, but it is in fact
77    # meaningfully used in other parts of the build.
78    LOCAL_WHOLE_STATIC_LIBRARIES += \
79	libdex liblog libcutils
80
81    # The libffi from the source tree should never be used by host builds.
82    # The recommendation is that host builds should always either
83    # have sufficient custom code so that libffi isn't needed at all,
84    # or they should use the platform's provided libffi. So, if the common
85    # build rules decided to include it, axe it back out here.
86    ifneq (,$(findstring libffi,$(LOCAL_SHARED_LIBRARIES)))
87        LOCAL_SHARED_LIBRARIES := \
88            $(patsubst libffi, ,$(LOCAL_SHARED_LIBRARIES))
89    endif
90
91    # The nativehelper library is called libnativehelper-host on the
92    # host and is static. So, if the common build rule decided to
93    # include it, rename it and switch what list it's in here.
94    ifneq (,$(findstring libnativehelper,$(LOCAL_SHARED_LIBRARIES)))
95        LOCAL_SHARED_LIBRARIES := \
96            $(patsubst libnativehelper, ,$(LOCAL_SHARED_LIBRARIES))
97        LOCAL_STATIC_LIBRARIES += libnativehelper-host
98    endif
99
100    LOCAL_MODULE := libdvm-host
101
102    include $(BUILD_HOST_STATIC_LIBRARY)
103
104endif
105