Skip to content

Commit d790739

Browse files
author
Junio C Hamano
committed
Documentation: tighten dependency for git.{html,txt}
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]>
1 parent 63b4b7a commit d790739

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Documentation/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,17 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
8585
cmds-purehelpers.txt \
8686
cmds-foreignscminterface.txt
8787

88-
$(cmds_txt): cmd-list.perl $(MAN1_TXT)
88+
$(cmds_txt): cmd-list.made
89+
90+
cmd-list.made: cmd-list.perl $(MAN1_TXT)
8991
perl ./cmd-list.perl
92+
date >$@
9093

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

9396
clean:
9497
rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep
95-
rm -f $(cmds_txt)
98+
rm -f $(cmds_txt) *.made
9699

97100
%.html : %.txt
98101
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $<

Documentation/cmd-list.perl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
#
1+
#!/usr/bin/perl -w
2+
3+
use File::Compare qw(compare);
24

35
sub format_one {
46
my ($out, $name) = @_;
57
my ($state, $description);
8+
$state = 0;
69
open I, '<', "$name.txt" or die "No such file $name.txt";
710
while (<I>) {
811
if (/^NAME$/) {
@@ -55,7 +58,14 @@ sub format_one {
5558
format_one(\*O, $_);
5659
}
5760
close O;
58-
rename "$out+", "$out";
61+
62+
if (-f "$out" && compare("$out", "$out+") == 0) {
63+
unlink "$out+";
64+
}
65+
else {
66+
print STDERR "$out\n";
67+
rename "$out+", "$out";
68+
}
5969
}
6070

6171
__DATA__

0 commit comments

Comments
 (0)