Mercurial > ~dholland > hg > ag > index.cgi
comparison mk/agfile-rules.sh @ 20:bb115deb6fb2
Improve agfiles rule.
(1) It didn't depend on $(AGCL) and it absolutely should have.
(2) allow AGFORCE=1 to make it rebuild whether or not it looks out of
date.
(3) Document this.
author | David A. Holland |
---|---|
date | Mon, 13 Jun 2022 00:02:15 -0400 |
parents | 13d2b8934445 |
children |
comparison
equal
deleted
inserted
replaced
19:db7ff952e01e | 20:bb115deb6fb2 |
---|---|
1 #!/bin/sh | 1 #!/bin/sh |
2 # agfile-rules.sh - generate make rules for AG files | 2 # agfile-rules.sh - generate make rules for AG files |
3 # usage: agfile-rules.sh here|srcdir "syns" "output-extension" > rules.mk | 3 # usage: |
4 # agfile-rules.sh where syns ext maint > rules.mk | |
5 # | |
4 | 6 |
5 if [ $# != 3 ]; then | 7 if [ $# != 4 ]; then |
6 echo "$0: usage: $0 here|srcdir 'syns' 'output-extension'" 1>&2 | 8 echo "$0: usage: $0 where syns ext maint" 1>&2 |
9 echo " where: here | srcdir" 1>&2 | |
10 echo " syns: list of .syn files" 1>&2 | |
11 echo " ext: output extension, e.g. '.c'" 1>&2 | |
12 echo " maint: maintainer | nonmaintainer" 1>&2 | |
7 exit 1 | 13 exit 1 |
8 fi | 14 fi |
9 | 15 |
10 WHERE="$1" | 16 WHERE="$1" |
11 SYNS="$2" | 17 SYNS="$2" |
12 EXT="$3" | 18 EXT="$3" |
19 MAINT="$4" | |
13 | 20 |
14 case "$WHERE" in | 21 case "$WHERE" in |
15 here|srcdir) ;; | 22 here|srcdir) ;; |
16 *) echo "$0: deposit location must be either 'here' or 'srcdir'" | 23 *) echo "$0: deposit location must be either 'here' or 'srcdir'" |
17 exit 1 | 24 exit 1 |
21 if [ "x$SYNS" = x ]; then | 28 if [ "x$SYNS" = x ]; then |
22 echo 'agfiles agclean:;' | 29 echo 'agfiles agclean:;' |
23 exit 0 | 30 exit 0 |
24 fi | 31 fi |
25 | 32 |
33 echo 'agforce: ;' | |
34 echo 'DOAGFORCE=' | |
35 echo 'DOAGFORCE0=' | |
36 echo 'DOAGFORCE1=agforce' | |
37 | |
26 for S in $SYNS; do | 38 for S in $SYNS; do |
27 echo $S | awk ' | 39 echo $S | awk ' |
28 { | 40 { |
29 syn=$1; | 41 syn=$1; |
30 base=syn; | 42 base=syn; |
31 sub("\\.syn$", "", base); | 43 sub("\\.syn$", "", base); |
32 cout=base ext; | 44 cout=base ext; |
33 hout=base ".h"; | 45 hout=base ".h"; |
46 synsrc="$(SRCDIR)/" syn; | |
34 | 47 |
35 if (where == "srcdir") { | 48 if (where == "srcdir") { |
36 dcout = "$(SRCDIR)/" cout; | 49 dcout = "$(SRCDIR)/" cout; |
37 dhout = "$(SRCDIR)/" hout; | 50 dhout = "$(SRCDIR)/" hout; |
38 } | 51 } |
39 else { | 52 else { |
40 dcout = cout; | 53 dcout = cout; |
41 dhout = hout; | 54 dhout = hout; |
42 } | 55 } |
43 | 56 |
57 if (maint == "maintainer") { | |
58 tool = " $(AGCL)"; | |
59 } | |
60 else { | |
61 tool = ""; | |
62 } | |
63 | |
64 force = "$(DOAGFORCE$(AGFORCE))" | |
65 | |
44 printf "agfiles: %s %s\n", dcout, dhout; | 66 printf "agfiles: %s %s\n", dcout, dhout; |
45 printf "%s %s: $(SRCDIR)/%s\n", dcout, dhout, syn; | 67 printf "%s %s: %s %s %s\n", dcout, dhout, synsrc, tool, force; |
46 printf "\t@echo \" [AGCL] %-12s $(AGCLQUAL)\"\n", syn; | 68 printf "\t@echo \" [AGCL] %-12s $(AGCLQUAL)\"\n", syn; |
47 | 69 |
48 printf "\t@$(AGCL) $(SRCDIR)/%s\n", syn; | 70 printf "\t@$(AGCL) $(SRCDIR)/%s\n", syn; |
49 if (where == "srcdir") { | 71 if (where == "srcdir") { |
50 printf "\t@mv %s %s\n", cout, dcout; | 72 printf "\t@mv %s %s\n", cout, dcout; |
51 printf "\t@mv %s %s\n", hout, dhout; | 73 printf "\t@mv %s %s\n", hout, dhout; |
52 } | 74 } |
53 } | 75 } |
54 ' "ext=$EXT" "where=$WHERE" | 76 ' "ext=$EXT" "where=$WHERE" "maint=$MAINT" |
55 done | 77 done |
56 | 78 |
57 echo $SYNS | tr ' ' '\n' | sed 's/.syn$//' | awk ' | 79 echo $SYNS | tr ' ' '\n' | sed 's/.syn$//' | awk ' |
58 BEGIN { printf "agclean:\n"; } | 80 BEGIN { printf "agclean:\n"; } |
59 { | 81 { |