[FFmpeg-devel] [PATCH] doc: add script to compute texi files dependencies

Stefano Sabatini stefasab at gmail.com
Tue May 28 22:32:09 CEST 2013


Replace the inline awk script with a Perl script which tracks the
dependencies recursively.

This allows to correctly track dependencies for files containing files
with a second level include (for example: ffmpeg-devices.texi ->
devices.texi -> outdevs.texi).
---
 doc/Makefile   |    2 +-
 doc/texidep.pl |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 doc/texidep.pl

diff --git a/doc/Makefile b/doc/Makefile
index cd24b8c..ab18146 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -43,7 +43,7 @@ doc: documentation
 apidoc: doc/doxy/html
 documentation: $(DOCS)
 
-TEXIDEP = awk '/^@(verbatim)?include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
+TEXIDEP = perl $(SRC_PATH)/doc/texidep.pl $< $@ >$(@:%=%.d)
 
 doc/%.txt: TAG = TXT
 doc/%.txt: doc/%.texi
diff --git a/doc/texidep.pl b/doc/texidep.pl
new file mode 100644
index 0000000..76b136d
--- /dev/null
+++ b/doc/texidep.pl
@@ -0,0 +1,20 @@
+#! /usr/bin/perl
+
+use warnings;
+use strict;
+
+my ($root, $target) = @ARGV;
+
+sub print_deps {
+    my ($file) = @_;
+
+    open(my $fh, "$file") or die "Cannot open file '$file': $!";
+    while (<$fh>) {
+        /^@(?:verbatim)?include\s+(\S+)/ and do {
+            print "$target: doc/$1\n";
+            print_deps("doc/$1");
+        }
+    }
+}
+
+print_deps($root);
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list