• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    "fs.cpp",
22    "hashmap.cpp",
23    "multiuser.cpp",
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",
28    "sockets_unix.cpp",
29    "str_parms.cpp",
30]
31
32cc_library_headers {
33    name: "libcutils_headers",
34    vendor_available: true,
35    recovery_available: true,
36    host_supported: true,
37    export_include_dirs: ["include"],
38    target: {
39        vendor: {
40            override_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    vndk: {
55        enabled: true,
56        support_system_process: true,
57    },
58    recovery_available: true,
59    host_supported: true,
60    srcs: [
61        "config_utils.cpp",
62        "canned_fs_config.cpp",
63        "iosched_policy.cpp",
64        "load_file.cpp",
65        "native_handle.cpp",
66        "record_stream.cpp",
67        "sockets.cpp",
68        "strdup16to8.cpp",
69        "strdup8to16.cpp",
70        "strlcpy.c",
71        "threads.cpp",
72    ],
73
74    target: {
75        linux_bionic: {
76            enabled: true,
77        },
78        not_windows: {
79            srcs: libcutils_nonwindows_sources + [
80                "ashmem-host.cpp",
81                "fs_config.cpp",
82                "trace-host.cpp",
83            ],
84        },
85        windows: {
86            host_ldlibs: ["-lws2_32"],
87
88            srcs: [
89                "socket_inaddr_any_server_windows.cpp",
90                "socket_network_client_windows.cpp",
91                "sockets_windows.cpp",
92                "trace-host.cpp",
93            ],
94
95            enabled: true,
96            cflags: [
97                "-D_GNU_SOURCE",
98            ],
99        },
100
101        android: {
102            srcs: libcutils_nonwindows_sources + [
103                "android_get_control_file.cpp",
104                "android_reboot.cpp",
105                "ashmem-dev.cpp",
106                "fs_config.cpp",
107                "klog.cpp",
108                "partition_utils.cpp",
109                "properties.cpp",
110                "qtaguid.cpp",
111                "trace-dev.cpp",
112                "uevent.cpp",
113            ],
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"],
124            sanitize: {
125                misc_undefined: ["integer"],
126            },
127        },
128
129        android_mips: {
130            srcs: ["arch-mips/android_memset.c"],
131            sanitize: {
132                misc_undefined: ["integer"],
133            },
134        },
135        android_mips64: {
136            srcs: ["arch-mips/android_memset.c"],
137            sanitize: {
138                misc_undefined: ["integer"],
139            },
140        },
141
142        android_x86: {
143            srcs: [
144                "arch-x86/android_memset16.S",
145                "arch-x86/android_memset32.S",
146            ],
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            },
153        },
154
155        android_x86_64: {
156            srcs: [
157                "arch-x86_64/android_memset16.S",
158                "arch-x86_64/android_memset32.S",
159            ],
160            sanitize: {
161                misc_undefined: ["integer"],
162            },
163        },
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        }
173    },
174
175    shared_libs: [
176        "liblog",
177        "libbase",
178    ],
179    header_libs: [
180        "libbase_headers",
181        "libcutils_headers",
182        "libutils_headers",
183        "libprocessgroup_headers",
184    ],
185    export_header_lib_headers: [
186        "libcutils_headers",
187        "libprocessgroup_headers",
188    ],
189    local_include_dirs: ["include"],
190
191    cflags: [
192        "-Werror",
193        "-Wall",
194        "-Wextra",
195    ],
196}
197
198cc_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",
238    "libcgrouprc",
239]
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,
247}
248
249cc_test {
250    name: "libcutils_test_static",
251    test_suites: ["device-tests"],
252    defaults: ["libcutils_test_default"],
253    static_libs: [
254        "libc",
255        "libcgrouprc_format",
256    ] + test_libraries,
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}
270