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