llvm/llvm/utils/gn/secondary/llvm/tools/llvm-size/BUILD.gn

import("//llvm/tools/binutils_symlinks.gni")
import("//llvm/utils/TableGen/tablegen.gni")
import("//llvm/utils/gn/build/driver_executable.gni")
import("//llvm/utils/gn/build/symlink_or_copy.gni")

tablegen("Opts") {
  visibility = [ ":llvm-size" ]
  args = [ "-gen-opt-parser-defs" ]
}

if (llvm_install_binutils_symlinks) {
  symlink_or_copy("size") {
    deps = [ ":llvm-size" ]
    source = "llvm-size"
    output = "$root_out_dir/bin/size"
  }
}

# //:llvm-size depends on this symlink target, see comment in //BUILD.gn.
group("symlinks") {
  deps = [ ":llvm-size" ]
  if (llvm_install_binutils_symlinks) {
    deps += [ ":size" ]
  }
}

driver_executable("llvm-size") {
  deps = [
    ":Opts",
    "//llvm/lib/Object",
    "//llvm/lib/Option",
    "//llvm/lib/Support",
    "//llvm/lib/TargetParser",
  ]
  sources = [ "llvm-size.cpp" ]
}