1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Andrew Mahone 2009-07-12 22:02:09 +00:00
parent 672b8b6375
commit 541072ae5d
2 changed files with 23 additions and 30 deletions

View file

@ -14,30 +14,28 @@ use File::Basename;
my $rbroot = $ARGV[0];
my $builddir = $ARGV[1];
undef $/;
my $target2;
my $target;
my $rootlen = length $rbroot;
my $src;
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";
}
elsif (/^([^:]+): \\/) {
# target and source on different lines
$target2 = $1;
}
elsif ($target2) {
if (/^\s+([^ ]+) (.*)/) {
my ($src, $rest) = ($1, $2);
# Split the input file on any runs of '\' and whitespace.
for (split(/[\s\\]+/m, <STDIN>)) {
/^(\/)?[^:]+(\:)?$/;
# Save target and continue if this item ends in ':'
if (!($2 && ($target=$&))) {
$src = $&;
# If $target is set, prefix it with the target path
if ($target) {
my $dir = dirname $src;
$dir =~ s/^.*$rbroot//;
print "$builddir$dir/$target2: $src $rest\n";
$target2 = "";
substr($dir, 0, $rootlen) = $builddir;
print "\n$dir/$target";
$target = "";
# Otherwise, check for an incomplete path for the source file
} elsif (!$1) {
$src = "$builddir/$src";
}
}
else {
print $_;
print " \\\n $src";
}
}

View file

@ -28,17 +28,12 @@ preprocess2file = $(shell $(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(
c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1))))
# calculate dependencies for a list of source files $(2) and output them
# to a file $(1)
# to a file $(1)_, to be later renamed to $(1).
mkdepfile = $(shell \
$(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h $(2) | \
$(TOOLSDIR)/addtargetdir.pl $(ROOTDIR) $(BUILDDIR) | \
sed -e "s: lang.h: $(BUILDDIR)/lang/lang_core.o:" \
-e "s: sysfont.h: $(BUILDDIR)/sysfont.h:" \
-e "s: max_language_size.h: $(BUILDDIR)/lang/max_language_size.h:" \
-e "s: bitmaps/: $(BUILDDIR)/bitmaps/:g" \
-e "s: pluginbitmaps/: $(BUILDDIR)/pluginbitmaps/:g" \
-e "s: lib/: $(APPSDIR)/plugins/lib/:g" \
-e "s: codeclib.h: $(APPSDIR)/codecs/lib/codeclib.h:g" \
sed -e "s: lang.h: lang/lang_core.o:" \
-e "s: max_language_size.h: lang/max_language_size.h:" | \
$(TOOLSDIR)/addtargetdir.pl $(ROOTDIR) $(BUILDDIR) \
>> $(1)_)
# function to create .bmp dependencies