annotate mk/agfile-rules.sh @ 21:1c9dac05d040

Add lint-style FALLTHROUGH annotations to fallthrough cases. (in the parse engine and thus the output code) Document this, because the old output causes warnings with gcc10.
author David A. Holland
date Mon, 13 Jun 2022 00:04:38 -0400
parents bb115deb6fb2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
1 #!/bin/sh
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
2 # agfile-rules.sh - generate make rules for AG files
20
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
3 # usage:
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
4 # agfile-rules.sh where syns ext maint > rules.mk
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
5 #
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
6
20
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
7 if [ $# != 4 ]; then
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
8 echo "$0: usage: $0 where syns ext maint" 1>&2
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
9 echo " where: here | srcdir" 1>&2
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
10 echo " syns: list of .syn files" 1>&2
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
11 echo " ext: output extension, e.g. '.c'" 1>&2
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
12 echo " maint: maintainer | nonmaintainer" 1>&2
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
13 exit 1
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
14 fi
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
15
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
16 WHERE="$1"
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
17 SYNS="$2"
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
18 EXT="$3"
20
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
19 MAINT="$4"
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
20
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
21 case "$WHERE" in
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
22 here|srcdir) ;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
23 *) echo "$0: deposit location must be either 'here' or 'srcdir'"
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
24 exit 1
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
25 ;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
26 esac
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
27
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
28 if [ "x$SYNS" = x ]; then
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
29 echo 'agfiles agclean:;'
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
30 exit 0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
31 fi
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
32
20
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
33 echo 'agforce: ;'
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
34 echo 'DOAGFORCE='
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
35 echo 'DOAGFORCE0='
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
36 echo 'DOAGFORCE1=agforce'
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
37
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
38 for S in $SYNS; do
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
39 echo $S | awk '
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
40 {
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
41 syn=$1;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
42 base=syn;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
43 sub("\\.syn$", "", base);
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
44 cout=base ext;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
45 hout=base ".h";
20
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
46 synsrc="$(SRCDIR)/" syn;
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
47
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
48 if (where == "srcdir") {
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
49 dcout = "$(SRCDIR)/" cout;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
50 dhout = "$(SRCDIR)/" hout;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
51 }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
52 else {
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
53 dcout = cout;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
54 dhout = hout;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
55 }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
56
20
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
57 if (maint == "maintainer") {
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
58 tool = " $(AGCL)";
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
59 }
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
60 else {
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
61 tool = "";
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
62 }
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
63
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
64 force = "$(DOAGFORCE$(AGFORCE))"
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
65
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
66 printf "agfiles: %s %s\n", dcout, dhout;
20
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
67 printf "%s %s: %s %s %s\n", dcout, dhout, synsrc, tool, force;
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
68 printf "\t@echo \" [AGCL] %-12s $(AGCLQUAL)\"\n", syn;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
69
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
70 printf "\t@$(AGCL) $(SRCDIR)/%s\n", syn;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
71 if (where == "srcdir") {
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
72 printf "\t@mv %s %s\n", cout, dcout;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
73 printf "\t@mv %s %s\n", hout, dhout;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
74 }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
75 }
20
bb115deb6fb2 Improve agfiles rule.
David A. Holland
parents: 0
diff changeset
76 ' "ext=$EXT" "where=$WHERE" "maint=$MAINT"
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
77 done
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
78
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
79 echo $SYNS | tr ' ' '\n' | sed 's/.syn$//' | awk '
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
80 BEGIN { printf "agclean:\n"; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
81 {
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
82 base = $1;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
83 if (where == "srcdir") {
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
84 base = "$(SRCDIR)/" base;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
85 }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
86
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
87 printf "\t@echo \" [RM] %s%s %s.h\"\n", base, ext, base;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
88 printf "\t@rm -f %s%s %s.h\n", base, ext, base;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
89 }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
90 ' "ext=$EXT" "where=$WHERE"
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
91
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
92 if [ $WHERE = here ]; then
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
93 echo 'clean: agclean'
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
94 echo 'beforeall: agfiles'
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
95 fi