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//
16
17// some files must not be compiled when building against Mingw
18// they correspond to features not used by our host development tools
19// which are also hard or even impossible to port to native Win32
20libcutils_nonwindows_sources = [
21    "android_get_control_file.cpp",
22    "fs.c",
23    "multiuser.c",
24    "socket_inaddr_any_server_unix.c",
25    "socket_local_client_unix.c",
26    "socket_local_server_unix.c",
27    "socket_loopback_server_unix.c",
28    "socket_network_client_unix.c",
29    "sockets_unix.cpp",
30    "str_parms.c",
31]
32
33cc_library_headers {
34    name: "libcutils_headers",
35    vendor_available: true,
36    host_supported: true,
37    export_include_dirs: ["include"],
38    target: {
39        vendor: {
40            export_include_dirs: ["include_vndk"],
41        },
42        linux_bionic: {
43            enabled: true,
44        },
45        windows: {
46            enabled: true,
47        },
48    },
49}
50
51cc_library {
52    name: "libcutils",
53    vendor_available: true,
54    host_supported: true,
55    srcs: [
56        "config_utils.c",
57        "fs_config.c",
58        "canned_fs_config.c",
59        "hashmap.c",
60        "iosched_policy.c",
61        "load_file.c",
62        "native_handle.c",
63        "open_memstream.c",
64        "record_stream.c",
65        "sched_policy.cpp",
66        "sockets.cpp",
67        "strdup16to8.c",
68        "strdup8to16.c",
69        "strlcpy.c",
70        "threads.c",
71    ],
72
73    target: {
74        host: {
75            srcs: ["dlmalloc_stubs.c"],
76        },
77        linux_bionic: {
78            enabled: true,
79            exclude_srcs: ["dlmalloc_stubs.c"],
80        },
81        not_windows: {
82            srcs: libcutils_nonwindows_sources + [
83                "ashmem-host.c",
84                "trace-host.c",
85            ],
86        },
87        windows: {
88            srcs: [
89                "socket_inaddr_any_server_windows.c",
90                "socket_network_client_windows.c",
91                "sockets_windows.cpp",
92            ],
93
94            enabled: true,
95            shared: {
96                enabled: false,
97            },
98        },
99
100        android: {
101            srcs: libcutils_nonwindows_sources + [
102                "android_reboot.c",
103                "ashmem-dev.c",
104                "klog.cpp",
105                "partition_utils.c",
106                "properties.cpp",
107                "qtaguid.c",
108                "trace-dev.c",
109                "uevent.c",
110            ],
111            sanitize: {
112                misc_undefined: ["integer"],
113            },
114        },
115
116        android_arm: {
117            srcs: ["arch-arm/memset32.S"],
118        },
119        android_arm64: {
120            srcs: ["arch-arm64/android_memset.S"],
121        },
122
123        android_mips: {
124            srcs: ["arch-mips/android_memset.c"],
125        },
126        android_mips64: {
127            srcs: ["arch-mips/android_memset.c"],
128        },
129
130        android_x86: {
131            srcs: [
132                "arch-x86/android_memset16.S",
133                "arch-x86/android_memset32.S",
134            ],
135        },
136
137        android_x86_64: {
138            srcs: [
139                "arch-x86_64/android_memset16.S",
140                "arch-x86_64/android_memset32.S",
141            ],
142        },
143    },
144
145    shared_libs: ["liblog"],
146    header_libs: [
147        "libcutils_headers",
148        "libutils_headers",
149    ],
150    export_header_lib_headers: ["libcutils_headers"],
151
152    cflags: [
153        "-Werror",
154        "-Wall",
155        "-Wextra",
156    ],
157
158    clang: true,
159}
160
161subdirs = ["tests"]
162