{
my ($file, $var) = @_;
my $make = $makefiles{$file};
+ my $replaced = 0;
return unless defined ${$make}{"=$var"};
open OLD_FILE, "$file.in" or die "cannot open $file.in";
while (<OLD_FILE>)
{
- if (/^\s*($var\s+)=/)
+ if (/^\s*($var\s*)=/)
{
# try to preserve formatting
my $prefix = $1;
{
print NEW_FILE "$prefix= @values\n";
}
+ $replaced = 1;
next;
}
+ if (/^\@MAKE/ && !$replaced)
+ {
+ print NEW_FILE "$var = \\\n\t" . join(" \\\n\t", sort @values) . "\n";
+ }
print NEW_FILE $_;
}
close OLD_FILE;