xref: /aosp_15_r20/external/one-true-awk/Android.bp (revision 9a7741de182b2776d7b30d6355f2585c0780a51b)
1*9a7741deSElliott Hughespackage {
2*9a7741deSElliott Hughes    default_applicable_licenses: ["external_one-true-awk_license"],
3*9a7741deSElliott Hughes}
4*9a7741deSElliott Hughes
5*9a7741deSElliott Hughes// Added automatically by a large-scale-change that took the approach of
6*9a7741deSElliott Hughes// 'apply every license found to every target'. While this makes sure we respect
7*9a7741deSElliott Hughes// every license restriction, it may not be entirely correct.
8*9a7741deSElliott Hughes//
9*9a7741deSElliott Hughes// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10*9a7741deSElliott Hughes//
11*9a7741deSElliott Hughes// Please consider splitting the single license below into multiple licenses,
12*9a7741deSElliott Hughes// taking care not to lose any license_kind information, and overriding the
13*9a7741deSElliott Hughes// default license using the 'licenses: [...]' property on targets as needed.
14*9a7741deSElliott Hughes//
15*9a7741deSElliott Hughes// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16*9a7741deSElliott Hughes// to attach the license to, and including a comment whether the files may be
17*9a7741deSElliott Hughes// used in the current project.
18*9a7741deSElliott Hughes// See: http://go/android-license-faq
19*9a7741deSElliott Hugheslicense {
20*9a7741deSElliott Hughes    name: "external_one-true-awk_license",
21*9a7741deSElliott Hughes    visibility: [":__subpackages__"],
22*9a7741deSElliott Hughes    license_kinds: [
23*9a7741deSElliott Hughes        "SPDX-license-identifier-BSD",
24*9a7741deSElliott Hughes        "SPDX-license-identifier-MIT",
25*9a7741deSElliott Hughes    ],
26*9a7741deSElliott Hughes    license_text: [
27*9a7741deSElliott Hughes        "LICENSE",
28*9a7741deSElliott Hughes    ],
29*9a7741deSElliott Hughes}
30*9a7741deSElliott Hughes
31*9a7741deSElliott Hughescc_defaults {
32*9a7741deSElliott Hughes    name: "awk-flags",
33*9a7741deSElliott Hughes    cflags: [
34*9a7741deSElliott Hughes        "-Wall",
35*9a7741deSElliott Hughes        "-Werror",
36*9a7741deSElliott Hughes        "-Wextra",
37*9a7741deSElliott Hughes        // Ignore a few harmless idioms widely used in this code.
38*9a7741deSElliott Hughes        "-Wno-missing-field-initializers",
39*9a7741deSElliott Hughes        "-Wno-self-assign",
40*9a7741deSElliott Hughes        "-Wno-unused-parameter",
41*9a7741deSElliott Hughes        // A loop to UCHAR_MAX in `b.c`.
42*9a7741deSElliott Hughes        "-Wno-sign-compare",
43*9a7741deSElliott Hughes        // And one less harmless used with strtod(3) in `lex.c`.
44*9a7741deSElliott Hughes        "-Wno-unused-result",
45*9a7741deSElliott Hughes        // Also ignore harmless macro redefinitions: glibc 2.17 #defines dprintf
46*9a7741deSElliott Hughes        // in stdio2.h, and this #defines it in awk.h
47*9a7741deSElliott Hughes        "-Wno-macro-redefined",
48*9a7741deSElliott Hughes    ],
49*9a7741deSElliott Hughes    stl: "none",
50*9a7741deSElliott Hughes    yacc: {
51*9a7741deSElliott Hughes        flags: [
52*9a7741deSElliott Hughes            "-y",
53*9a7741deSElliott Hughes        ],
54*9a7741deSElliott Hughes    },
55*9a7741deSElliott Hughes}
56*9a7741deSElliott Hughes
57*9a7741deSElliott Hughesgenrule {
58*9a7741deSElliott Hughes    name: "awkgram.tab.c",
59*9a7741deSElliott Hughes    cmd: "M4=$(location m4) $(location bison) -y --no-lines --output=$(genDir)/awkgram.tab.c $(in)",
60*9a7741deSElliott Hughes    out: ["awkgram.tab.c"],
61*9a7741deSElliott Hughes    srcs: ["awkgram.y"],
62*9a7741deSElliott Hughes    tools: [
63*9a7741deSElliott Hughes        "bison",
64*9a7741deSElliott Hughes        "m4",
65*9a7741deSElliott Hughes    ],
66*9a7741deSElliott Hughes}
67*9a7741deSElliott Hughes
68*9a7741deSElliott Hughesgenrule {
69*9a7741deSElliott Hughes    name: "awkgram.tab.h",
70*9a7741deSElliott Hughes    cmd: "M4=$(location m4) $(location bison) -y --no-lines --defines=$(genDir)/awkgram.tab.h --output=$(genDir)/awkgram.tab.c $(in)",
71*9a7741deSElliott Hughes    out: ["awkgram.tab.h"],
72*9a7741deSElliott Hughes    srcs: ["awkgram.y"],
73*9a7741deSElliott Hughes    tools: [
74*9a7741deSElliott Hughes        "bison",
75*9a7741deSElliott Hughes        "m4",
76*9a7741deSElliott Hughes    ],
77*9a7741deSElliott Hughes}
78*9a7741deSElliott Hughes
79*9a7741deSElliott Hughesgenrule {
80*9a7741deSElliott Hughes    name: "proctab.c",
81*9a7741deSElliott Hughes    tools: ["awk-maketab"],
82*9a7741deSElliott Hughes    cmd: "$(location awk-maketab) $(in) > $(genDir)/proctab.c",
83*9a7741deSElliott Hughes    out: ["proctab.c"],
84*9a7741deSElliott Hughes    srcs: [":awkgram.tab.h"],
85*9a7741deSElliott Hughes}
86*9a7741deSElliott Hughes
87*9a7741deSElliott Hughescc_binary_host {
88*9a7741deSElliott Hughes    name: "awk-maketab",
89*9a7741deSElliott Hughes    defaults: ["awk-flags"],
90*9a7741deSElliott Hughes    generated_headers: ["awkgram.tab.h"],
91*9a7741deSElliott Hughes    srcs: ["maketab.c"],
92*9a7741deSElliott Hughes}
93*9a7741deSElliott Hughes
94*9a7741deSElliott Hughescc_defaults {
95*9a7741deSElliott Hughes    name: "awk-defaults",
96*9a7741deSElliott Hughes    defaults: ["awk-flags"],
97*9a7741deSElliott Hughes    generated_headers: ["awkgram.tab.h"],
98*9a7741deSElliott Hughes    srcs: [
99*9a7741deSElliott Hughes        "b.c",
100*9a7741deSElliott Hughes        "lex.c",
101*9a7741deSElliott Hughes        "lib.c",
102*9a7741deSElliott Hughes        "main.c",
103*9a7741deSElliott Hughes        "parse.c",
104*9a7741deSElliott Hughes        ":proctab.c",
105*9a7741deSElliott Hughes        "run.c",
106*9a7741deSElliott Hughes        "tran.c",
107*9a7741deSElliott Hughes        ":awkgram.tab.c",
108*9a7741deSElliott Hughes    ],
109*9a7741deSElliott Hughes}
110*9a7741deSElliott Hughes
111*9a7741deSElliott Hughescc_binary {
112*9a7741deSElliott Hughes    name: "awk",
113*9a7741deSElliott Hughes    defaults: ["awk-defaults"],
114*9a7741deSElliott Hughes}
115*9a7741deSElliott Hughes
116*9a7741deSElliott Hughescc_binary {
117*9a7741deSElliott Hughes    name: "awk_vendor",
118*9a7741deSElliott Hughes    defaults: ["awk-defaults"],
119*9a7741deSElliott Hughes    stem: "awk",
120*9a7741deSElliott Hughes    vendor: true,
121*9a7741deSElliott Hughes}
122*9a7741deSElliott Hughes
123*9a7741deSElliott Hughescc_binary_host {
124*9a7741deSElliott Hughes    name: "one-true-awk",
125*9a7741deSElliott Hughes    defaults: ["awk-defaults"],
126*9a7741deSElliott Hughes}
127