1// Collect target specific code generation libraries
2MCLD_ARM_LIBS = [
3    "libmcldARMTarget",
4    "libmcldARMInfo",
5]
6MCLD_AARCH64_LIBS = [
7    "libmcldAArch64Target",
8    "libmcldAArch64Info",
9]
10MCLD_MIPS_LIBS = [
11    "libmcldMipsTarget",
12    "libmcldMipsInfo",
13]
14MCLD_X86_LIBS = [
15    "libmcldX86Target",
16    "libmcldX86Info",
17]
18
19// Build Options.inc from Options.td
20llvm_tblgen {
21    name: "mcld-gen-options",
22    in: "Options.td",
23    outs: ["Options.inc"],
24}
25
26cc_binary {
27    name: "ld.mc",
28    defaults: ["mcld-defaults"],
29    host_supported: true,
30    generated_headers: ["mcld-gen-options"],
31
32    srcs: ["Main.cpp"],
33
34    // arch-specific static libraries depend on libmcldTarget.
35    // Can be removed once soong supports transitive static library dependencies
36    group_static_libs: true,
37    static_libs: [
38        "libmcldADT",
39        "libmcldCore",
40        "libmcldFragment",
41        "libmcldLD",
42        "libmcldLDVariant",
43        "libmcldMC",
44        "libmcldObject",
45        "libmcldScript",
46        "libmcldSupport",
47        "libmcldTarget",
48    ],
49
50    shared_libs: [
51        "libLLVM_android",
52        "libz",
53    ],
54
55    target: {
56        host: {
57            static_libs: MCLD_ARM_LIBS + MCLD_AARCH64_LIBS +
58                MCLD_MIPS_LIBS + MCLD_X86_LIBS,
59        },
60
61        // Add target specific code generation libraries
62        android_arm: {
63            // Include AARCH64 libs to enable 64-bit linking on ARM targets
64            static_libs: MCLD_ARM_LIBS + MCLD_AARCH64_LIBS,
65        },
66        android_arm64: {
67            // Include ARM libs to enable 32-bit linking on AARCH64 targets
68            static_libs: MCLD_ARM_LIBS + MCLD_AARCH64_LIBS,
69        },
70        android_x86: {
71            static_libs: MCLD_X86_LIBS,
72        },
73        android_x86_64: {
74            static_libs: MCLD_X86_LIBS,
75        },
76        arm_on_x86: {
77            static_libs: MCLD_ARM_LIBS + MCLD_AARCH64_LIBS,
78        },
79        arm_on_x86_64: {
80            static_libs: MCLD_ARM_LIBS + MCLD_AARCH64_LIBS,
81        },
82    },
83}
84