blob: 319002f925edd6f540171fe58f26e05ba7046e5f [file] [log] [blame]
# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//common-mk/pkg_config.gni")
import("//secagentd/tools/bpf_gen.gni")
group("all") {
deps = [ ":secagentd" ]
if (use.test) {
deps += [ ":secagentd_testrunner" ]
}
}
generate_vmlinux("vmlinux_h") {
vmlinux_out_dir = "include/secagentd/vmlinux"
btf_out_dir = "btf"
}
global_use_defines = []
if (use.secagentd_min_core_btf) {
global_use_defines += [ "USE_MIN_CORE_BTF=1" ]
}
generate_ebpf_skeletons("bpf_process") {
sources = [ "bpf/process_bpf.c" ]
bpf_skeleton_out_dir = "include/secagentd/bpf_skeletons"
if (use.secagentd_min_core_btf) {
# Need to match the path in ebuild src_install().
btf_inout_dir = "btf"
} else {
btf_inout_dir = ""
}
defines = global_use_defines
deps = [ ":vmlinux_h" ]
}
pkg_config("target_defaults") {
# NOSORT
pkg_deps = [
"absl",
"libbpf",
"libbrillo",
"libchrome",
]
defines = global_use_defines
}
static_library("libsecagent") {
sources = [
"bpf_utils.cc",
"daemon.cc",
"factories.cc",
"process_bpf_skeleton.cc",
"process_plugin.cc",
]
configs += [ ":target_defaults" ]
deps = [ ":bpf_process" ]
}
executable("secagentd") {
sources = [ "main.cc" ]
configs += [ ":target_defaults" ]
deps = [ ":libsecagent" ]
}
if (use.test) {
pkg_config("secagentd_testrunner_config") {
pkg_deps = [ "libchrome-test" ]
}
executable("secagentd_testrunner") {
sources = []
configs += [
"//common-mk:test",
":secagentd_testrunner_config",
":target_defaults",
]
run_test = true
deps = [
":libsecagent",
"//common-mk/testrunner",
]
}
}