Files
moslab-code/src/fiasco/tool/parsedeps
2025-09-12 15:55:45 +02:00

47 lines
712 B
Perl
Executable File

#!/usr/bin/env perl
use strict;
use warnings;
$, = ' '; # set output field separator
$\ = "\n"; # set output record separator
my $doit = 1;
my @input = <>;
$_ = join '', @input;
s/\\\n//sg; # delete continuations
record:
foreach my $record (split /\n/) {
next if $record =~ /^$/;
my @stuff = split /\s+/, $record;
line:
while ($_ = shift @stuff) {
chomp; # strip record separator
if (/^else$/) {
$doit = 1;
next line;
}
if (/^endif$/) {
print "";
$doit = 0;
}
if ($doit) {
/:/ && ! m|^[^/]+\.o:$| && next record;
/Makefile/ && next line;
/auto\// || /:/ || next line;
print $_." \\";
}
}
print "";
}