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 19libcutils_common_sources := \ 20 atomic.c.arm \ 21 config_utils.c \ 22 fs_config.c \ 23 canned_fs_config.c \ 24 hashmap.c \ 25 iosched_policy.c \ 26 load_file.c \ 27 native_handle.c \ 28 open_memstream.c \ 29 process_name.c \ 30 record_stream.c \ 31 sched_policy.c \ 32 sockets.cpp \ 33 strdup16to8.c \ 34 strdup8to16.c \ 35 strlcpy.c \ 36 threads.c \ 37 38# some files must not be compiled when building against Mingw 39# they correspond to features not used by our host development tools 40# which are also hard or even impossible to port to native Win32 41libcutils_nonwindows_sources := \ 42 fs.c \ 43 multiuser.c \ 44 socket_inaddr_any_server_unix.c \ 45 socket_local_client_unix.c \ 46 socket_local_server_unix.c \ 47 socket_loopback_client_unix.c \ 48 socket_loopback_server_unix.c \ 49 socket_network_client_unix.c \ 50 sockets_unix.cpp \ 51 str_parms.c \ 52 53libcutils_nonwindows_host_sources := \ 54 ashmem-host.c \ 55 trace-host.c \ 56 57libcutils_windows_host_sources := \ 58 socket_inaddr_any_server_windows.c \ 59 socket_network_client_windows.c \ 60 sockets_windows.cpp \ 61 62# Shared and static library for host 63# Note: when linking this library on Windows, you must also link to Winsock2 64# using "LOCAL_LDLIBS_windows := -lws2_32". 65# ======================================================== 66LOCAL_MODULE := libcutils 67LOCAL_SRC_FILES := $(libcutils_common_sources) dlmalloc_stubs.c 68LOCAL_SRC_FILES_darwin := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) 69LOCAL_SRC_FILES_linux := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) 70LOCAL_SRC_FILES_windows := $(libcutils_windows_host_sources) 71LOCAL_STATIC_LIBRARIES := liblog 72LOCAL_CFLAGS := -Werror -Wall -Wextra 73LOCAL_MULTILIB := both 74LOCAL_MODULE_HOST_OS := darwin linux windows 75include $(BUILD_HOST_STATIC_LIBRARY) 76 77include $(CLEAR_VARS) 78LOCAL_MODULE := libcutils 79LOCAL_SRC_FILES := $(libcutils_common_sources) dlmalloc_stubs.c 80LOCAL_SRC_FILES_darwin := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) 81LOCAL_SRC_FILES_linux := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) 82LOCAL_SHARED_LIBRARIES := liblog 83LOCAL_CFLAGS := -Werror -Wall -Wextra 84LOCAL_MULTILIB := both 85include $(BUILD_HOST_SHARED_LIBRARY) 86 87 88 89# Shared and static library for target 90# ======================================================== 91 92include $(CLEAR_VARS) 93LOCAL_MODULE := libcutils 94LOCAL_SRC_FILES := $(libcutils_common_sources) \ 95 $(libcutils_nonwindows_sources) \ 96 android_reboot.c \ 97 ashmem-dev.c \ 98 debugger.c \ 99 klog.c \ 100 partition_utils.c \ 101 properties.c \ 102 qtaguid.c \ 103 trace-dev.c \ 104 uevent.c \ 105 106LOCAL_SRC_FILES_arm += arch-arm/memset32.S 107LOCAL_SRC_FILES_arm64 += arch-arm64/android_memset.S 108 109LOCAL_SRC_FILES_mips += arch-mips/android_memset.c 110LOCAL_SRC_FILES_mips64 += arch-mips/android_memset.c 111 112LOCAL_SRC_FILES_x86 += \ 113 arch-x86/android_memset16.S \ 114 arch-x86/android_memset32.S \ 115 116LOCAL_SRC_FILES_x86_64 += \ 117 arch-x86_64/android_memset16.S \ 118 arch-x86_64/android_memset32.S \ 119 120LOCAL_C_INCLUDES := $(libcutils_c_includes) 121LOCAL_STATIC_LIBRARIES := liblog 122ifneq ($(ENABLE_CPUSETS),) 123LOCAL_CFLAGS += -DUSE_CPUSETS 124endif 125ifneq ($(ENABLE_SCHEDBOOST),) 126LOCAL_CFLAGS += -DUSE_SCHEDBOOST 127endif 128LOCAL_CFLAGS += -Werror -Wall -Wextra -std=gnu90 129LOCAL_CLANG := true 130LOCAL_SANITIZE := integer 131include $(BUILD_STATIC_LIBRARY) 132 133include $(CLEAR_VARS) 134LOCAL_MODULE := libcutils 135# TODO: remove liblog as whole static library, once we don't have prebuilt that requires 136# liblog symbols present in libcutils. 137LOCAL_WHOLE_STATIC_LIBRARIES := libcutils liblog 138LOCAL_SHARED_LIBRARIES := liblog 139ifneq ($(ENABLE_CPUSETS),) 140LOCAL_CFLAGS += -DUSE_CPUSETS 141endif 142ifneq ($(ENABLE_SCHEDBOOST),) 143LOCAL_CFLAGS += -DUSE_SCHEDBOOST 144endif 145LOCAL_CFLAGS += -Werror -Wall -Wextra 146LOCAL_C_INCLUDES := $(libcutils_c_includes) 147LOCAL_CLANG := true 148LOCAL_SANITIZE := integer 149include $(BUILD_SHARED_LIBRARY) 150 151include $(call all-makefiles-under,$(LOCAL_PATH)) 152