Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 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 |
| 20 | libcutils_nonwindows_sources = [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 21 | "fs.cpp", |
Elliott Hughes | 9d12725 | 2018-07-13 10:54:49 -0700 | [diff] [blame] | 22 | "hashmap.cpp", |
Jeff Sharkey | 53d37ba | 2017-11-09 17:41:09 -0700 | [diff] [blame] | 23 | "multiuser.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 24 | "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 Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 28 | "sockets_unix.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 29 | "str_parms.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 30 | ] |
| 31 | |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 32 | cc_library_headers { |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 33 | name: "libcutils_headers", |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 34 | vendor_available: true, |
Jiyong Park | 612210c | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 35 | recovery_available: true, |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 36 | host_supported: true, |
| 37 | export_include_dirs: ["include"], |
| 38 | target: { |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 39 | vendor: { |
Steven Moreland | e1c834d | 2018-01-05 14:42:12 -0800 | [diff] [blame] | 40 | override_export_include_dirs: ["include_vndk"], |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 41 | }, |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 42 | linux_bionic: { |
| 43 | enabled: true, |
| 44 | }, |
| 45 | windows: { |
| 46 | enabled: true, |
| 47 | }, |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 48 | }, |
| 49 | } |
| 50 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 51 | cc_library { |
| 52 | name: "libcutils", |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 53 | vendor_available: true, |
Justin Yun | 9ca9245 | 2017-07-31 15:41:10 +0900 | [diff] [blame] | 54 | vndk: { |
| 55 | enabled: true, |
| 56 | support_system_process: true, |
| 57 | }, |
Jiyong Park | 612210c | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 58 | recovery_available: true, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 59 | host_supported: true, |
| 60 | srcs: [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 61 | "config_utils.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 62 | "canned_fs_config.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 63 | "iosched_policy.cpp", |
| 64 | "load_file.cpp", |
| 65 | "native_handle.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 66 | "record_stream.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 67 | "sockets.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 68 | "strdup16to8.cpp", |
| 69 | "strdup8to16.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 70 | "strlcpy.c", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 71 | "threads.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 72 | ], |
| 73 | |
| 74 | target: { |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 75 | linux_bionic: { |
| 76 | enabled: true, |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 77 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 78 | not_windows: { |
| 79 | srcs: libcutils_nonwindows_sources + [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 80 | "ashmem-host.cpp", |
Jiyong Park | a2159c4 | 2019-02-03 00:34:29 +0900 | [diff] [blame] | 81 | "fs_config.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 82 | "trace-host.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 83 | ], |
| 84 | }, |
| 85 | windows: { |
Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame] | 86 | host_ldlibs: ["-lws2_32"], |
| 87 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 88 | srcs: [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 89 | "socket_inaddr_any_server_windows.cpp", |
| 90 | "socket_network_client_windows.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 91 | "sockets_windows.cpp", |
David Sehr | eb2dd20 | 2018-12-20 12:59:36 -0800 | [diff] [blame] | 92 | "trace-host.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 93 | ], |
| 94 | |
| 95 | enabled: true, |
Mark Salyzyn | 163ecc6 | 2017-05-02 08:56:15 -0700 | [diff] [blame] | 96 | cflags: [ |
| 97 | "-D_GNU_SOURCE", |
| 98 | ], |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 99 | }, |
| 100 | |
| 101 | android: { |
| 102 | srcs: libcutils_nonwindows_sources + [ |
Elliott Hughes | 7acb0d3 | 2019-03-21 14:42:55 -0700 | [diff] [blame] | 103 | "android_get_control_file.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 104 | "android_reboot.cpp", |
| 105 | "ashmem-dev.cpp", |
Jiyong Park | a2159c4 | 2019-02-03 00:34:29 +0900 | [diff] [blame] | 106 | "fs_config.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 107 | "klog.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 108 | "partition_utils.cpp", |
Elliott Hughes | 4eacd70 | 2017-01-26 17:31:40 -0800 | [diff] [blame] | 109 | "properties.cpp", |
Chenbo Feng | baede73 | 2017-10-25 12:31:43 -0700 | [diff] [blame] | 110 | "qtaguid.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 111 | "trace-dev.cpp", |
Luis Hector Chavez | e97a4b9 | 2017-11-02 14:17:43 -0700 | [diff] [blame] | 112 | "uevent.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 113 | ], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 114 | }, |
| 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 Stepanov | 54c7886 | 2017-01-31 16:33:53 -0800 | [diff] [blame] | 124 | sanitize: { |
| 125 | misc_undefined: ["integer"], |
| 126 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 127 | }, |
| 128 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 129 | android_mips: { |
| 130 | srcs: ["arch-mips/android_memset.c"], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 131 | sanitize: { |
| 132 | misc_undefined: ["integer"], |
| 133 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 134 | }, |
| 135 | android_mips64: { |
| 136 | srcs: ["arch-mips/android_memset.c"], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 137 | sanitize: { |
| 138 | misc_undefined: ["integer"], |
| 139 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 140 | }, |
| 141 | |
| 142 | android_x86: { |
| 143 | srcs: [ |
| 144 | "arch-x86/android_memset16.S", |
| 145 | "arch-x86/android_memset32.S", |
| 146 | ], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 147 | // 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 Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 153 | }, |
| 154 | |
| 155 | android_x86_64: { |
| 156 | srcs: [ |
| 157 | "arch-x86_64/android_memset16.S", |
| 158 | "arch-x86_64/android_memset32.S", |
| 159 | ], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 160 | sanitize: { |
| 161 | misc_undefined: ["integer"], |
| 162 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 163 | }, |
Logan Chien | 25b742c | 2018-05-08 17:37:29 +0800 | [diff] [blame] | 164 | |
| 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 Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 173 | }, |
| 174 | |
Joel Fernandes | 5194404 | 2018-12-18 13:32:31 -0800 | [diff] [blame] | 175 | shared_libs: [ |
| 176 | "liblog", |
| 177 | "libbase", |
| 178 | ], |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 179 | header_libs: [ |
Elliott Hughes | 9f49508 | 2018-04-25 14:52:50 -0700 | [diff] [blame] | 180 | "libbase_headers", |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 181 | "libcutils_headers", |
| 182 | "libutils_headers", |
Suren Baghdasaryan | 1bd127b | 2019-01-25 05:30:52 +0000 | [diff] [blame] | 183 | "libprocessgroup_headers", |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 184 | ], |
Suren Baghdasaryan | 1bd127b | 2019-01-25 05:30:52 +0000 | [diff] [blame] | 185 | export_header_lib_headers: [ |
| 186 | "libcutils_headers", |
| 187 | "libprocessgroup_headers", |
| 188 | ], |
Yifan Hong | b680712 | 2017-07-25 15:24:04 -0700 | [diff] [blame] | 189 | local_include_dirs: ["include"], |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 190 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 191 | cflags: [ |
| 192 | "-Werror", |
| 193 | "-Wall", |
| 194 | "-Wextra", |
| 195 | ], |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 196 | } |
| 197 | |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 198 | cc_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 | |
| 232 | test_libraries = [ |
| 233 | "libcutils", |
| 234 | "liblog", |
| 235 | "libbase", |
| 236 | "libjsoncpp", |
| 237 | "libprocessgroup", |
Yifan Hong | 53e0deb | 2019-03-22 17:01:08 -0700 | [diff] [blame^] | 238 | "libcgrouprc", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 239 | ] |
| 240 | |
| 241 | cc_test { |
| 242 | name: "libcutils_test", |
| 243 | test_suites: ["device-tests"], |
| 244 | defaults: ["libcutils_test_default"], |
| 245 | host_supported: true, |
| 246 | shared_libs: test_libraries, |
| 247 | } |
| 248 | |
| 249 | cc_test { |
| 250 | name: "libcutils_test_static", |
| 251 | test_suites: ["device-tests"], |
| 252 | defaults: ["libcutils_test_default"], |
Yifan Hong | 53e0deb | 2019-03-22 17:01:08 -0700 | [diff] [blame^] | 253 | static_libs: [ |
| 254 | "libc", |
| 255 | "libcgrouprc_format", |
| 256 | ] + test_libraries, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 257 | stl: "libc++_static", |
| 258 | |
| 259 | target: { |
| 260 | android: { |
| 261 | static_executable: true, |
| 262 | }, |
| 263 | windows: { |
| 264 | host_ldlibs: ["-lws2_32"], |
| 265 | |
| 266 | enabled: true, |
| 267 | }, |
| 268 | }, |
| 269 | } |