Skip to content

Commit

Permalink
Documentation: tighten dependency for git.{html,txt}
Browse files Browse the repository at this point in the history
Every time _any_ documentation page changed, cmds-*.txt files
were regenerated, which caused git.{html,txt} to be remade.  Try
not to update cmds-*.txt files if their new contents match the
old ones.

Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
Junio C Hamano committed Apr 7, 2007
1 parent 63b4b7a commit d790739
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,17 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
cmds-purehelpers.txt \
cmds-foreignscminterface.txt

$(cmds_txt): cmd-list.perl $(MAN1_TXT)
$(cmds_txt): cmd-list.made

cmd-list.made: cmd-list.perl $(MAN1_TXT)
perl ./cmd-list.perl
date >$@

git.7 git.html: git.txt core-intro.txt

clean:
rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep
rm -f $(cmds_txt)
rm -f $(cmds_txt) *.made

%.html : %.txt
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $<
Expand Down
14 changes: 12 additions & 2 deletions Documentation/cmd-list.perl
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#
#!/usr/bin/perl -w

use File::Compare qw(compare);

sub format_one {
my ($out, $name) = @_;
my ($state, $description);
$state = 0;
open I, '<', "$name.txt" or die "No such file $name.txt";
while (<I>) {
if (/^NAME$/) {
Expand Down Expand Up @@ -55,7 +58,14 @@ sub format_one {
format_one(\*O, $_);
}
close O;
rename "$out+", "$out";

if (-f "$out" && compare("$out", "$out+") == 0) {
unlink "$out+";
}
else {
print STDERR "$out\n";
rename "$out+", "$out";
}
}

__DATA__
Expand Down

0 comments on commit d790739

Please sign in to comment.