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
19commonSources := \
20	hashmap.c \
21	atomic.c.arm \
22	native_handle.c \
23	config_utils.c \
24	load_file.c \
25	strlcpy.c \
26	open_memstream.c \
27	strdup16to8.c \
28	strdup8to16.c \
29	record_stream.c \
30	process_name.c \
31	threads.c \
32	sched_policy.c \
33	iosched_policy.c \
34	str_parms.c \
35	fs_config.c
36
37# some files must not be compiled when building against Mingw
38# they correspond to features not used by our host development tools
39# which are also hard or even impossible to port to native Win32
40WINDOWS_HOST_ONLY :=
41ifeq ($(HOST_OS),windows)
42    ifeq ($(strip $(USE_CYGWIN)),)
43        WINDOWS_HOST_ONLY := 1
44    endif
45endif
46# USE_MINGW is defined when we build against Mingw on Linux
47ifneq ($(strip $(USE_MINGW)),)
48    WINDOWS_HOST_ONLY := 1
49endif
50
51ifneq ($(WINDOWS_HOST_ONLY),1)
52    commonSources += \
53        fs.c \
54        multiuser.c \
55        socket_inaddr_any_server.c \
56        socket_local_client.c \
57        socket_local_server.c \
58        socket_loopback_client.c \
59        socket_loopback_server.c \
60        socket_network_client.c \
61        sockets.c \
62
63    commonHostSources += \
64        ashmem-host.c \
65        trace-host.c
66
67endif
68
69
70# Shared and static library for host
71# ========================================================
72LOCAL_MODULE := libcutils
73LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
74LOCAL_STATIC_LIBRARIES := liblog
75ifneq ($(HOST_OS),windows)
76LOCAL_CFLAGS += -Werror
77endif
78LOCAL_MULTILIB := both
79include $(BUILD_HOST_STATIC_LIBRARY)
80
81include $(CLEAR_VARS)
82LOCAL_MODULE := libcutils
83LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
84LOCAL_SHARED_LIBRARIES := liblog
85ifneq ($(HOST_OS),windows)
86LOCAL_CFLAGS += -Werror
87endif
88LOCAL_MULTILIB := both
89include $(BUILD_HOST_SHARED_LIBRARY)
90
91
92
93# Shared and static library for target
94# ========================================================
95
96include $(CLEAR_VARS)
97LOCAL_MODULE := libcutils
98LOCAL_SRC_FILES := $(commonSources) \
99        android_reboot.c \
100        ashmem-dev.c \
101        debugger.c \
102        klog.c \
103        partition_utils.c \
104        properties.c \
105        qtaguid.c \
106        trace-dev.c \
107        uevent.c \
108
109# arch-arm/memset32.S does not compile with Clang.
110LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
111
112LOCAL_SRC_FILES_arm += arch-arm/memset32.S
113LOCAL_SRC_FILES_arm64 += arch-arm64/android_memset.S
114
115LOCAL_SRC_FILES_mips += arch-mips/android_memset.c
116LOCAL_SRC_FILES_mips64 += arch-mips/android_memset.c
117
118LOCAL_SRC_FILES_x86 += \
119        arch-x86/android_memset16.S \
120        arch-x86/android_memset32.S \
121
122LOCAL_SRC_FILES_x86_64 += \
123        arch-x86_64/android_memset16.S \
124        arch-x86_64/android_memset32.S \
125
126LOCAL_C_INCLUDES := $(libcutils_c_includes)
127LOCAL_STATIC_LIBRARIES := liblog
128ifneq ($(ENABLE_CPUSETS),)
129LOCAL_CFLAGS += -DUSE_CPUSETS
130endif
131LOCAL_CFLAGS += -Werror -std=gnu90
132include $(BUILD_STATIC_LIBRARY)
133
134include $(CLEAR_VARS)
135LOCAL_MODULE := libcutils
136# TODO: remove liblog as whole static library, once we don't have prebuilt that requires
137# liblog symbols present in libcutils.
138LOCAL_WHOLE_STATIC_LIBRARIES := libcutils liblog
139LOCAL_SHARED_LIBRARIES := liblog
140ifneq ($(ENABLE_CPUSETS),)
141LOCAL_CFLAGS += -DUSE_CPUSETS
142endif
143LOCAL_CFLAGS += -Werror
144LOCAL_C_INCLUDES := $(libcutils_c_includes)
145include $(BUILD_SHARED_LIBRARY)
146
147include $(call all-makefiles-under,$(LOCAL_PATH))
148