blob: 0002f1779a4177f65707e04fe0e0f43390a0251d [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")
_kazoo_label = "$zx/kernel/syscalls:generate_syscalls.kazoo($default_toolchain)"
_kazoo_dir = get_label_info(_kazoo_label, "root_gen_dir")
syscall_ir_json = "$_kazoo_dir/syscalls.ir.json"
# Generate syscall bindings/information from `//zircon/syscalls/`.
#
# Parameters
#
# gen
# Required: List of scopes describing `kazoo` output files.
# Type: scope as follows
# outputs
# Required: As for action().
# Type: list(file)
# args
# Required: Output-related arguments to `kazoo`.
# This should contain switches and the $root_build_dir-relative
# form of the files named in $outputs.
# Type: list(string)
#
template("kazoo") {
host_tool_action(target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
tool = "$zx/tools/kazoo"
deps = [
_kazoo_label,
]
sources = [
syscall_ir_json,
]
outputs = []
args = []
foreach(gen, invoker.gen) {
outputs += gen.outputs
args += gen.args + rebase_path(gen.outputs, root_build_dir)
}
args += rebase_path(sources, root_build_dir)
metadata = {
generated_sources = rebase_path(outputs, root_build_dir)
}
}
}