xref: /aosp_15_r20/art/tools/cpp-define-generator/Android.bp (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker//
2*795d594fSAndroid Build Coastguard Worker// Copyright (C) 2014 The Android Open Source Project
3*795d594fSAndroid Build Coastguard Worker//
4*795d594fSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
5*795d594fSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
6*795d594fSAndroid Build Coastguard Worker// You may obtain a copy of the License at
7*795d594fSAndroid Build Coastguard Worker//
8*795d594fSAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
9*795d594fSAndroid Build Coastguard Worker//
10*795d594fSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
11*795d594fSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
12*795d594fSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*795d594fSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
14*795d594fSAndroid Build Coastguard Worker// limitations under the License.
15*795d594fSAndroid Build Coastguard Worker//
16*795d594fSAndroid Build Coastguard Worker
17*795d594fSAndroid Build Coastguard Worker// This produces human-readable asm_defines.s with the embedded compile-time constants.
18*795d594fSAndroid Build Coastguard Workerpackage {
19*795d594fSAndroid Build Coastguard Worker    // See: http://go/android-license-faq
20*795d594fSAndroid Build Coastguard Worker    // A large-scale-change added 'default_applicable_licenses' to import
21*795d594fSAndroid Build Coastguard Worker    // all of the 'license_kinds' from "art_license"
22*795d594fSAndroid Build Coastguard Worker    // to get the below license kinds:
23*795d594fSAndroid Build Coastguard Worker    //   SPDX-license-identifier-Apache-2.0
24*795d594fSAndroid Build Coastguard Worker    default_applicable_licenses: ["art_license"],
25*795d594fSAndroid Build Coastguard Worker}
26*795d594fSAndroid Build Coastguard Worker
27*795d594fSAndroid Build Coastguard Workercc_object {
28*795d594fSAndroid Build Coastguard Worker    name: "asm_defines.s",
29*795d594fSAndroid Build Coastguard Worker    host_supported: true,
30*795d594fSAndroid Build Coastguard Worker    device_supported: true,
31*795d594fSAndroid Build Coastguard Worker    defaults: ["art_debug_defaults"],
32*795d594fSAndroid Build Coastguard Worker    header_libs: [
33*795d594fSAndroid Build Coastguard Worker        "art_libartbase_headers", // For base/bit_utils.h
34*795d594fSAndroid Build Coastguard Worker        "jni_headers",
35*795d594fSAndroid Build Coastguard Worker        "libart_headers",
36*795d594fSAndroid Build Coastguard Worker        "libdexfile_all_headers", // For dex/modifiers.h
37*795d594fSAndroid Build Coastguard Worker    ],
38*795d594fSAndroid Build Coastguard Worker    // Produce text file rather than binary.
39*795d594fSAndroid Build Coastguard Worker    cflags: ["-S"],
40*795d594fSAndroid Build Coastguard Worker    srcs: ["asm_defines.cc"],
41*795d594fSAndroid Build Coastguard Worker    apex_available: [
42*795d594fSAndroid Build Coastguard Worker        "com.android.art",
43*795d594fSAndroid Build Coastguard Worker        "com.android.art.debug",
44*795d594fSAndroid Build Coastguard Worker    ],
45*795d594fSAndroid Build Coastguard Worker}
46*795d594fSAndroid Build Coastguard Worker
47*795d594fSAndroid Build Coastguard Worker// This extracts the compile-time constants from asm_defines.s and creates the header.
48*795d594fSAndroid Build Coastguard Workercc_genrule {
49*795d594fSAndroid Build Coastguard Worker    name: "cpp-define-generator-asm-support",
50*795d594fSAndroid Build Coastguard Worker    host_supported: true,
51*795d594fSAndroid Build Coastguard Worker    device_supported: true,
52*795d594fSAndroid Build Coastguard Worker    srcs: [":asm_defines.s"],
53*795d594fSAndroid Build Coastguard Worker    out: ["asm_defines.h"],
54*795d594fSAndroid Build Coastguard Worker    tool_files: ["make_header.py"],
55*795d594fSAndroid Build Coastguard Worker    cmd: "$(location make_header.py) \"$(in)\" > \"$(out)\"",
56*795d594fSAndroid Build Coastguard Worker    target: {
57*795d594fSAndroid Build Coastguard Worker        darwin: {
58*795d594fSAndroid Build Coastguard Worker            enabled: false,
59*795d594fSAndroid Build Coastguard Worker        },
60*795d594fSAndroid Build Coastguard Worker        windows: {
61*795d594fSAndroid Build Coastguard Worker            // When the module is enabled globally in the soong_config_variables
62*795d594fSAndroid Build Coastguard Worker            // stanza above, it gets enabled on windows too. Hence we need to
63*795d594fSAndroid Build Coastguard Worker            // disable it explicitly.
64*795d594fSAndroid Build Coastguard Worker            // TODO(b/172480617): Clean up with that.
65*795d594fSAndroid Build Coastguard Worker            enabled: false,
66*795d594fSAndroid Build Coastguard Worker        },
67*795d594fSAndroid Build Coastguard Worker    },
68*795d594fSAndroid Build Coastguard Worker
69*795d594fSAndroid Build Coastguard Worker    apex_available: [
70*795d594fSAndroid Build Coastguard Worker        "com.android.art",
71*795d594fSAndroid Build Coastguard Worker        "com.android.art.debug",
72*795d594fSAndroid Build Coastguard Worker    ],
73*795d594fSAndroid Build Coastguard Worker}
74*795d594fSAndroid Build Coastguard Worker
75*795d594fSAndroid Build Coastguard Workercc_library_headers {
76*795d594fSAndroid Build Coastguard Worker    name: "cpp-define-generator-definitions",
77*795d594fSAndroid Build Coastguard Worker    defaults: ["art_defaults"],
78*795d594fSAndroid Build Coastguard Worker    host_supported: true,
79*795d594fSAndroid Build Coastguard Worker    export_include_dirs: ["."],
80*795d594fSAndroid Build Coastguard Worker
81*795d594fSAndroid Build Coastguard Worker    apex_available: [
82*795d594fSAndroid Build Coastguard Worker        "com.android.art",
83*795d594fSAndroid Build Coastguard Worker        "com.android.art.debug",
84*795d594fSAndroid Build Coastguard Worker    ],
85*795d594fSAndroid Build Coastguard Worker}
86*795d594fSAndroid Build Coastguard Worker
87*795d594fSAndroid Build Coastguard Workerpython_binary_host {
88*795d594fSAndroid Build Coastguard Worker    name: "cpp-define-generator-test",
89*795d594fSAndroid Build Coastguard Worker    main: "make_header_test.py",
90*795d594fSAndroid Build Coastguard Worker    srcs: [
91*795d594fSAndroid Build Coastguard Worker        "make_header.py",
92*795d594fSAndroid Build Coastguard Worker        "make_header_test.py",
93*795d594fSAndroid Build Coastguard Worker    ],
94*795d594fSAndroid Build Coastguard Worker    test_suites: ["general-tests"],
95*795d594fSAndroid Build Coastguard Worker}
96