xref: /aosp_15_r20/external/one-true-awk/Android.bp (revision 9a7741de182b2776d7b30d6355f2585c0780a51b)
1package {
2    default_applicable_licenses: ["external_one-true-awk_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// See: http://go/android-license-faq
19license {
20    name: "external_one-true-awk_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "SPDX-license-identifier-BSD",
24        "SPDX-license-identifier-MIT",
25    ],
26    license_text: [
27        "LICENSE",
28    ],
29}
30
31cc_defaults {
32    name: "awk-flags",
33    cflags: [
34        "-Wall",
35        "-Werror",
36        "-Wextra",
37        // Ignore a few harmless idioms widely used in this code.
38        "-Wno-missing-field-initializers",
39        "-Wno-self-assign",
40        "-Wno-unused-parameter",
41        // A loop to UCHAR_MAX in `b.c`.
42        "-Wno-sign-compare",
43        // And one less harmless used with strtod(3) in `lex.c`.
44        "-Wno-unused-result",
45        // Also ignore harmless macro redefinitions: glibc 2.17 #defines dprintf
46        // in stdio2.h, and this #defines it in awk.h
47        "-Wno-macro-redefined",
48    ],
49    stl: "none",
50    yacc: {
51        flags: [
52            "-y",
53        ],
54    },
55}
56
57genrule {
58    name: "awkgram.tab.c",
59    cmd: "M4=$(location m4) $(location bison) -y --no-lines --output=$(genDir)/awkgram.tab.c $(in)",
60    out: ["awkgram.tab.c"],
61    srcs: ["awkgram.y"],
62    tools: [
63        "bison",
64        "m4",
65    ],
66}
67
68genrule {
69    name: "awkgram.tab.h",
70    cmd: "M4=$(location m4) $(location bison) -y --no-lines --defines=$(genDir)/awkgram.tab.h --output=$(genDir)/awkgram.tab.c $(in)",
71    out: ["awkgram.tab.h"],
72    srcs: ["awkgram.y"],
73    tools: [
74        "bison",
75        "m4",
76    ],
77}
78
79genrule {
80    name: "proctab.c",
81    tools: ["awk-maketab"],
82    cmd: "$(location awk-maketab) $(in) > $(genDir)/proctab.c",
83    out: ["proctab.c"],
84    srcs: [":awkgram.tab.h"],
85}
86
87cc_binary_host {
88    name: "awk-maketab",
89    defaults: ["awk-flags"],
90    generated_headers: ["awkgram.tab.h"],
91    srcs: ["maketab.c"],
92}
93
94cc_defaults {
95    name: "awk-defaults",
96    defaults: ["awk-flags"],
97    generated_headers: ["awkgram.tab.h"],
98    srcs: [
99        "b.c",
100        "lex.c",
101        "lib.c",
102        "main.c",
103        "parse.c",
104        ":proctab.c",
105        "run.c",
106        "tran.c",
107        ":awkgram.tab.c",
108    ],
109}
110
111cc_binary {
112    name: "awk",
113    defaults: ["awk-defaults"],
114}
115
116cc_binary {
117    name: "awk_vendor",
118    defaults: ["awk-defaults"],
119    stem: "awk",
120    vendor: true,
121}
122
123cc_binary_host {
124    name: "one-true-awk",
125    defaults: ["awk-defaults"],
126}
127