1import("//llvm/lib/Target/targets.gni")
2import("//llvm/lib/Target/targets_with_asm_parsers.gni")
3import("//llvm/lib/Target/targets_with_disassemblers.gni")
4import("//llvm/lib/Target/targets_with_mcas.gni")
5
6# This build file has two parts:
7# 1. The actual //llvm/lib/Target build target, which is just a static
8#    library containing the cpp files in this directory.  It contains general
9#    shared target code.
10# 2. Forwarding targets that forward to the concrete targets (X86, ARM, ...).
11#    These are defined in subdirectories, and the forwarding names match
12#    the names of the forwarding targets in CMake.  They all (indirectly,
13#    through CodeGen) depend on the //llvm/lib/Target build target.
14# (See also `gn help labels`).
15# The dependency chain is:
16# //llvm/lib/Target:TargetsToBuild (a target in this file) ->
17# /llvm/lib/Target/(X86|ARM|...) (in the subdirectories) ->
18# //llvm/lib/CodeGen ->
19# //llvm/lib/Target (a target in this file again)
20# Note that while this file appears twice in that stack, it's with different
21# targets in this file, so there's no cyclic dependency.
22
23# 1. Actual build target.
24static_library("Target") {
25  output_name = "LLVMTarget"
26  deps = [
27    "//llvm/lib/Analysis",
28    "//llvm/lib/IR",
29    "//llvm/lib/MC",
30    "//llvm/lib/Support",
31  ]
32  public_deps = [
33    # This is a bit of a hack: llvm-c/Target.h includes llvm/Config/Targets.def,
34    # but there's no target corresponding to llvm-c. Since the functions
35    # declared in llvm-c/Target.h are defined in llvm/lib/Target, clients of
36    # it must depend on llvm/lib/Target, so add the public_dep for Targets.def
37    # here.
38    "//llvm/include/llvm/Config:write_target_def_files",
39  ]
40  sources = [
41    "Target.cpp",
42    "TargetIntrinsicInfo.cpp",
43    "TargetLoweringObjectFile.cpp",
44    "TargetMachine.cpp",
45    "TargetMachineC.cpp",
46  ]
47}
48
49# 2. Forwarding targets.
50group("NativeTarget") {
51  deps = [ "$native_target" ]
52}
53
54group("TargetsToBuild") {
55  deps = llvm_targets_to_build
56}
57
58group("AllTargetsAsmParsers") {
59  deps = []
60  foreach(target, targets_with_asm_parsers) {
61    deps += [ "$target/AsmParser" ]
62  }
63}
64
65group("AllTargetsDescs") {
66  deps = []
67  foreach(target, llvm_targets_to_build) {
68    deps += [ "$target/MCTargetDesc" ]
69  }
70}
71
72group("AllTargetsDisassemblers") {
73  deps = []
74  foreach(target, targets_with_disassemblers) {
75    deps += [ "$target/Disassembler" ]
76  }
77}
78
79group("AllTargetsInfos") {
80  deps = []
81  foreach(target, llvm_targets_to_build) {
82    deps += [ "$target/TargetInfo" ]
83  }
84}
85
86group("AllTargetsMCAs") {
87  deps = []
88  foreach(target, targets_with_mcas) {
89    deps += [ "$target/MCA" ]
90  }
91}
92