blob: 319a73aba41867c98e39a1684e246de1443bcf20 [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",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080070 "strdup16to8.cpp",
71 "strdup8to16.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070072 "strlcpy.c",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080073 "threads.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070074 ],
75
76 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070077 linux_bionic: {
78 enabled: true,
Dan Willemsene0cd1e02017-03-15 15:23:36 -070079 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -070080 not_windows: {
81 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080082 "ashmem-host.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +090083 "fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080084 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070085 ],
86 },
87 windows: {
Steven Morelande6132be2019-03-25 20:38:56 -070088 host_ldlibs: ["-lws2_32"],
89
Dan Willemseneee8e7f2016-06-06 22:31:58 -070090 srcs: [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080091 "socket_inaddr_any_server_windows.cpp",
92 "socket_network_client_windows.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070093 "sockets_windows.cpp",
David Sehreb2dd202018-12-20 12:59:36 -080094 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070095 ],
96
97 enabled: true,
Mark Salyzyn163ecc62017-05-02 08:56:15 -070098 cflags: [
99 "-D_GNU_SOURCE",
100 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700101 },
102
103 android: {
104 srcs: libcutils_nonwindows_sources + [
Elliott Hughes7acb0d32019-03-21 14:42:55 -0700105 "android_get_control_file.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800106 "android_reboot.cpp",
107 "ashmem-dev.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900108 "fs_config.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700109 "klog.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800110 "partition_utils.cpp",
Elliott Hughes4eacd702017-01-26 17:31:40 -0800111 "properties.cpp",
Chenbo Fengbaede732017-10-25 12:31:43 -0700112 "qtaguid.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800113 "trace-dev.cpp",
Luis Hector Chaveze97a4b92017-11-02 14:17:43 -0700114 "uevent.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700115 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700116 },
117
118 android_arm: {
119 srcs: ["arch-arm/memset32.S"],
120 sanitize: {
121 misc_undefined: ["integer"],
122 },
123 },
124 android_arm64: {
125 srcs: ["arch-arm64/android_memset.S"],
Evgenii Stepanov54c78862017-01-31 16:33:53 -0800126 sanitize: {
127 misc_undefined: ["integer"],
128 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700129 },
130
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700131 android_mips: {
132 srcs: ["arch-mips/android_memset.c"],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700133 sanitize: {
134 misc_undefined: ["integer"],
135 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700136 },
137 android_mips64: {
138 srcs: ["arch-mips/android_memset.c"],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700139 sanitize: {
140 misc_undefined: ["integer"],
141 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700142 },
143
144 android_x86: {
145 srcs: [
146 "arch-x86/android_memset16.S",
147 "arch-x86/android_memset32.S",
148 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700149 // TODO: This is to work around b/29412086.
150 // Remove once __mulodi4 is available and move the "sanitize" block
151 // to the android target.
152 sanitize: {
153 misc_undefined: [],
154 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700155 },
156
157 android_x86_64: {
158 srcs: [
159 "arch-x86_64/android_memset16.S",
160 "arch-x86_64/android_memset32.S",
161 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700162 sanitize: {
163 misc_undefined: ["integer"],
164 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700165 },
Logan Chien25b742c2018-05-08 17:37:29 +0800166
167 vendor: {
168 exclude_srcs: [
169 // qtaguid.cpp loads libnetd_client.so with dlopen(). Since
170 // the interface of libnetd_client.so may vary between AOSP
171 // releases, exclude qtaguid.cpp from the VNDK-SP variant.
172 "qtaguid.cpp",
173 ],
174 }
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700175 },
176
Joel Fernandes51944042018-12-18 13:32:31 -0800177 shared_libs: [
178 "liblog",
179 "libbase",
180 ],
Steven Morelandd73be1b2017-04-13 23:48:57 -0700181 header_libs: [
Elliott Hughes9f495082018-04-25 14:52:50 -0700182 "libbase_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700183 "libcutils_headers",
184 "libutils_headers",
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000185 "libprocessgroup_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700186 ],
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000187 export_header_lib_headers: [
188 "libcutils_headers",
189 "libprocessgroup_headers",
190 ],
Yifan Hongb6807122017-07-25 15:24:04 -0700191 local_include_dirs: ["include"],
Vijay Venkatraman651f8382017-01-25 18:52:17 +0000192
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700193 cflags: [
194 "-Werror",
195 "-Wall",
196 "-Wextra",
197 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700198}
199
Elliott Hughes01705e42019-02-07 12:41:37 -0800200cc_defaults {
201 name: "libcutils_test_default",
202 srcs: ["sockets_test.cpp"],
203
204 target: {
205 android: {
206 srcs: [
207 "android_get_control_file_test.cpp",
208 "android_get_control_socket_test.cpp",
209 "ashmem_test.cpp",
210 "fs_config_test.cpp",
211 "memset_test.cpp",
212 "multiuser_test.cpp",
213 "properties_test.cpp",
214 "sched_policy_test.cpp",
215 "str_parms_test.cpp",
216 "trace-dev_test.cpp",
217 ],
218 },
219
220 not_windows: {
221 srcs: [
222 "str_parms_test.cpp",
223 ],
224 },
225 },
226
227 cflags: [
228 "-Wall",
229 "-Wextra",
230 "-Werror",
231 ],
232}
233
234test_libraries = [
235 "libcutils",
236 "liblog",
237 "libbase",
238 "libjsoncpp",
239 "libprocessgroup",
Yifan Hong53e0deb2019-03-22 17:01:08 -0700240 "libcgrouprc",
Elliott Hughes01705e42019-02-07 12:41:37 -0800241]
242
243cc_test {
244 name: "libcutils_test",
245 test_suites: ["device-tests"],
246 defaults: ["libcutils_test_default"],
247 host_supported: true,
248 shared_libs: test_libraries,
249}
250
251cc_test {
252 name: "libcutils_test_static",
253 test_suites: ["device-tests"],
254 defaults: ["libcutils_test_default"],
Yifan Hong53e0deb2019-03-22 17:01:08 -0700255 static_libs: [
256 "libc",
257 "libcgrouprc_format",
258 ] + test_libraries,
Elliott Hughes01705e42019-02-07 12:41:37 -0800259 stl: "libc++_static",
260
261 target: {
262 android: {
263 static_executable: true,
264 },
265 windows: {
266 host_ldlibs: ["-lws2_32"],
267
268 enabled: true,
269 },
270 },
271}