1//
2// Copyright (C) 2018 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
17cc_library_headers {
18    name: "libbpf_android_headers",
19    vendor_available: false,
20    host_supported: false,
21    export_include_dirs: ["include"],
22    target: {
23        linux_bionic: {
24            enabled: true,
25        },
26    },
27}
28
29cc_library {
30    name: "libbpf_android",
31    vendor_available: false,
32    host_supported: false,
33    target: {
34        android: {
35            srcs: [
36                "BpfUtils.cpp",
37                "Loader.cpp",
38            ],
39            sanitize: {
40                misc_undefined: ["integer"],
41            },
42        },
43    },
44
45    shared_libs: [
46        "libbase",
47        "libutils",
48        "libprocessgroup",
49        "liblog",
50        "libbpf",
51    ],
52    header_libs: [
53        "libbpf_android_headers"
54    ],
55    export_header_lib_headers: ["libbpf_android_headers"],
56    export_shared_lib_headers: ["libbpf"],
57    local_include_dirs: ["include"],
58
59    defaults: ["bpf_defaults"],
60    cflags: [
61        "-Werror",
62        "-Wall",
63        "-Wextra",
64    ],
65}
66
67cc_test {
68    name: "libbpf_android_test",
69    srcs: [
70        "BpfMapTest.cpp",
71    ],
72    defaults: ["bpf_defaults"],
73    cflags: [
74        "-Wall",
75        "-Werror",
76        "-Wno-error=unused-variable",
77    ],
78    static_libs: ["libgmock"],
79    shared_libs: [
80        "libbpf_android",
81        "libbase",
82        "liblog",
83        "libutils",
84    ],
85    require_root: true,
86    test_suites: ["general-tests"],
87}
88
89cc_test {
90    name: "libbpf_load_test",
91    srcs: [
92        "BpfLoadTest.cpp",
93    ],
94    defaults: ["bpf_defaults"],
95    cflags: [
96        "-Wall",
97        "-Werror",
98        "-Wno-error=unused-variable",
99    ],
100    static_libs: ["libgmock"],
101    shared_libs: [
102        "libbpf_android",
103        "libbpf",
104        "libbase",
105        "liblog",
106        "libutils",
107    ],
108
109    required: [
110        "bpf_load_tp_prog.o",
111    ],
112    require_root: true,
113}
114