xref: /aosp_15_r20/external/cpuinfo/Android.bp (revision 2b54f0db79fd8303838913b20ff3780cddaa909f)
1// Copyright (C) 2020 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_applicable_licenses: ["external_cpuinfo_license"],
17}
18
19// Added automatically by a large-scale-change
20// See: http://go/android-license-faq
21license {
22    name: "external_cpuinfo_license",
23    visibility: [":__subpackages__"],
24    license_kinds: [
25        "SPDX-license-identifier-BSD",
26    ],
27    license_text: [
28        "LICENSE",
29    ],
30}
31
32cpuinfo_arm_common_src_files = [
33    "src/arm/uarch.c",
34    "src/arm/cache.c",
35    "src/arm/linux/init.c",
36    "src/arm/linux/cpuinfo.c",
37    "src/arm/linux/clusters.c",
38    "src/arm/linux/chipset.c",
39    "src/arm/linux/midr.c",
40    "src/arm/linux/hwcap.c",
41    "src/arm/android/properties.c",
42]
43
44cpuinfo_x86_common_src_files = [
45    "src/x86/init.c",
46    "src/x86/info.c",
47    "src/x86/name.c",
48    "src/x86/isa.c",
49    "src/x86/vendor.c",
50    "src/x86/uarch.c",
51    "src/x86/topology.c",
52    "src/x86/cache/init.c",
53    "src/x86/cache/descriptor.c",
54    "src/x86/cache/deterministic.c",
55    "src/x86/linux/cpuinfo.c",
56    "src/x86/linux/init.c",
57]
58
59cc_library_static {
60    name: "libcpuinfo",
61    export_include_dirs: ["include"],
62    vendor_available: true,
63    sdk_version: "current",
64    local_include_dirs: [
65        "src",
66    ],
67    srcs: [
68        "src/init.c",
69        "src/api.c",
70        "src/cache.c",
71        "src/linux/processors.c",
72        "src/linux/smallfile.c",
73        "src/linux/multiline.c",
74        "src/linux/cpulist.c",
75    ],
76    arch: {
77        arm: {
78            srcs: cpuinfo_arm_common_src_files + [
79                "src/arm/linux/aarch32-isa.c",
80            ],
81            cflags: [
82                "-mcpu=generic",
83                "-march=armv7-a",
84            ],
85       },
86        arm64: {
87            srcs: cpuinfo_arm_common_src_files + [
88                "src/arm/linux/aarch64-isa.c",
89            ],
90        },
91        x86: {
92            srcs: cpuinfo_x86_common_src_files,
93        },
94        x86_64: {
95            srcs: cpuinfo_x86_common_src_files,
96        },
97    },
98    cflags: [
99        "-std=c99",
100        "-Oz",
101        "-D_GNU_SOURCE=1",
102        "-Wno-unused-function",
103        "-Wno-unused-parameter",
104        "-Wno-missing-field-initializers",
105    ],
106    whole_static_libs: [
107        "libclog",
108    ],
109}
110