1// Copyright (C) 2008 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15cc_library_headers {
16    name: "libutils_headers",
17    vendor_available: true,
18    host_supported: true,
19
20    header_libs: ["libsystem_headers",],
21    export_header_lib_headers: ["libsystem_headers",],
22    export_include_dirs: ["include"],
23
24    target: {
25        android: {
26            header_libs: ["libbacktrace_headers"],
27            export_header_lib_headers: ["libbacktrace_headers"],
28        },
29        linux_bionic: {
30            enabled: true,
31        },
32        windows: {
33            enabled: true,
34        },
35    },
36}
37
38cc_library {
39    name: "libutils",
40    vendor_available: true,
41    host_supported: true,
42
43    srcs: [
44        "CallStack.cpp",
45        "FileMap.cpp",
46        "JenkinsHash.cpp",
47        "Log.cpp",
48        "NativeHandle.cpp",
49        "Printer.cpp",
50        "PropertyMap.cpp",
51        "RefBase.cpp",
52        "SharedBuffer.cpp",
53        "Static.cpp",
54        "StopWatch.cpp",
55        "String8.cpp",
56        "String16.cpp",
57        "StrongPointer.cpp",
58        "SystemClock.cpp",
59        "Threads.cpp",
60        "Timers.cpp",
61        "Tokenizer.cpp",
62        "Unicode.cpp",
63        "VectorImpl.cpp",
64        "misc.cpp",
65    ],
66
67    cflags: ["-Werror"],
68    include_dirs: ["external/safe-iop/include"],
69    header_libs: [
70        "libutils_headers",
71    ],
72    export_header_lib_headers: [
73        "libutils_headers",
74    ],
75
76    arch: {
77        mips: {
78            cflags: ["-DALIGN_DOUBLE"],
79        },
80    },
81
82    target: {
83        android: {
84            srcs: [
85                "Looper.cpp",
86                "ProcessCallStack.cpp",
87                "Trace.cpp",
88            ],
89
90            cflags: ["-fvisibility=protected"],
91
92            shared_libs: [
93                "libbacktrace",
94                "libcutils",
95                "libdl",
96                "liblog",
97                "libvndksupport",
98            ],
99
100            sanitize: {
101                misc_undefined: ["integer"],
102            },
103        },
104
105        host: {
106            cflags: ["-DLIBUTILS_NATIVE=1"],
107
108            shared: {
109                enabled: false,
110            },
111        },
112
113        linux: {
114            srcs: [
115                "Looper.cpp",
116                "ProcessCallStack.cpp",
117            ],
118        },
119        linux_bionic: {
120            enabled: true,
121            srcs: [
122                "Looper.cpp",
123                "ProcessCallStack.cpp",
124            ],
125        },
126
127        darwin: {
128            cflags: ["-Wno-unused-parameter"],
129        },
130
131        // Under MinGW, ctype.h doesn't need multi-byte support
132        windows: {
133            cflags: ["-DMB_CUR_MAX=1"],
134
135            enabled: true,
136        },
137    },
138
139    clang: true,
140}
141
142// Include subdirectory makefiles
143// ============================================================
144
145cc_test {
146    name: "SharedBufferTest",
147    host_supported: true,
148    static_libs: ["libutils"],
149    shared_libs: ["liblog"],
150    srcs: ["SharedBufferTest.cpp"],
151}
152
153subdirs = ["tests"]
154