Skip to content

Commit

Permalink
Fix generation of Documentation/usage-%.txt.
Browse files Browse the repository at this point in the history
The old rule worked, most of the time, but had several issues:

 - It depended on the corresponding guilt-*.txt file, but the usage.sh
   script actually reads ../guilt-foo.

 - Actually, each usage-%.txt depended on all guilt-*.txt files, so
   make had to do more work than necessary if a single file was
   altered.

 - The construct broke parallel make, which would spawn several
   usage.sh at once.  This leads to unnecessary work, and could
   potentially result in broken usage files if the "echo some_string >
   some_file" construct used by usage.sh isn't atomic.

Fixed by letting the usage.sh script update a single file, and writing
a proper implicit make rule.  This makes parallel make work a lot
better.

There is a small downside, though, as usage.sh will now be run once
for each command (if everything is regenerated).  I think it is worth
to pay that price to get the correctness.  This command is still very
fast compared to the docbook processing.

Signed-off-by: Per Cederqvist <[email protected]>
Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
  • Loading branch information
Per Cederqvist committed Jan 23, 2015
1 parent 71e1aa2 commit 7e73342
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ clean:
rm -f usage-*.txt
rm -f version.txt

usage-%.txt: $(MAN1_TXT) usage.sh
sh ./usage.sh
usage-guilt-%.txt: ../guilt-% usage.sh
sh ./usage.sh $<

%.html : %.txt footer.txt version.txt
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $<
Expand Down
8 changes: 3 additions & 5 deletions Documentation/usage.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

for i in `ls ../guilt-*`; do
name=$(basename $i)
u=$(grep USAGE $i | sed 's/USAGE="//' | sed 's/"$//')
echo "'$name' $u" > usage-$name.txt
done
name=$(basename $1)
u=$(grep USAGE $1 | sed 's/USAGE="//' | sed 's/"$//')
echo "'$name' $u" > usage-$name.txt

0 comments on commit 7e73342

Please sign in to comment.