mirror of
https://github.com/git/git
synced 2024-08-25 10:45:59 +00:00
Fix documentation dependency generation.
Documentation/Makefile spent a lot of time to generate include dependencies, which was quite noticeable especially during "make clean". Rewrite it to generate just a single dependency file. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
79f6ac77d9
commit
a5ae8e64cf
1
Documentation/.gitignore
vendored
1
Documentation/.gitignore
vendored
|
@ -3,3 +3,4 @@
|
|||
*.1
|
||||
*.7
|
||||
howto-index.txt
|
||||
doc.dep
|
||||
|
|
|
@ -53,21 +53,19 @@ install: man
|
|||
#
|
||||
# Determine "include::" file references in asciidoc files.
|
||||
#
|
||||
TEXTFILES = $(wildcard *.txt)
|
||||
DEPFILES = $(TEXTFILES:%.txt=%.dep)
|
||||
TEXTFILES = $(wildcard git-*.txt)
|
||||
doc.dep : $(TEXTFILES) build-docdep.perl
|
||||
rm -f $@+ $@
|
||||
perl ./build-docdep.perl >$@+
|
||||
mv $@+ $@
|
||||
|
||||
%.dep : %.txt
|
||||
@rm -f $@
|
||||
@$(foreach dep, $(shell grep include:: $< | sed -e 's/include::/ /' -e 's/\[\]//'), \
|
||||
echo $(<:%.txt=%.html) $(<:%.txt=%.1) : $(dep) >> $@; )
|
||||
|
||||
-include $(DEPFILES)
|
||||
-include doc.dep
|
||||
|
||||
git.7: ../README
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html *.dep
|
||||
rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep
|
||||
|
||||
%.html : %.txt
|
||||
asciidoc -b xhtml11 -d manpage -f asciidoc.conf $<
|
||||
|
|
28
Documentation/build-docdep.perl
Executable file
28
Documentation/build-docdep.perl
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
my %include = ();
|
||||
|
||||
for my $text (<git-*.txt>) {
|
||||
open I, '<', $text || die "cannot read: $text";
|
||||
(my $base = $text) =~ s/\.txt$//;
|
||||
while (<I>) {
|
||||
if (/^include::/) {
|
||||
chomp;
|
||||
s/^include::\s*//;
|
||||
s/\[\]//;
|
||||
$include{$base}{$_} = 1;
|
||||
}
|
||||
}
|
||||
close I;
|
||||
}
|
||||
|
||||
# Do we care about chained includes???
|
||||
|
||||
while (my ($base, $included) = each %include) {
|
||||
my ($suffix) = '1';
|
||||
if ($base eq 'git') {
|
||||
$suffix = '7'; # yuck...
|
||||
}
|
||||
print "$base.html $base.$suffix : ", join(" ", keys %$included), "\n";
|
||||
}
|
||||
|
Loading…
Reference in a new issue