]> git.sesse.net Git - ffmpeg/blob - doc/texidep.pl
doc: add script to compute texi files dependencies
[ffmpeg] / doc / texidep.pl
1 #! /usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 my ($root, $target) = @ARGV;
7
8 sub print_deps {
9     my ($file, $deps) = @_;
10     $deps->{$file} = 1;
11
12     open(my $fh, "$file") or die "Cannot open file '$file': $!";
13     while (<$fh>) {
14         /^@(?:verbatim)?include\s+(\S+)/ and do {
15             die "Circular dependency found in file $root\n" if exists $deps->{"doc/$1"};
16             print "$target: doc/$1\n";
17             print_deps("doc/$1", {%$deps});
18         }
19     }
20 }
21
22 print_deps($root, {});