Bob Badour | 6b25576 | 2021-02-12 21:36:17 -0800 | [diff] [blame] | 1 | package { |
| 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 |
| 19 | license { |
| 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 Hughes | c673df2 | 2017-11-30 10:53:25 -0800 | [diff] [blame] | 31 | cc_defaults { |
Elliott Hughes | b89363f | 2019-01-29 12:52:50 -0800 | [diff] [blame] | 32 | name: "awk-flags", |
Elliott Hughes | c673df2 | 2017-11-30 10:53:25 -0800 | [diff] [blame] | 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", |
Elliott Hughes | c9fdfd8 | 2019-03-08 15:25:46 -0800 | [diff] [blame] | 41 | // A loop to UCHAR_MAX in `b.c`. |
| 42 | "-Wno-sign-compare", |
Elliott Hughes | 112b307 | 2018-12-12 14:36:24 -0800 | [diff] [blame] | 43 | // And one less harmless used with strtod(3) in `lex.c`. |
| 44 | "-Wno-unused-result", |
George Burgess IV | b870290 | 2019-01-15 18:56:57 -0800 | [diff] [blame] | 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", |
Elliott Hughes | c673df2 | 2017-11-30 10:53:25 -0800 | [diff] [blame] | 48 | ], |
Elliott Hughes | 3795c3d | 2020-07-13 15:22:23 -0700 | [diff] [blame] | 49 | c_std: "gnu11", |
Elliott Hughes | 3723915 | 2019-05-01 15:20:25 -0700 | [diff] [blame] | 50 | stl: "none", |
Dan Willemsen | f5e8feb | 2019-04-12 12:57:56 -0700 | [diff] [blame] | 51 | yacc: { |
| 52 | flags: [ |
| 53 | "-y", |
| 54 | ], |
| 55 | }, |
Elliott Hughes | b89363f | 2019-01-29 12:52:50 -0800 | [diff] [blame] | 56 | } |
| 57 | |
Dan Willemsen | bdb60ea | 2020-07-16 17:51:08 -0700 | [diff] [blame] | 58 | genrule { |
Elliott Hughes | 2aef6ce | 2020-08-13 15:51:54 -0700 | [diff] [blame] | 59 | name: "awkgram.tab.c", |
Yo Chiang | 936cb7a | 2020-08-26 16:57:23 +0800 | [diff] [blame] | 60 | cmd: "M4=$(location m4) $(location bison) -y --no-lines --output=$(genDir)/awkgram.tab.c $(in)", |
Elliott Hughes | 2aef6ce | 2020-08-13 15:51:54 -0700 | [diff] [blame] | 61 | out: ["awkgram.tab.c"], |
Dan Willemsen | bdb60ea | 2020-07-16 17:51:08 -0700 | [diff] [blame] | 62 | srcs: ["awkgram.y"], |
| 63 | tools: [ |
| 64 | "bison", |
| 65 | "m4", |
| 66 | ], |
| 67 | } |
| 68 | |
| 69 | genrule { |
Elliott Hughes | 2aef6ce | 2020-08-13 15:51:54 -0700 | [diff] [blame] | 70 | name: "awkgram.tab.h", |
Yo Chiang | 936cb7a | 2020-08-26 16:57:23 +0800 | [diff] [blame] | 71 | cmd: "M4=$(location m4) $(location bison) -y --no-lines --defines=$(genDir)/awkgram.tab.h --output=$(genDir)/awkgram.tab.c $(in)", |
Elliott Hughes | 2aef6ce | 2020-08-13 15:51:54 -0700 | [diff] [blame] | 72 | out: ["awkgram.tab.h"], |
Dan Willemsen | bdb60ea | 2020-07-16 17:51:08 -0700 | [diff] [blame] | 73 | srcs: ["awkgram.y"], |
| 74 | tools: [ |
| 75 | "bison", |
| 76 | "m4", |
| 77 | ], |
| 78 | } |
| 79 | |
| 80 | genrule { |
| 81 | name: "proctab.c", |
| 82 | tools: ["awk-maketab"], |
| 83 | cmd: "$(location awk-maketab) $(in) > $(genDir)/proctab.c", |
| 84 | out: ["proctab.c"], |
Elliott Hughes | 2aef6ce | 2020-08-13 15:51:54 -0700 | [diff] [blame] | 85 | srcs: [":awkgram.tab.h"], |
Dan Willemsen | bdb60ea | 2020-07-16 17:51:08 -0700 | [diff] [blame] | 86 | } |
| 87 | |
Haibo Huang | 0687bec | 2019-09-06 17:32:25 -0700 | [diff] [blame] | 88 | cc_binary_host { |
Elliott Hughes | b89363f | 2019-01-29 12:52:50 -0800 | [diff] [blame] | 89 | name: "awk-maketab", |
| 90 | defaults: ["awk-flags"], |
Elliott Hughes | 2aef6ce | 2020-08-13 15:51:54 -0700 | [diff] [blame] | 91 | generated_headers: ["awkgram.tab.h"], |
Dan Willemsen | bdb60ea | 2020-07-16 17:51:08 -0700 | [diff] [blame] | 92 | srcs: ["maketab.c"], |
Elliott Hughes | b89363f | 2019-01-29 12:52:50 -0800 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | cc_defaults { |
| 96 | name: "awk-defaults", |
| 97 | defaults: ["awk-flags"], |
Elliott Hughes | 2aef6ce | 2020-08-13 15:51:54 -0700 | [diff] [blame] | 98 | generated_headers: ["awkgram.tab.h"], |
Elliott Hughes | b89363f | 2019-01-29 12:52:50 -0800 | [diff] [blame] | 99 | srcs: [ |
| 100 | "b.c", |
| 101 | "lex.c", |
| 102 | "lib.c", |
| 103 | "main.c", |
| 104 | "parse.c", |
Dan Willemsen | bdb60ea | 2020-07-16 17:51:08 -0700 | [diff] [blame] | 105 | ":proctab.c", |
Elliott Hughes | b89363f | 2019-01-29 12:52:50 -0800 | [diff] [blame] | 106 | "run.c", |
| 107 | "tran.c", |
Elliott Hughes | 2aef6ce | 2020-08-13 15:51:54 -0700 | [diff] [blame] | 108 | ":awkgram.tab.c", |
Elliott Hughes | b89363f | 2019-01-29 12:52:50 -0800 | [diff] [blame] | 109 | ], |
Elliott Hughes | c673df2 | 2017-11-30 10:53:25 -0800 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | cc_binary { |
| 113 | name: "awk", |
| 114 | defaults: ["awk-defaults"], |
| 115 | } |
| 116 | |
| 117 | cc_binary { |
| 118 | name: "awk_vendor", |
| 119 | defaults: ["awk-defaults"], |
| 120 | stem: "awk", |
| 121 | vendor: true, |
| 122 | } |
Elliott Hughes | 112b307 | 2018-12-12 14:36:24 -0800 | [diff] [blame] | 123 | |
| 124 | cc_binary_host { |
| 125 | name: "one-true-awk", |
| 126 | defaults: ["awk-defaults"], |
| 127 | } |