tools: Improve dbdExpand.pl error/warning message

Missing files used to result in an empty output file.
Now it warns instead of dying, and suggests adding a
dependency to the Makefile.
This commit is contained in:
Andrew Johnson
2013-10-14 12:43:26 -05:00
parent 34267b31b7
commit 91ef05b5dc
+18 -1
View File
@@ -26,8 +26,25 @@ my @path = map { split /[:;]/ } @opt_I; # FIXME: Broken on Win32?
my $macros = EPICS::macLib->new(@opt_S);
my $dbd = DBD->new();
# Calculate filename for the dependency warning message below
my $dep = $opt_o;
if ($opt_D) {
$dep =~ s{\.\./O\.Common/(.*)}{\1\$\(DEP\)};
} else {
$dep = "\$(COMMON_DIR)/$dep";
}
while (@ARGV) {
&ParseDBD($dbd, &Readfile(shift @ARGV, $macros, \@opt_I));
my $file = shift @ARGV;
eval {
&ParseDBD($dbd, &Readfile($file, $macros, \@opt_I));
};
if ($@) {
warn "dbdExpand: $@";
warn " Your Makefile may need this dependency rule:\n" .
" $dep: \$(COMMON_DIR)/$file\n"
if $@ =~ m/Can't find file/;
}
}
if ($opt_D) { # Output dependencies only