You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
494B

  1. #! /usr/bin/perl
  2. use warnings;
  3. use strict;
  4. my ($root, $target) = @ARGV;
  5. sub print_deps {
  6. my ($file, $deps) = @_;
  7. $deps->{$file} = 1;
  8. open(my $fh, "$file") or die "Cannot open file '$file': $!";
  9. while (<$fh>) {
  10. /^@(?:verbatim)?include\s+(\S+)/ and do {
  11. die "Circular dependency found in file $root\n" if exists $deps->{"doc/$1"};
  12. print "$target: doc/$1\n";
  13. print_deps("doc/$1", {%$deps});
  14. }
  15. }
  16. }
  17. print_deps($root, {});