xref: /aosp_15_r20/external/capstone/Android.bp (revision 9a0e4156d50a75a99ec4f1653a0e9602a5d45c18)
1package {
2    default_applicable_licenses: ["external_capstone_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18//
19// large-scale-change included anything that looked like it might be a license
20// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
21//
22// Please consider removing redundant or irrelevant files from 'license_text:'.
23// See: http://go/android-license-faq
24license {
25    name: "external_capstone_license",
26    visibility: [":__subpackages__"],
27    license_kinds: [
28        "SPDX-license-identifier-APSL-2.0",
29        "SPDX-license-identifier-BSD",
30        "SPDX-license-identifier-MIT",
31        "SPDX-license-identifier-NCSA",
32    ],
33    license_text: [
34        "LICENSE",
35        "LICENSE.TXT",
36        "LICENSE_LLVM.TXT",
37    ],
38}
39
40arm_flags = ["-DCAPSTONE_HAS_ARM"]
41arm_srcs = [
42    "arch/ARM/ARMDisassembler.c",
43    "arch/ARM/ARMInstPrinter.c",
44    "arch/ARM/ARMMapping.c",
45    "arch/ARM/ARMModule.c",
46]
47
48arm64_flags = ["-DCAPSTONE_HAS_ARM64"]
49arm64_srcs = [
50    "arch/AArch64/AArch64BaseInfo.c",
51    "arch/AArch64/AArch64Disassembler.c",
52    "arch/AArch64/AArch64InstPrinter.c",
53    "arch/AArch64/AArch64Mapping.c",
54    "arch/AArch64/AArch64Module.c",
55]
56
57x86_flags = ["-DCAPSTONE_HAS_X86"]
58x86_srcs = [
59    "arch/X86/X86DisassemblerDecoder.c",
60    "arch/X86/X86Disassembler.c",
61    "arch/X86/X86IntelInstPrinter.c",
62    "arch/X86/X86ATTInstPrinter.c",
63    "arch/X86/X86Mapping.c",
64    "arch/X86/X86Module.c",
65]
66
67cc_defaults {
68    name: "capstone-defaults",
69    srcs: [
70        "cs.c",
71        "utils.c",
72        "SStream.c",
73        "MCInstrDesc.c",
74        "MCRegisterInfo.c",
75        "MCInst.c",
76    ],
77    cflags: [
78        "-Wall",
79        "-Werror",
80        "-Wno-unused-parameter",
81        "-Wno-missing-field-initializers",
82        "-DCAPSTONE_USE_SYS_DYN_MEM",
83    ],
84    export_include_dirs: [
85        ".",
86        "include",
87    ],
88
89    arch: {
90        arm: {
91            cflags: arm_flags,
92            srcs: arm_srcs,
93        },
94        x86: {
95            cflags: arm_flags + arm64_flags + x86_flags,
96            srcs: arm_srcs + arm64_srcs + x86_srcs,
97        },
98        x86_64: {
99            cflags: arm_flags + arm64_flags + x86_flags,
100            srcs: arm_srcs + arm64_srcs + x86_srcs,
101        },
102        arm64: {
103            cflags: arm_flags + arm64_flags,
104            srcs: arm_srcs + arm64_srcs,
105        },
106    },
107}
108
109// For the host and device platform
110// =====================================================
111
112cc_library {
113    name: "libcapstone",
114    host_supported: true,
115    defaults: ["capstone-defaults"],
116}
117