blob: 0376c8c3540e3a909f76a76022f5b488d3575265 [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 \
Raph Levienb6ea1752012-10-25 23:11:13 -070025 JenkinsHash.cpp \
Chris Craik551fcf42012-12-05 10:36:45 -080026 LinearAllocator.cpp \
Jason Simmonsb86c8e42011-06-28 17:43:30 -070027 LinearTransform.cpp \
Jeff Brown6454f462012-08-10 20:44:39 -070028 Log.cpp \
Jesse Hall29cc9ce2014-03-03 10:52:14 -080029 NativeHandle.cpp \
Igor Murashkinec79ef22013-10-24 17:09:15 -070030 Printer.cpp \
31 ProcessCallStack.cpp \
Jeff Brown04cbbc12010-11-29 17:37:49 -080032 PropertyMap.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080033 RefBase.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080034 SharedBuffer.cpp \
35 Static.cpp \
36 StopWatch.cpp \
37 String8.cpp \
38 String16.cpp \
39 SystemClock.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080040 Threads.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080041 Timers.cpp \
Jeff Brown647925d2010-11-10 16:03:06 -080042 Tokenizer.cpp \
Kenny Rootba0165b2010-11-09 14:37:23 -080043 Unicode.cpp \
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080044 VectorImpl.cpp \
Mathias Agopian14d978d2009-06-05 15:11:23 -070045 misc.cpp
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080046
Mark Salyzyn5bed8032014-04-30 11:10:46 -070047host_commonCflags := -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -Werror
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080048
49ifeq ($(HOST_OS),windows)
50ifeq ($(strip $(USE_CYGWIN),),)
51# Under MinGW, ctype.h doesn't need multi-byte support
Andrew Hsieha19d2c72012-03-13 00:55:34 -070052host_commonCflags += -DMB_CUR_MAX=1
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080053endif
54endif
55
Andrew Hsieha19d2c72012-03-13 00:55:34 -070056host_commonLdlibs :=
57
Iliyan Malchev26ad3452011-10-19 22:35:56 -070058ifeq ($(TARGET_OS),linux)
Andrew Hsieha19d2c72012-03-13 00:55:34 -070059host_commonLdlibs += -lrt -ldl
Iliyan Malchev26ad3452011-10-19 22:35:56 -070060endif
61
Andrew Hsieha19d2c72012-03-13 00:55:34 -070062
63# For the host
64# =====================================================
65include $(CLEAR_VARS)
66LOCAL_SRC_FILES:= $(commonSources)
Keun young Park4e371ce2012-03-26 14:44:24 -070067ifeq ($(HOST_OS), linux)
68LOCAL_SRC_FILES += Looper.cpp
69endif
Tim Murrayb37009f2014-07-24 17:22:09 -070070ifeq ($(HOST_OS),darwin)
71LOCAL_CFLAGS += -Wno-unused-parameter
72endif
Andrew Hsieha19d2c72012-03-13 00:55:34 -070073LOCAL_MODULE:= libutils
Colin Cross946003a2013-07-23 17:39:35 -070074LOCAL_STATIC_LIBRARIES := liblog
Andrew Hsieha19d2c72012-03-13 00:55:34 -070075LOCAL_CFLAGS += $(host_commonCflags)
Ian Rogers59ec7652014-06-05 14:32:49 -070076LOCAL_MULTILIB := both
Andrew Hsieha19d2c72012-03-13 00:55:34 -070077include $(BUILD_HOST_STATIC_LIBRARY)
78
79
Bjorn Bringert00c14b42013-03-22 14:26:33 +000080# For the device, static
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080081# =====================================================
82include $(CLEAR_VARS)
83
84
85# we have the common sources, plus some device-specific stuff
86LOCAL_SRC_FILES:= \
87 $(commonSources) \
Jamie Gennis2ccfe1a2012-02-23 11:28:28 -080088 Looper.cpp \
89 Trace.cpp
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080090
Chris Craik551fcf42012-12-05 10:36:45 -080091ifeq ($(TARGET_ARCH),mips)
92LOCAL_CFLAGS += -DALIGN_DOUBLE
93endif
Mark Salyzyn5bed8032014-04-30 11:10:46 -070094LOCAL_CFLAGS += -Werror
Chris Craik551fcf42012-12-05 10:36:45 -080095
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080096LOCAL_C_INCLUDES += \
Elliott Hughes7bf5f202014-09-12 10:19:08 -070097 external/zlib
Mathias Agopian15554362009-07-12 23:11:20 -070098
Bjorn Bringert00c14b42013-03-22 14:26:33 +000099LOCAL_STATIC_LIBRARIES := \
Mathias Agopian9eb2a3b2013-05-06 20:20:50 -0700100 libcutils
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800101
Bjorn Bringert00c14b42013-03-22 14:26:33 +0000102LOCAL_SHARED_LIBRARIES := \
Dan Albert7bc49a12014-05-30 19:40:58 +0000103 libbacktrace \
Bjorn Bringert00c14b42013-03-22 14:26:33 +0000104 liblog \
105 libdl
106
Dan Albert7bc49a12014-05-30 19:40:58 +0000107include external/stlport/libstlport.mk
Christopher Ferris9b0e0742013-10-31 16:25:04 -0700108
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800109LOCAL_MODULE:= libutils
Bjorn Bringert00c14b42013-03-22 14:26:33 +0000110include $(BUILD_STATIC_LIBRARY)
111
112# For the device, shared
113# =====================================================
114include $(CLEAR_VARS)
115LOCAL_MODULE:= libutils
116LOCAL_WHOLE_STATIC_LIBRARIES := libutils
117LOCAL_SHARED_LIBRARIES := \
Dan Albert7bc49a12014-05-30 19:40:58 +0000118 libbacktrace \
Bjorn Bringert00c14b42013-03-22 14:26:33 +0000119 libcutils \
120 libdl \
Mark Salyzyn5bed8032014-04-30 11:10:46 -0700121 liblog
122LOCAL_CFLAGS := -Werror
Christopher Ferris9b0e0742013-10-31 16:25:04 -0700123
Dan Albert7bc49a12014-05-30 19:40:58 +0000124include external/stlport/libstlport.mk
Mathias Agopian9eb2a3b2013-05-06 20:20:50 -0700125
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800126include $(BUILD_SHARED_LIBRARY)
127
Jeff Brown7aba2312010-06-30 16:10:35 -0700128# Include subdirectory makefiles
129# ============================================================
130
131# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
132# team really wants is to build the stuff defined by this makefile.
133ifeq (,$(ONE_SHOT_MAKEFILE))
134include $(call first-makefiles-under,$(LOCAL_PATH))
Christopher Tatec28f2142010-07-26 11:24:18 -0700135endif