• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    c_std: "gnu11",
50    stl: "none",
51    yacc: {
52        flags: [
53            "-y",
54        ],
55    },
56}
57
58genrule {
59    name: "awkgram.tab.c",
60    cmd: "M4=$(location m4) $(location bison) -y --no-lines --output=$(genDir)/awkgram.tab.c $(in)",
61    out: ["awkgram.tab.c"],
62    srcs: ["awkgram.y"],
63    tools: [
64        "bison",
65        "m4",
66    ],
67}
68
69genrule {
70    name: "awkgram.tab.h",
71    cmd: "M4=$(location m4) $(location bison) -y --no-lines --defines=$(genDir)/awkgram.tab.h --output=$(genDir)/awkgram.tab.c $(in)",
72    out: ["awkgram.tab.h"],
73    srcs: ["awkgram.y"],
74    tools: [
75        "bison",
76        "m4",
77    ],
78}
79
80genrule {
81    name: "proctab.c",
82    tools: ["awk-maketab"],
83    cmd: "$(location awk-maketab) $(in) > $(genDir)/proctab.c",
84    out: ["proctab.c"],
85    srcs: [":awkgram.tab.h"],
86}
87
88cc_binary_host {
89    name: "awk-maketab",
90    defaults: ["awk-flags"],
91    generated_headers: ["awkgram.tab.h"],
92    srcs: ["maketab.c"],
93}
94
95cc_defaults {
96    name: "awk-defaults",
97    defaults: ["awk-flags"],
98    generated_headers: ["awkgram.tab.h"],
99    srcs: [
100        "b.c",
101        "lex.c",
102        "lib.c",
103        "main.c",
104        "parse.c",
105        ":proctab.c",
106        "run.c",
107        "tran.c",
108        ":awkgram.tab.c",
109    ],
110}
111
112cc_binary {
113    name: "awk",
114    defaults: ["awk-defaults"],
115}
116
117cc_binary {
118    name: "awk_vendor",
119    defaults: ["awk-defaults"],
120    stem: "awk",
121    vendor: true,
122}
123
124cc_binary_host {
125    name: "one-true-awk",
126    defaults: ["awk-defaults"],
127}
128