blob: 246f49d4ef51c097e0b4e7e4277f0e7d3cbe8cb4 [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/config/standard.gni")
import("$zx/public/gn/toolchain/environment_redirect.gni")
# Build the native host tools intended for developer use.
_tools_targets = [ "tools" ]
foreach(host, standard_build_hosts) {
_tools_targets += [ "tools-${host.os}-${host.cpu}" ]
environment_redirect("tools-${host.os}-${host.cpu}.redirect") {
visibility = [ ":*" ]
testonly = true
environment_label = "$zx/public/gn/toolchain:host"
cpu = host.cpu
os = host.os
deps = [
"$zx/system/host:tools",
]
}
}
group("tools.redirect") {
visibility = [ ":*" ]
testonly = true
public_deps = [
":tools-${host_os}-${host_cpu}",
]
}
if (current_toolchain == default_toolchain) {
# Install the host developer tools for the running host platform in the
# "$root_build_dir/tools/" directory.
foreach(tools_target, _tools_targets) {
tools_rspfile = "$target_gen_dir/${tools_target}.rsp"
generated_file("$tools_target.rsp") {
visibility = [ ":$tools_target" ]
testonly = true
outputs = [
tools_rspfile,
]
deps = [
":$tools_target.redirect",
]
output_conversion = "list lines"
data_keys = [ "tool_executables" ]
}
action(tools_target) {
testonly = true
deps = [
":$tools_target.rsp",
]
script = "$zx/scripts/copy-files"
depfile = "$target_out_dir/$target_name.d"
outputs = [
depfile,
]
sources = [
tools_rspfile,
]
args = [
tools_target,
rebase_path(depfile, root_build_dir),
rebase_path(tools_rspfile, root_build_dir),
]
}
}
}
group("default") {
testonly = true
deps = [
":all-cpu",
":tools",
]
}
group("all-cpu") {
testonly = true
deps = []
foreach(cpu, standard_fuchsia_cpus) {
# TODO: When everything builds, this will be reorganized.
deps += [ ":what-builds-$cpu" ]
}
}
foreach(cpu, standard_fuchsia_cpus) {
environment_redirect("what-builds-$cpu") {
visibility = [ ":*" ]
environment_label = "$zx/public/gn/toolchain:user"
cpu = cpu
deps = [
# TODO: This indirectly reaches everything that builds so far.
"$zx/system/core/userboot",
"$zx/system/ulib/c",
"$zx/system/ulib/fdio",
]
}
}