blob: 88e1bdb69e7155e0fc8db97c89a4ffa7f6a3f203 [file] [log] [blame]
Dan Willemseneee8e7f2016-06-06 22:31:58 -07001//
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 = [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080021 "fs.cpp",
Elliott Hughes9d127252018-07-13 10:54:49 -070022 "hashmap.cpp",
Jeff Sharkey53d37ba2017-11-09 17:41:09 -070023 "multiuser.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080024 "socket_inaddr_any_server_unix.cpp",
25 "socket_local_client_unix.cpp",
26 "socket_local_server_unix.cpp",
27 "socket_network_client_unix.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070028 "sockets_unix.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080029 "str_parms.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070030]
31
Vijay Venkatraman651f8382017-01-25 18:52:17 +000032cc_library_headers {
Vijay Venkatraman651f8382017-01-25 18:52:17 +000033 name: "libcutils_headers",
Steven Moreland385fe692017-04-13 14:29:58 -070034 vendor_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090035 recovery_available: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000036 host_supported: true,
dimitry051d5cb2019-05-16 14:17:00 +020037 native_bridge_supported: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000038 export_include_dirs: ["include"],
39 target: {
Steven Moreland385fe692017-04-13 14:29:58 -070040 vendor: {
Steven Morelande1c834d2018-01-05 14:42:12 -080041 override_export_include_dirs: ["include_vndk"],
Steven Moreland385fe692017-04-13 14:29:58 -070042 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070043 linux_bionic: {
44 enabled: true,
45 },
46 windows: {
47 enabled: true,
48 },
Vijay Venkatraman651f8382017-01-25 18:52:17 +000049 },
50}
51
Dan Willemseneee8e7f2016-06-06 22:31:58 -070052cc_library {
53 name: "libcutils",
Steven Moreland385fe692017-04-13 14:29:58 -070054 vendor_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090055 vndk: {
56 enabled: true,
57 support_system_process: true,
58 },
Jiyong Park612210c2018-04-27 21:48:43 +090059 recovery_available: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -070060 host_supported: true,
dimitry051d5cb2019-05-16 14:17:00 +020061 native_bridge_supported: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -070062 srcs: [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080063 "config_utils.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080064 "canned_fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080065 "iosched_policy.cpp",
66 "load_file.cpp",
67 "native_handle.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080068 "record_stream.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070069 "sockets.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070070 "strlcpy.c",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080071 "threads.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070072 ],
73
74 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070075 linux_bionic: {
76 enabled: true,
Dan Willemsene0cd1e02017-03-15 15:23:36 -070077 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -070078 not_windows: {
79 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080080 "ashmem-host.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +090081 "fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080082 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070083 ],
84 },
85 windows: {
Steven Morelande6132be2019-03-25 20:38:56 -070086 host_ldlibs: ["-lws2_32"],
87
Dan Willemseneee8e7f2016-06-06 22:31:58 -070088 srcs: [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080089 "socket_inaddr_any_server_windows.cpp",
90 "socket_network_client_windows.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070091 "sockets_windows.cpp",
David Sehreb2dd202018-12-20 12:59:36 -080092 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070093 ],
94
95 enabled: true,
Mark Salyzyn163ecc62017-05-02 08:56:15 -070096 cflags: [
97 "-D_GNU_SOURCE",
98 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -070099 },
100
101 android: {
102 srcs: libcutils_nonwindows_sources + [
Elliott Hughes7acb0d32019-03-21 14:42:55 -0700103 "android_get_control_file.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800104 "android_reboot.cpp",
105 "ashmem-dev.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900106 "fs_config.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700107 "klog.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800108 "partition_utils.cpp",
Elliott Hughes4eacd702017-01-26 17:31:40 -0800109 "properties.cpp",
Chenbo Fengbaede732017-10-25 12:31:43 -0700110 "qtaguid.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800111 "trace-dev.cpp",
Luis Hector Chaveze97a4b92017-11-02 14:17:43 -0700112 "uevent.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700113 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700114 },
115
116 android_arm: {
117 srcs: ["arch-arm/memset32.S"],
118 sanitize: {
119 misc_undefined: ["integer"],
120 },
121 },
122 android_arm64: {
123 srcs: ["arch-arm64/android_memset.S"],
Evgenii Stepanov54c78862017-01-31 16:33:53 -0800124 sanitize: {
125 misc_undefined: ["integer"],
126 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700127 },
128
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700129 android_mips: {
130 srcs: ["arch-mips/android_memset.c"],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700131 sanitize: {
132 misc_undefined: ["integer"],
133 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700134 },
135 android_mips64: {
136 srcs: ["arch-mips/android_memset.c"],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700137 sanitize: {
138 misc_undefined: ["integer"],
139 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700140 },
141
142 android_x86: {
143 srcs: [
144 "arch-x86/android_memset16.S",
145 "arch-x86/android_memset32.S",
146 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700147 // TODO: This is to work around b/29412086.
148 // Remove once __mulodi4 is available and move the "sanitize" block
149 // to the android target.
150 sanitize: {
151 misc_undefined: [],
152 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700153 },
154
155 android_x86_64: {
156 srcs: [
157 "arch-x86_64/android_memset16.S",
158 "arch-x86_64/android_memset32.S",
159 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700160 sanitize: {
161 misc_undefined: ["integer"],
162 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700163 },
Logan Chien25b742c2018-05-08 17:37:29 +0800164
165 vendor: {
166 exclude_srcs: [
167 // qtaguid.cpp loads libnetd_client.so with dlopen(). Since
168 // the interface of libnetd_client.so may vary between AOSP
169 // releases, exclude qtaguid.cpp from the VNDK-SP variant.
170 "qtaguid.cpp",
171 ],
172 }
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700173 },
174
Joel Fernandes51944042018-12-18 13:32:31 -0800175 shared_libs: [
176 "liblog",
177 "libbase",
178 ],
Steven Morelandd73be1b2017-04-13 23:48:57 -0700179 header_libs: [
Elliott Hughes9f495082018-04-25 14:52:50 -0700180 "libbase_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700181 "libcutils_headers",
182 "libutils_headers",
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000183 "libprocessgroup_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700184 ],
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000185 export_header_lib_headers: [
186 "libcutils_headers",
187 "libprocessgroup_headers",
188 ],
Yifan Hongb6807122017-07-25 15:24:04 -0700189 local_include_dirs: ["include"],
Vijay Venkatraman651f8382017-01-25 18:52:17 +0000190
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700191 cflags: [
192 "-Werror",
193 "-Wall",
194 "-Wextra",
195 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700196}
197
Elliott Hughes01705e42019-02-07 12:41:37 -0800198cc_defaults {
199 name: "libcutils_test_default",
200 srcs: ["sockets_test.cpp"],
201
202 target: {
203 android: {
204 srcs: [
205 "android_get_control_file_test.cpp",
206 "android_get_control_socket_test.cpp",
207 "ashmem_test.cpp",
208 "fs_config_test.cpp",
209 "memset_test.cpp",
210 "multiuser_test.cpp",
211 "properties_test.cpp",
212 "sched_policy_test.cpp",
213 "str_parms_test.cpp",
214 "trace-dev_test.cpp",
215 ],
216 },
217
218 not_windows: {
219 srcs: [
220 "str_parms_test.cpp",
221 ],
222 },
223 },
224
225 cflags: [
226 "-Wall",
227 "-Wextra",
228 "-Werror",
229 ],
230}
231
232test_libraries = [
233 "libcutils",
234 "liblog",
235 "libbase",
236 "libjsoncpp",
237 "libprocessgroup",
Yifan Hong53e0deb2019-03-22 17:01:08 -0700238 "libcgrouprc",
Elliott Hughes01705e42019-02-07 12:41:37 -0800239]
240
241cc_test {
242 name: "libcutils_test",
243 test_suites: ["device-tests"],
244 defaults: ["libcutils_test_default"],
245 host_supported: true,
246 shared_libs: test_libraries,
Tom Cherrye41aded2019-11-07 14:06:21 -0800247 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800248}
249
250cc_test {
251 name: "libcutils_test_static",
252 test_suites: ["device-tests"],
253 defaults: ["libcutils_test_default"],
Yifan Hong53e0deb2019-03-22 17:01:08 -0700254 static_libs: [
255 "libc",
256 "libcgrouprc_format",
257 ] + test_libraries,
Elliott Hughes01705e42019-02-07 12:41:37 -0800258 stl: "libc++_static",
Tom Cherrye41aded2019-11-07 14:06:21 -0800259 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800260
261 target: {
262 android: {
263 static_executable: true,
264 },
265 windows: {
266 host_ldlibs: ["-lws2_32"],
267
268 enabled: true,
269 },
270 },
271}