1#
2# Copyright (C) 2008 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16LOCAL_PATH := $(my-dir)
17include $(CLEAR_VARS)
18
19ifeq ($(TARGET_CPU_SMP),true)
20    targetSmpFlag := -DANDROID_SMP=1
21else
22    targetSmpFlag := -DANDROID_SMP=0
23endif
24hostSmpFlag := -DANDROID_SMP=0
25
26commonSources := \
27	hashmap.c \
28	atomic.c.arm \
29	native_handle.c \
30	socket_inaddr_any_server.c \
31	socket_local_client.c \
32	socket_local_server.c \
33	socket_loopback_client.c \
34	socket_loopback_server.c \
35	socket_network_client.c \
36	sockets.c \
37	config_utils.c \
38	cpu_info.c \
39	load_file.c \
40	list.c \
41	open_memstream.c \
42	strdup16to8.c \
43	strdup8to16.c \
44	record_stream.c \
45	process_name.c \
46	threads.c \
47	sched_policy.c \
48	iosched_policy.c \
49	str_parms.c \
50
51commonHostSources := \
52        ashmem-host.c
53
54# some files must not be compiled when building against Mingw
55# they correspond to features not used by our host development tools
56# which are also hard or even impossible to port to native Win32
57WINDOWS_HOST_ONLY :=
58ifeq ($(HOST_OS),windows)
59    ifeq ($(strip $(USE_CYGWIN)),)
60        WINDOWS_HOST_ONLY := 1
61    endif
62endif
63# USE_MINGW is defined when we build against Mingw on Linux
64ifneq ($(strip $(USE_MINGW)),)
65    WINDOWS_HOST_ONLY := 1
66endif
67
68ifneq ($(WINDOWS_HOST_ONLY),1)
69    commonSources += \
70        fs.c \
71        multiuser.c
72endif
73
74
75# Static library for host
76# ========================================================
77LOCAL_MODULE := libcutils
78LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
79LOCAL_LDLIBS := -lpthread
80LOCAL_STATIC_LIBRARIES := liblog
81LOCAL_CFLAGS += $(hostSmpFlag)
82include $(BUILD_HOST_STATIC_LIBRARY)
83
84
85# Static library for host, 64-bit
86# ========================================================
87include $(CLEAR_VARS)
88LOCAL_MODULE := lib64cutils
89LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
90LOCAL_LDLIBS := -lpthread
91LOCAL_STATIC_LIBRARIES := lib64log
92LOCAL_CFLAGS += $(hostSmpFlag) -m64
93include $(BUILD_HOST_STATIC_LIBRARY)
94
95
96# Shared and static library for target
97# ========================================================
98
99# This is needed in LOCAL_C_INCLUDES to access the C library's private
100# header named <bionic_time.h>
101#
102libcutils_c_includes := bionic/libc/private
103
104include $(CLEAR_VARS)
105LOCAL_MODULE := libcutils
106LOCAL_SRC_FILES := $(commonSources) \
107        android_reboot.c \
108        ashmem-dev.c \
109        debugger.c \
110        klog.c \
111        partition_utils.c \
112        properties.c \
113        qtaguid.c \
114        trace.c \
115        uevent.c
116
117ifeq ($(TARGET_ARCH),arm)
118LOCAL_SRC_FILES += arch-arm/memset32.S
119else  # !arm
120ifeq ($(TARGET_ARCH_VARIANT),x86-atom)
121LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
122LOCAL_SRC_FILES += arch-x86/android_memset16.S arch-x86/android_memset32.S memory.c
123else # !x86-atom
124ifeq ($(TARGET_ARCH),mips)
125LOCAL_SRC_FILES += arch-mips/android_memset.c
126else # !mips
127LOCAL_SRC_FILES += memory.c
128endif # !mips
129endif # !x86-atom
130endif # !arm
131
132LOCAL_C_INCLUDES := $(libcutils_c_includes) $(KERNEL_HEADERS)
133LOCAL_STATIC_LIBRARIES := liblog
134LOCAL_CFLAGS += $(targetSmpFlag)
135include $(BUILD_STATIC_LIBRARY)
136
137include $(CLEAR_VARS)
138LOCAL_MODULE := libcutils
139# TODO: remove liblog as whole static library, once we don't have prebuilt that requires
140# liblog symbols present in libcutils.
141LOCAL_WHOLE_STATIC_LIBRARIES := libcutils liblog
142LOCAL_SHARED_LIBRARIES := liblog
143LOCAL_CFLAGS += $(targetSmpFlag)
144LOCAL_C_INCLUDES := $(libcutils_c_includes)
145include $(BUILD_SHARED_LIBRARY)
146
147include $(CLEAR_VARS)
148LOCAL_MODULE := tst_str_parms
149LOCAL_CFLAGS += -DTEST_STR_PARMS
150LOCAL_SRC_FILES := str_parms.c hashmap.c memory.c
151LOCAL_SHARED_LIBRARIES := liblog
152LOCAL_MODULE_TAGS := optional
153include $(BUILD_EXECUTABLE)
154
155include $(call all-makefiles-under,$(LOCAL_PATH))
156