summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-07-12 22:02:09 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-07-12 22:02:09 +0000
commit541072ae5db3c90061ded649b92507c488a8ad9f (patch)
treefbdfe7d34840a5e377fcc8420e5bf7f350e119d9
parent672b8b6375198f69c6260dd6e973c7e03c05ff0c (diff)
downloadrockbox-541072ae5db3c90061ded649b92507c488a8ad9f.tar.gz
rockbox-541072ae5db3c90061ded649b92507c488a8ad9f.zip
Rework addtargetdir.pl to also fix prefix generated-file depedencies with the target directory, and simplify the sed expression for mkdepfile.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21826 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xtools/addtargetdir.pl40
-rw-r--r--tools/functions.make13
2 files changed, 23 insertions, 30 deletions
diff --git a/tools/addtargetdir.pl b/tools/addtargetdir.pl
index 2c08d328dc..6a9a72a878 100755
--- a/tools/addtargetdir.pl
+++ b/tools/addtargetdir.pl
@@ -14,30 +14,28 @@ use File::Basename;
14 14
15my $rbroot = $ARGV[0]; 15my $rbroot = $ARGV[0];
16my $builddir = $ARGV[1]; 16my $builddir = $ARGV[1];
17undef $/;
17 18
18my $target2; 19my $target;
20my $rootlen = length $rbroot;
21my $src;
19 22
20for (<STDIN>) { 23# Split the input file on any runs of '\' and whitespace.
21 if (/^([^:]+): (\S+) (.*)/) { 24for (split(/[\s\\]+/m, <STDIN>)) {
22 my ($target, $src, $rest) = ($1, $2, $3); 25 /^(\/)?[^:]+(\:)?$/;
23 my $dir = dirname $src; 26# Save target and continue if this item ends in ':'
24 $dir =~ s/^.*$rbroot//; 27 if (!($2 && ($target=$&))) {
25 print "$builddir$dir/$target: $src $rest\n"; 28 $src = $&;
26 } 29# If $target is set, prefix it with the target path
27 elsif (/^([^:]+): \\/) { 30 if ($target) {
28 # target and source on different lines
29 $target2 = $1;
30 }
31 elsif ($target2) {
32 if (/^\s+([^ ]+) (.*)/) {
33 my ($src, $rest) = ($1, $2);
34 my $dir = dirname $src; 31 my $dir = dirname $src;
35 $dir =~ s/^.*$rbroot//; 32 substr($dir, 0, $rootlen) = $builddir;
36 print "$builddir$dir/$target2: $src $rest\n"; 33 print "\n$dir/$target";
37 $target2 = ""; 34 $target = "";
35# Otherwise, check for an incomplete path for the source file
36 } elsif (!$1) {
37 $src = "$builddir/$src";
38 } 38 }
39 } 39 print " \\\n $src";
40 else {
41 print $_;
42 } 40 }
43} 41}
diff --git a/tools/functions.make b/tools/functions.make
index 6748962d6a..66354ebc18 100644
--- a/tools/functions.make
+++ b/tools/functions.make
@@ -28,17 +28,12 @@ preprocess2file = $(shell $(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(
28c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1)))) 28c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1))))
29 29
30# calculate dependencies for a list of source files $(2) and output them 30# calculate dependencies for a list of source files $(2) and output them
31# to a file $(1) 31# to a file $(1)_, to be later renamed to $(1).
32mkdepfile = $(shell \ 32mkdepfile = $(shell \
33 $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h $(2) | \ 33 $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h $(2) | \
34 $(TOOLSDIR)/addtargetdir.pl $(ROOTDIR) $(BUILDDIR) | \ 34 sed -e "s: lang.h: lang/lang_core.o:" \
35 sed -e "s: lang.h: $(BUILDDIR)/lang/lang_core.o:" \ 35 -e "s: max_language_size.h: lang/max_language_size.h:" | \
36 -e "s: sysfont.h: $(BUILDDIR)/sysfont.h:" \ 36 $(TOOLSDIR)/addtargetdir.pl $(ROOTDIR) $(BUILDDIR) \
37 -e "s: max_language_size.h: $(BUILDDIR)/lang/max_language_size.h:" \
38 -e "s: bitmaps/: $(BUILDDIR)/bitmaps/:g" \
39 -e "s: pluginbitmaps/: $(BUILDDIR)/pluginbitmaps/:g" \
40 -e "s: lib/: $(APPSDIR)/plugins/lib/:g" \
41 -e "s: codeclib.h: $(APPSDIR)/codecs/lib/codeclib.h:g" \
42 >> $(1)_) 37 >> $(1)_)
43 38
44# function to create .bmp dependencies 39# function to create .bmp dependencies