blob: 42e1c7e6890c1524b3bcd7dc44a7ae2a67b69f92 [file] [log] [blame]
The Android Open Source Projectcbb10112009-03-03 19:31:44 -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
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:= \
Jeff Browne735f232011-11-14 18:29:15 -080021 BasicHashtable.cpp \
Jamie Gennis1a209932011-04-28 16:19:45 -070022 BlobCache.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080023 CallStack.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080024 FileMap.cpp \
Mathias Agopiana580e682010-02-11 17:30:52 -080025 Flattenable.cpp \
Raph Levienb6ea1752012-10-25 23:11:13 -070026 JenkinsHash.cpp \
Chris Craik551fcf42012-12-05 10:36:45 -080027 LinearAllocator.cpp \
Jason Simmonsb86c8e42011-06-28 17:43:30 -070028 LinearTransform.cpp \
Jeff Brown6454f462012-08-10 20:44:39 -070029 Log.cpp \
Jeff Brown04cbbc12010-11-29 17:37:49 -080030 PropertyMap.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080031 RefBase.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080032 SharedBuffer.cpp \
33 Static.cpp \
34 StopWatch.cpp \
35 String8.cpp \
36 String16.cpp \
37 SystemClock.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080038 Threads.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080039 Timers.cpp \
Jeff Brown647925d2010-11-10 16:03:06 -080040 Tokenizer.cpp \
Kenny Rootba0165b2010-11-09 14:37:23 -080041 Unicode.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080042 VectorImpl.cpp \
Mathias Agopian14d978d2009-06-05 15:11:23 -070043 misc.cpp
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080044
Andrew Hsieha19d2c72012-03-13 00:55:34 -070045host_commonCflags := -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080046
47ifeq ($(HOST_OS),windows)
48ifeq ($(strip $(USE_CYGWIN),),)
49# Under MinGW, ctype.h doesn't need multi-byte support
Andrew Hsieha19d2c72012-03-13 00:55:34 -070050host_commonCflags += -DMB_CUR_MAX=1
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080051endif
52endif
53
Andrew Hsieha19d2c72012-03-13 00:55:34 -070054host_commonLdlibs :=
55
Iliyan Malchev26ad3452011-10-19 22:35:56 -070056ifeq ($(TARGET_OS),linux)
Andrew Hsieha19d2c72012-03-13 00:55:34 -070057host_commonLdlibs += -lrt -ldl
Iliyan Malchev26ad3452011-10-19 22:35:56 -070058endif
59
Andrew Hsieha19d2c72012-03-13 00:55:34 -070060
61# For the host
62# =====================================================
63include $(CLEAR_VARS)
64LOCAL_SRC_FILES:= $(commonSources)
Keun young Park4e371ce2012-03-26 14:44:24 -070065ifeq ($(HOST_OS), linux)
66LOCAL_SRC_FILES += Looper.cpp
67endif
Andrew Hsieha19d2c72012-03-13 00:55:34 -070068LOCAL_MODULE:= libutils
69LOCAL_CFLAGS += $(host_commonCflags)
70LOCAL_LDLIBS += $(host_commonLdlibs)
71include $(BUILD_HOST_STATIC_LIBRARY)
72
73
74# For the host, 64-bit
75# =====================================================
76include $(CLEAR_VARS)
77LOCAL_SRC_FILES:= $(commonSources)
Keun young Park4e371ce2012-03-26 14:44:24 -070078ifeq ($(HOST_OS), linux)
79LOCAL_SRC_FILES += Looper.cpp
80endif
Andrew Hsieha19d2c72012-03-13 00:55:34 -070081LOCAL_MODULE:= lib64utils
82LOCAL_CFLAGS += $(host_commonCflags) -m64
83LOCAL_LDLIBS += $(host_commonLdlibs)
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080084include $(BUILD_HOST_STATIC_LIBRARY)
85
86
Bjorn Bringert00c14b42013-03-22 14:26:33 +000087# For the device, static
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080088# =====================================================
89include $(CLEAR_VARS)
90
91
92# we have the common sources, plus some device-specific stuff
93LOCAL_SRC_FILES:= \
94 $(commonSources) \
Jamie Gennis2ccfe1a2012-02-23 11:28:28 -080095 Looper.cpp \
96 Trace.cpp
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080097
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080098ifeq ($(TARGET_OS),linux)
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080099LOCAL_LDLIBS += -lrt -ldl
100endif
101
Chris Craik551fcf42012-12-05 10:36:45 -0800102ifeq ($(TARGET_ARCH),mips)
103LOCAL_CFLAGS += -DALIGN_DOUBLE
104endif
105
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800106LOCAL_C_INCLUDES += \
Colin Cross3abdea92012-03-22 18:46:44 -0700107 bionic/libc/private \
108 external/zlib
Mathias Agopian15554362009-07-12 23:11:20 -0700109
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800110LOCAL_LDLIBS += -lpthread
111
Bjorn Bringert00c14b42013-03-22 14:26:33 +0000112LOCAL_STATIC_LIBRARIES := \
Mathias Agopian9eb2a3b2013-05-06 20:20:50 -0700113 libcutils
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800114
Bjorn Bringert00c14b42013-03-22 14:26:33 +0000115LOCAL_SHARED_LIBRARIES := \
116 libcorkscrew \
117 liblog \
118 libdl
119
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800120LOCAL_MODULE:= libutils
Bjorn Bringert00c14b42013-03-22 14:26:33 +0000121include $(BUILD_STATIC_LIBRARY)
122
123# For the device, shared
124# =====================================================
125include $(CLEAR_VARS)
126LOCAL_MODULE:= libutils
127LOCAL_WHOLE_STATIC_LIBRARIES := libutils
128LOCAL_SHARED_LIBRARIES := \
129 liblog \
130 libcutils \
131 libdl \
Mathias Agopian9eb2a3b2013-05-06 20:20:50 -0700132 libcorkscrew
133
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800134include $(BUILD_SHARED_LIBRARY)
135
Jeff Brown7aba2312010-06-30 16:10:35 -0700136# Include subdirectory makefiles
137# ============================================================
138
139# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
140# team really wants is to build the stuff defined by this makefile.
141ifeq (,$(ONE_SHOT_MAKEFILE))
142include $(call first-makefiles-under,$(LOCAL_PATH))
Christopher Tatec28f2142010-07-26 11:24:18 -0700143endif