xref: /openbsd/gnu/llvm/llvm/utils/gn/secondary/BUILD.gn (revision d415bd75)
1import("//clang/lib/ARCMigrate/enable.gni")
2import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
3import("//llvm/utils/gn/build/toolchain/compiler.gni")
4
5group("default") {
6  deps = [
7    "//clang-tools-extra/clangd/test",
8    "//clang-tools-extra/pseudo/test",
9    "//clang-tools-extra/test",
10    "//clang/test",
11    "//clang/tools/scan-build",
12    "//compiler-rt",
13    "//compiler-rt/include",
14    "//compiler-rt/lib/scudo",
15    "//lld/test",
16    "//lldb/test",
17    "//llvm/test",
18  ]
19  if (current_os == "linux") {
20    deps += [
21      "//libcxx",
22      "//libcxxabi",
23    ]
24  }
25  if (current_os == "linux" || current_os == "win") {
26    deps += [ "//compiler-rt/test/asan" ]
27  }
28  if (current_os == "linux" || current_os == "android") {
29    deps += [ "//compiler-rt/test/hwasan" ]
30  }
31  if (current_os == "linux" || current_os == "mac") {
32    deps += [ "//libunwind" ]
33  }
34
35  # FIXME: Add this on linux/win after testing that it builds.
36  if (current_os == "mac") {
37    deps += [ "//bolt/test" ]
38  }
39
40  testonly = true
41}
42
43# Symlink handling.
44# On POSIX, symlinks to the target can be created before the target exist,
45# and the target can depend on the symlink targets, so that building the
46# target ensures the symlinks exist.
47# However, symlinks didn't exist on Windows until recently, so there the
48# binary needs to be copied -- which requires it to exist. So the symlink step
49# needs to run after the target that creates the binary.
50# In the cmake build, this is done via a "postbuild" on the target, which just
51# tacks on "&& copy out.exe out2.exe" to the link command.
52# GN doesn't have a way to express postbuild commands.  It could probably be
53# emulated by having the link command in the toolchain be a wrapper script that
54# reads a ".symlinks" file next to the target, and have an action write that
55# and make the target depend on that, but then every single link has to use the
56# wrapper (unless we do further acrobatics to use a different toolchain for
57# targets that need symlinks) even though most links don't need symlinks.
58# Instead, have a top-level target for each target that needs symlinks, and
59# make that depend on the symlinks. Then the symlinks can depend on the
60# executable.  This has the effect that `ninja lld` builds lld and then creates
61# symlinks (via this target), while `ninja bin/lld` only builds lld and doesn't
62# update symlinks (in particular, on Windows it doesn't copy the new lld to its
63# new locations).
64# That seems simpler, more explicit, and good enough.
65group("clang") {
66  deps = [ "//clang/tools/driver:symlinks" ]
67}
68group("lld") {
69  deps = [ "//lld/tools/lld:symlinks" ]
70}
71group("llvm-ar") {
72  deps = [ "//llvm/tools/llvm-ar:symlinks" ]
73}
74if (current_os == "mac") {
75  group("llvm-bolt") {
76    deps = [ "//bolt/tools/driver:symlinks" ]
77  }
78}
79group("llvm-dwp") {
80  deps = [ "//llvm/tools/llvm-dwp:symlinks" ]
81}
82group("llvm-nm") {
83  deps = [ "//llvm/tools/llvm-nm:symlinks" ]
84}
85group("llvm-cxxfilt") {
86  deps = [ "//llvm/tools/llvm-cxxfilt:symlinks" ]
87}
88group("llvm-debuginfod") {
89  deps = [ "//llvm/tools/llvm-debuginfod:symlinks" ]
90}
91group("llvm-debuginfod-find") {
92  deps = [ "//llvm/tools/llvm-debuginfod-find:symlinks" ]
93}
94group("llvm-libtool-darwin") {
95  deps = [ "//llvm/tools/llvm-libtool-darwin:symlinks" ]
96}
97group("llvm-lipo") {
98  deps = [ "//llvm/tools/llvm-lipo:symlinks" ]
99}
100group("llvm-objcopy") {
101  deps = [ "//llvm/tools/llvm-objcopy:symlinks" ]
102}
103group("llvm-objdump") {
104  deps = [ "//llvm/tools/llvm-objdump:symlinks" ]
105}
106group("llvm-rc") {
107  deps = [ "//llvm/tools/llvm-rc:symlinks" ]
108}
109group("llvm-readobj") {
110  deps = [ "//llvm/tools/llvm-readobj:symlinks" ]
111}
112group("llvm-size") {
113  deps = [ "//llvm/tools/llvm-size:symlinks" ]
114}
115group("llvm-strings") {
116  deps = [ "//llvm/tools/llvm-strings:symlinks" ]
117}
118group("llvm-symbolizer") {
119  deps = [ "//llvm/tools/llvm-symbolizer:symlinks" ]
120}
121
122# A pool called "console" in the root BUILD.gn is magic and represents ninja's
123# built-in console pool. (Requires a GN with `gn --version` >= 552353.)
124pool("console") {
125  depth = 1
126}
127