Fix manual building.
[maemo-rb.git] / tools / addtargetdir.pl
blob2c08d328dcd0757850fcda468deca52deabf37fb
1 #!/usr/bin/perl
2 # __________ __ ___.
3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 # \/ \/ \/ \/ \/
8 # $Id$
11 # addtargetdir.pl - Adds target directory to gcc-generated dependency data
13 use File::Basename;
15 my $rbroot = $ARGV[0];
16 my $builddir = $ARGV[1];
18 my $target2;
20 for (<STDIN>) {
21 if (/^([^:]+): (\S+) (.*)/) {
22 my ($target, $src, $rest) = ($1, $2, $3);
23 my $dir = dirname $src;
24 $dir =~ s/^.*$rbroot//;
25 print "$builddir$dir/$target: $src $rest\n";
27 elsif (/^([^:]+): \\/) {
28 # target and source on different lines
29 $target2 = $1;
31 elsif ($target2) {
32 if (/^\s+([^ ]+) (.*)/) {
33 my ($src, $rest) = ($1, $2);
34 my $dir = dirname $src;
35 $dir =~ s/^.*$rbroot//;
36 print "$builddir$dir/$target2: $src $rest\n";
37 $target2 = "";
40 else {
41 print $_;