10 my $firstfile = shift;
12 push @infiles, $firstfile;
14 push @included, $firstfile;
16 while (scalar @infiles) {
18 my $infile = pop @infiles;
21 open (my $handle, '<', $infile) or die "Can't open $infile";
22 push @lines, <$handle>;
25 for (grep {/#include\s.(\w+\.h)/} @lines) {
26 my ($checkfile) = /(\w+\.h)/;
28 if (-f "include/$checkfile" && ! grep {/include\/$checkfile/} @included) {
29 push @infiles, "include/$checkfile";
30 push @included, "include/$checkfile";
35 for (grep {/INCLUDE\s(treedefs\/\w+\.txt)/} @lines) {
36 my ($checkfile) = /(treedefs\/\w+\.txt)/;
38 if (-f $checkfile && ! grep {/$checkfile/} @included) {
39 push @infiles, $checkfile;
40 push @included, $checkfile;