blob: d2b7f05ad9954abbb3297c4a73db19430f2da084 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("$zx/public/gn/host_tool_action.gni")
# Generate syscall bindings/information from `syscalls.banjo`.
#
# Parameters
#
# gen
# Required: List of scopes describing `abigen` output files.
# Type: scope as follows
# outputs
# Required: As for action().
# Type: list(file)
# args
# Required: Output-related arguments to `abigen`.
# This should contain switches and the $root_build_dir-relative
# form of the files named in $outputs.
# Type: list(string)
#
# TODO(ZX-3882): This is temporarily a two-step process. First, run banjo to
# generate a .abigen file (done by
# $zx/kernel/syscalls:generate_syscalls.abigen), then run the existing abigen
# tool on the generated file. This is an intermediate situation until banjo
# directly generates all outputs.
template("abigen") {
host_tool_action(target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
tool = "$zx/system/host/abigen"
deps = [
"$zx/kernel/syscalls:generate_syscalls.abigen",
]
outputs = []
args = []
foreach(gen, invoker.gen) {
outputs += gen.outputs
args += gen.args + rebase_path(gen.outputs, root_build_dir)
}
sources = [
"$root_gen_dir/syscalls.abigen",
]
args += rebase_path(sources, root_build_dir)
metadata = {
generated_sources = rebase_path(outputs, root_build_dir)
}
}
}