Documentation: tighten dependency for git.{html,txt}
authorJunio C Hamano <junkio@cox.net>
Fri, 6 Apr 2007 05:17:20 +0000 (22:17 -0700)
committerJunio C Hamano <junkio@cox.net>
Sat, 7 Apr 2007 04:29:16 +0000 (21:29 -0700)
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>
Documentation/Makefile
Documentation/cmd-list.perl
index 7db3fb992f2dccc09ee36281c6f4726ab322cb40..ad87736b0c0fbbaf6d2271fd66148f9e483c57bd 100644 (file)
@@ -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) $<
index b54382b2bfdfc7926af8c4b0552f82235619f1c6..0381590d383c4fffbf04895be4c47e407dd94e80 100755 (executable)
@@ -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$/) {
@@ -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__