@matheusbsbs / matheus-bagliano / commits / d79073922f
Fork 0

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 <junkio@cox.net>

Junio C Hamano committed Apr 5, 2007 at 22:17 UTC d79073922fcb8c8a0bd57112817a2154f1ed05c1
2 files changed +17 -4
Documentation/Makefile
+5 -2
@@ -85,14 +85,17 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
85 cmds-purehelpers.txt \
86 cmds-foreignscminterface.txt
87
88 -$(cmds_txt): cmd-list.perl $(MAN1_TXT)
88 +$(cmds_txt): cmd-list.made
89 +
90 +cmd-list.made: cmd-list.perl $(MAN1_TXT)
91 perl ./cmd-list.perl
92 + date >$@
93
94 git.7 git.html: git.txt core-intro.txt
95
96 clean:
97 rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep
95 - rm -f $(cmds_txt)
98 + rm -f $(cmds_txt) *.made
99
100 %.html : %.txt
101 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $<
Documentation/cmd-list.perl
+12 -2
@@ -1,8 +1,11 @@
1 -#
1 +#!/usr/bin/perl -w
2 +
3 +use File::Compare qw(compare);
4
5 sub format_one {
6 my ($out, $name) = @_;
7 my ($state, $description);
8 + $state = 0;
9 open I, '<', "$name.txt" or die "No such file $name.txt";
10 while (<I>) {
11 if (/^NAME$/) {
@@ -55,7 +58,14 @@ for my $cat (qw(ancillaryinterrogators
58 format_one(\*O, $_);
59 }
60 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 + }
69 }
70
71 __DATA__