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	BasicHashtable.cpp \
22	BlobCache.cpp \
23	BufferedTextOutput.cpp \
24	CallStack.cpp \
25	Debug.cpp \
26	FileMap.cpp \
27	Flattenable.cpp \
28	LinearTransform.cpp \
29	Log.cpp \
30	PropertyMap.cpp \
31	RefBase.cpp \
32	SharedBuffer.cpp \
33	Static.cpp \
34	StopWatch.cpp \
35	String8.cpp \
36	String16.cpp \
37	StringArray.cpp \
38	SystemClock.cpp \
39	TextOutput.cpp \
40	Threads.cpp \
41	Timers.cpp \
42	Tokenizer.cpp \
43	Unicode.cpp \
44	VectorImpl.cpp \
45	WorkQueue.cpp \
46	ZipFileCRO.cpp \
47	ZipFileRO.cpp \
48	ZipUtils.cpp \
49	misc.cpp
50
51host_commonCflags := -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
52
53ifeq ($(HOST_OS),windows)
54ifeq ($(strip $(USE_CYGWIN),),)
55# Under MinGW, ctype.h doesn't need multi-byte support
56host_commonCflags += -DMB_CUR_MAX=1
57endif
58endif
59
60host_commonLdlibs :=
61
62ifeq ($(TARGET_OS),linux)
63host_commonLdlibs += -lrt -ldl
64endif
65
66
67# For the host
68# =====================================================
69include $(CLEAR_VARS)
70LOCAL_SRC_FILES:= $(commonSources)
71ifeq ($(HOST_OS), linux)
72LOCAL_SRC_FILES += Looper.cpp
73endif
74LOCAL_MODULE:= libutils
75LOCAL_STATIC_LIBRARIES := libz
76LOCAL_C_INCLUDES := \
77	external/zlib
78LOCAL_CFLAGS += $(host_commonCflags)
79LOCAL_LDLIBS += $(host_commonLdlibs)
80include $(BUILD_HOST_STATIC_LIBRARY)
81
82
83# For the host, 64-bit
84# =====================================================
85include $(CLEAR_VARS)
86LOCAL_SRC_FILES:= $(commonSources)
87ifeq ($(HOST_OS), linux)
88LOCAL_SRC_FILES += Looper.cpp
89endif
90LOCAL_MODULE:= lib64utils
91LOCAL_STATIC_LIBRARIES := libz
92LOCAL_C_INCLUDES := \
93	external/zlib
94LOCAL_CFLAGS += $(host_commonCflags) -m64
95LOCAL_LDLIBS += $(host_commonLdlibs)
96include $(BUILD_HOST_STATIC_LIBRARY)
97
98
99# For the device
100# =====================================================
101include $(CLEAR_VARS)
102
103
104# we have the common sources, plus some device-specific stuff
105LOCAL_SRC_FILES:= \
106	$(commonSources) \
107	Looper.cpp \
108	Trace.cpp
109
110ifeq ($(TARGET_OS),linux)
111LOCAL_LDLIBS += -lrt -ldl
112endif
113
114LOCAL_C_INCLUDES += \
115		bionic/libc/private \
116		external/zlib
117
118LOCAL_LDLIBS += -lpthread
119
120LOCAL_SHARED_LIBRARIES := \
121	liblog \
122	libcutils \
123	libdl \
124	libcorkscrew \
125	libz
126
127LOCAL_MODULE:= libutils
128include $(BUILD_SHARED_LIBRARY)
129
130# Include subdirectory makefiles
131# ============================================================
132
133# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
134# team really wants is to build the stuff defined by this makefile.
135ifeq (,$(ONE_SHOT_MAKEFILE))
136include $(call first-makefiles-under,$(LOCAL_PATH))
137endif
138