2008-11-21 15:07:15 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
2008-11-25 19:54:23 +00:00
|
|
|
# $Id$
|
2008-11-21 15:07:15 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# addtargetdir.pl - Adds target directory to gcc-generated dependency data
|
|
|
|
|
|
|
|
use File::Basename;
|
|
|
|
|
|
|
|
my $rbroot = $ARGV[0];
|
|
|
|
my $builddir = $ARGV[1];
|
|
|
|
|
2008-11-22 23:04:15 +00:00
|
|
|
my $target2;
|
|
|
|
|
2008-11-21 15:07:15 +00:00
|
|
|
for (<STDIN>) {
|
|
|
|
if (/^([^:]+): (\S+) (.*)/) {
|
|
|
|
my ($target, $src, $rest) = ($1, $2, $3);
|
|
|
|
my $dir = dirname $src;
|
|
|
|
$dir =~ s/$rbroot//;
|
|
|
|
print "$builddir$dir/$target: $src $rest\n";
|
|
|
|
}
|
2008-11-22 23:04:15 +00:00
|
|
|
elsif (/^([^:]+): \\/) {
|
|
|
|
# target and source on different lines
|
|
|
|
$target2 = $1;
|
|
|
|
}
|
|
|
|
elsif ($target2) {
|
|
|
|
if (/^\s+([^ ]+) (.*)/) {
|
|
|
|
my ($src, $rest) = ($1, $2);
|
|
|
|
my $dir = dirname $src;
|
|
|
|
$dir =~ s/$rbroot//;
|
|
|
|
print "$builddir$dir/$target2: $src $rest\n";
|
|
|
|
$target2 = "";
|
|
|
|
}
|
|
|
|
}
|
2008-11-21 15:07:15 +00:00
|
|
|
else {
|
|
|
|
print $_;
|
|
|
|
}
|
|
|
|
}
|