Android.mk revision 1b6aee15157f0236ac1fc7885735609bf27171d3
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
15LOCAL_PATH:= $(call my-dir)
16
17# libutils is a little unique: It's built twice, once for the host
18# and once for the device.
19
20commonSources:= \
21	Asset.cpp \
22	AssetDir.cpp \
23	AssetManager.cpp \
24	BufferedTextOutput.cpp \
25	CallStack.cpp \
26	Debug.cpp \
27	FileMap.cpp \
28	RefBase.cpp \
29	ResourceTypes.cpp \
30	SharedBuffer.cpp \
31	Static.cpp \
32	StopWatch.cpp \
33	String8.cpp \
34	String16.cpp \
35	SystemClock.cpp \
36	TextOutput.cpp \
37	Threads.cpp \
38	Timers.cpp \
39	VectorImpl.cpp \
40    ZipFileCRO.cpp \
41	ZipFileRO.cpp \
42	ZipUtils.cpp \
43	misc.cpp \
44	LogSocket.cpp
45
46#
47# The cpp files listed here do not belong in the device
48# build.  Consult with the swetland before even thinking about
49# putting them in commonSources.
50#
51# They're used by the simulator runtime and by host-side tools like
52# aapt and the simulator front-end.
53#
54hostSources:= \
55	InetAddress.cpp \
56	Socket.cpp \
57	ZipEntry.cpp \
58	ZipFile.cpp
59
60# For the host
61# =====================================================
62
63include $(CLEAR_VARS)
64
65LOCAL_SRC_FILES:= $(commonSources) $(hostSources)
66
67ifeq ($(HOST_OS),linux)
68# Use the futex based mutex and condition variable
69# implementation from android-arm because it's shared mem safe
70	LOCAL_SRC_FILES += \
71		futex_synchro.c
72endif
73
74LOCAL_MODULE:= libutils
75
76LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
77LOCAL_C_INCLUDES += external/zlib
78
79ifeq ($(HOST_OS),windows)
80ifeq ($(strip $(USE_CYGWIN),),)
81# Under MinGW, ctype.h doesn't need multi-byte support
82LOCAL_CFLAGS += -DMB_CUR_MAX=1
83endif
84endif
85
86include $(BUILD_HOST_STATIC_LIBRARY)
87
88
89
90# For the device
91# =====================================================
92include $(CLEAR_VARS)
93
94
95# we have the common sources, plus some device-specific stuff
96LOCAL_SRC_FILES:= \
97	$(commonSources) \
98	Unicode.cpp \
99    BackupData.cpp \
100	BackupHelpers.cpp
101
102ifeq ($(TARGET_SIMULATOR),true)
103LOCAL_SRC_FILES += $(hostSources)
104endif
105
106ifeq ($(TARGET_OS),linux)
107# Use the futex based mutex and condition variable
108# implementation from android-arm because it's shared mem safe
109LOCAL_SRC_FILES += futex_synchro.c
110LOCAL_LDLIBS += -lrt -ldl
111endif
112
113LOCAL_C_INCLUDES += \
114		external/zlib \
115		external/icu4c/common
116LOCAL_LDLIBS += -lpthread
117
118LOCAL_SHARED_LIBRARIES := \
119	libz \
120	liblog \
121	libcutils
122
123ifneq ($(TARGET_SIMULATOR),true)
124ifeq ($(TARGET_OS)-$(TARGET_ARCH),linux-x86)
125# This is needed on x86 to bring in dl_iterate_phdr for CallStack.cpp
126LOCAL_SHARED_LIBRARIES += \
127	libdl
128endif # linux-x86
129endif # sim
130
131LOCAL_MODULE:= libutils
132
133#LOCAL_CFLAGS+=
134#LOCAL_LDFLAGS:=
135
136include $(BUILD_SHARED_LIBRARY)
137
138