xref: /aosp_15_r20/external/kmod/Android.bp (revision cc4ad7da8cefe208cb129ac2aa9a357c7c72deb2)
1package {
2    default_applicable_licenses: ["external_kmod_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_kmod_license",
26    visibility: [":__subpackages__"],
27    license_kinds: [
28        "SPDX-license-identifier-GPL",
29        "SPDX-license-identifier-GPL-2.0",
30        "SPDX-license-identifier-LGPL",
31        "SPDX-license-identifier-LGPL-2.1",
32        "SPDX-license-identifier-LGPL-3.0",
33        "legacy_unencumbered",
34    ],
35    license_text: [
36        "COPYING",
37        "NOTICE",
38    ],
39}
40
41cc_defaults {
42    name: "libkmod_cflags_common",
43    cflags: [
44        "-include android/port.h",
45        "-Wall",
46        "-Werror",
47        "-Wno-format",
48        "-Wno-unused-parameter",
49        "-Wno-unused-variable",
50        "-Dsecure_getenv=getenv",
51
52        "-DHAVE_CONFIG_H",
53        "-include config.h",
54
55        "-DDISTCONFDIR=\"/lib\"",
56        "-DMODULE_DIRECTORY=\"/lib/modules\"",
57        "-DSYSCONFDIR=\"/tmp\"",
58        "-UNDEBUG",
59    ],
60    target: {
61        glibc: {
62            cflags: ["-DHAVE_DECL_STRNDUPA"],
63        },
64    },
65}
66
67cc_library_static {
68    defaults: ["libkmod_cflags_common"],
69    export_include_dirs: ["libkmod"],
70    host_supported: true,
71    vendor_available: true,
72    name: "libkmod",
73    srcs: [
74        "libkmod/libkmod.c",
75        "libkmod/libkmod-builtin.c",
76        "libkmod/libkmod-file.c",
77        "libkmod/libkmod-module.c",
78        "libkmod/libkmod-config.c",
79        "libkmod/libkmod-index.c",
80        "libkmod/libkmod-elf.c",
81        "libkmod/libkmod-list.c",
82        "libkmod/libkmod-signature.c",
83        "shared/array.c",
84        "shared/scratchbuf.c",
85        "shared/util.c",
86        "shared/hash.c",
87        "shared/strbuf.c",
88    ],
89    visibility: [
90        "//external/igt-gpu-tools",
91        "//external/pciutils",
92        "//vendor:__subpackages__",
93    ],
94}
95
96cc_binary_host {
97    defaults: ["libkmod_cflags_common"],
98    name: "depmod",
99    srcs: [
100        "tools/port.c",
101        "tools/depmod.c",
102        "tools/kmod.c",
103        "tools/modinfo.c",
104        "tools/rmmod.c",
105        "tools/log.c",
106        "tools/modprobe.c",
107        "tools/static-nodes.c",
108        "tools/insmod.c",
109        "tools/lsmod.c",
110    ],
111    static_libs: ["libkmod"],
112}
113