blob: 4f66cdf7080d4f9e7f871e94d8196aa1ca6e05a8 [file] [log] [blame]
Chenbo Feng75b410b2018-10-10 15:01:19 -07001//
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
Bob Badourdcbf8ca2021-02-03 22:55:55 -080017package {
Maciej Żenczykowski5c412c62024-03-10 15:47:22 -070018 default_team: "trendy_team_fwk_core_networking",
Bob Badourdcbf8ca2021-02-03 22:55:55 -080019 // http://go/android-license-faq
20 // A large-scale-change added 'default_applicable_licenses' to import
21 // the below license kinds from "system_bpf_license":
22 // SPDX-license-identifier-Apache-2.0
23 default_applicable_licenses: ["system_bpf_license"],
24}
25
Maciej Żenczykowski5c412c62024-03-10 15:47:22 -070026cc_library {
27 name: "libbpf_android",
28 vendor_available: false,
29 host_supported: false,
30 target: {
31 android: {
32 srcs: [
33 "Loader.cpp",
34 ],
35 sanitize: {
36 misc_undefined: ["integer"],
37 },
38 },
39 },
40
41 shared_libs: [
42 "libbase",
43 "libutils",
44 "liblog",
45 ],
46 header_libs: [
47 "bpf_headers",
48 ],
49 export_header_lib_headers: [
50 "bpf_headers",
51 ],
52 export_include_dirs: ["include"],
53
54 defaults: ["bpf_defaults"],
55 cflags: [
56 "-Werror",
57 "-Wall",
58 "-Wextra",
59 ],
60}
61
Neill Kaprone3fc91e2024-08-07 19:14:47 +000062rust_bindgen {
63 name: "libbpf_android_bindgen",
64 crate_name: "bpf_android_bindgen",
65 wrapper_src: "include/libbpf_android.h",
66 source_stem: "bindings",
67 bindgen_flags: [
68 "--verbose",
69 ],
70 cflags: [
71 "-Werror",
72 "-Wall",
73 "-Wextra",
74 "-Wno-pragma-once-outside-header",
75 ],
76 shared_libs: [
77 "libbase",
78 "libutils",
79 "liblog",
80 "libbpf_android",
81 ],
82}
83
Maciej Żenczykowski5c412c62024-03-10 15:47:22 -070084cc_test {
85 name: "libbpf_load_test",
86 test_suites: ["general-tests"],
87 header_libs: ["bpf_headers"],
88 srcs: [
89 "BpfLoadTest.cpp",
90 ],
91 defaults: ["bpf_defaults"],
92 cflags: [
93 "-Wall",
94 "-Werror",
95 "-Wno-error=unused-variable",
96 ],
Maciej Żenczykowskicc922aa2024-03-10 15:18:20 -070097 static_libs: [
Maciej Żenczykowski5c412c62024-03-10 15:47:22 -070098 "libbpf_android",
Maciej Żenczykowskicc922aa2024-03-10 15:18:20 -070099 "libgmock",
100 ],
101 shared_libs: [
Maciej Żenczykowski5c412c62024-03-10 15:47:22 -0700102 "libbpf_bcc",
103 "libbase",
104 "liblog",
105 "libutils",
106 ],
107
108 data: [
109 ":bpfLoadTpProg.o",
110 ],
111 require_root: true,
112}
113
Neill Kaprondd93f852024-08-07 22:39:57 +0000114rust_binary {
Chenbo Feng75b410b2018-10-10 15:01:19 -0700115 name: "bpfloader",
Neill Kapron01249cb2024-08-22 19:09:18 +0000116 cfgs: select(release_flag("RELEASE_BPF_ENABLE_LIBBPF"), {
117 true: ["enable_libbpf"],
118 default: [],
119 }),
Chenbo Feng75b410b2018-10-10 15:01:19 -0700120 srcs: [
Neill Kaprondd93f852024-08-07 22:39:57 +0000121 "bpfloader.rs",
Chenbo Feng75b410b2018-10-10 15:01:19 -0700122 ],
Neill Kaprondd93f852024-08-07 22:39:57 +0000123 rustlibs: [
124 "libbpf_android_bindgen",
125 ],
Chenbo Feng75b410b2018-10-10 15:01:19 -0700126 required: [
Maciej Żenczykowskic76a0dc2023-10-09 16:19:13 -0700127 "timeInState.o",
Chenbo Feng75b410b2018-10-10 15:01:19 -0700128 ],
129
Ryan Zuklie65748202022-12-07 18:22:21 -0800130 product_variables: {
131 debuggable: {
132 required: [
133 "bpfRingbufProg.o",
134 ],
135 },
Maciej Żenczykowskib9712d12024-03-10 17:18:46 -0700136 },
Chenbo Feng75b410b2018-10-10 15:01:19 -0700137}