Files
epics-base/src/tools/makeDbDepends.pl
Andrew Johnson 3bf5b21f57 tools: Improve makeDbDepends
Rewrite, add support for quotes around filenames in "file" statements.
2011-06-08 12:26:01 -05:00

25 lines
605 B
Perl

eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # makeDbDepends.pl
# Called from within RULES.Db in the Db directories.
# Searches .substitutions and .template files (from the command line) for
# file ["']xxx["'] {
# and
# include "xxx"
# entries to include in the DEPENDS file
use strict;
my $target = shift @ARGV;
my %depends;
while (my $line = <>) {
$depends{$2}++ if $line =~ m/^\s*file\s*(["']?)(.*)\1/;
$depends{$1}++ if $line =~ m/^\s*include\s+"(.*)"/;
}
if (%depends) {
my @depends = keys %depends;
print "$target: @depends\n";
}