blob: e7d53ac92e9a737365406c39183979f05962f6b2 [file] [log] [blame]
Bob Badour6b255762021-02-12 21:36:17 -08001package {
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
Elliott Hughesc673df22017-11-30 10:53:25 -080031cc_defaults {
Elliott Hughesb89363f2019-01-29 12:52:50 -080032 name: "awk-flags",
Elliott Hughesc673df22017-11-30 10:53:25 -080033 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",
Elliott Hughesc9fdfd82019-03-08 15:25:46 -080041 // A loop to UCHAR_MAX in `b.c`.
42 "-Wno-sign-compare",
Elliott Hughes112b3072018-12-12 14:36:24 -080043 // And one less harmless used with strtod(3) in `lex.c`.
44 "-Wno-unused-result",
George Burgess IVb8702902019-01-15 18:56:57 -080045 // 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",
Elliott Hughesc673df22017-11-30 10:53:25 -080048 ],
Elliott Hughes3795c3d2020-07-13 15:22:23 -070049 c_std: "gnu11",
Elliott Hughes37239152019-05-01 15:20:25 -070050 stl: "none",
Dan Willemsenf5e8feb2019-04-12 12:57:56 -070051 yacc: {
52 flags: [
53 "-y",
54 ],
55 },
Elliott Hughesb89363f2019-01-29 12:52:50 -080056}
57
Dan Willemsenbdb60ea2020-07-16 17:51:08 -070058genrule {
Elliott Hughes2aef6ce2020-08-13 15:51:54 -070059 name: "awkgram.tab.c",
Yo Chiang936cb7a2020-08-26 16:57:23 +080060 cmd: "M4=$(location m4) $(location bison) -y --no-lines --output=$(genDir)/awkgram.tab.c $(in)",
Elliott Hughes2aef6ce2020-08-13 15:51:54 -070061 out: ["awkgram.tab.c"],
Dan Willemsenbdb60ea2020-07-16 17:51:08 -070062 srcs: ["awkgram.y"],
63 tools: [
64 "bison",
65 "m4",
66 ],
67}
68
69genrule {
Elliott Hughes2aef6ce2020-08-13 15:51:54 -070070 name: "awkgram.tab.h",
Yo Chiang936cb7a2020-08-26 16:57:23 +080071 cmd: "M4=$(location m4) $(location bison) -y --no-lines --defines=$(genDir)/awkgram.tab.h --output=$(genDir)/awkgram.tab.c $(in)",
Elliott Hughes2aef6ce2020-08-13 15:51:54 -070072 out: ["awkgram.tab.h"],
Dan Willemsenbdb60ea2020-07-16 17:51:08 -070073 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"],
Elliott Hughes2aef6ce2020-08-13 15:51:54 -070085 srcs: [":awkgram.tab.h"],
Dan Willemsenbdb60ea2020-07-16 17:51:08 -070086}
87
Haibo Huang0687bec2019-09-06 17:32:25 -070088cc_binary_host {
Elliott Hughesb89363f2019-01-29 12:52:50 -080089 name: "awk-maketab",
90 defaults: ["awk-flags"],
Elliott Hughes2aef6ce2020-08-13 15:51:54 -070091 generated_headers: ["awkgram.tab.h"],
Dan Willemsenbdb60ea2020-07-16 17:51:08 -070092 srcs: ["maketab.c"],
Elliott Hughesb89363f2019-01-29 12:52:50 -080093}
94
95cc_defaults {
96 name: "awk-defaults",
97 defaults: ["awk-flags"],
Elliott Hughes2aef6ce2020-08-13 15:51:54 -070098 generated_headers: ["awkgram.tab.h"],
Elliott Hughesb89363f2019-01-29 12:52:50 -080099 srcs: [
100 "b.c",
101 "lex.c",
102 "lib.c",
103 "main.c",
104 "parse.c",
Dan Willemsenbdb60ea2020-07-16 17:51:08 -0700105 ":proctab.c",
Elliott Hughesb89363f2019-01-29 12:52:50 -0800106 "run.c",
107 "tran.c",
Elliott Hughes2aef6ce2020-08-13 15:51:54 -0700108 ":awkgram.tab.c",
Elliott Hughesb89363f2019-01-29 12:52:50 -0800109 ],
Elliott Hughesc673df22017-11-30 10:53:25 -0800110}
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}
Elliott Hughes112b3072018-12-12 14:36:24 -0800123
124cc_binary_host {
125 name: "one-true-awk",
126 defaults: ["awk-defaults"],
127}