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:
parent
672b8b6375
commit
541072ae5d
2 changed files with 23 additions and 30 deletions
|
@ -14,30 +14,28 @@ use File::Basename;
|
||||||
|
|
||||||
my $rbroot = $ARGV[0];
|
my $rbroot = $ARGV[0];
|
||||||
my $builddir = $ARGV[1];
|
my $builddir = $ARGV[1];
|
||||||
|
undef $/;
|
||||||
|
|
||||||
my $target2;
|
my $target;
|
||||||
|
my $rootlen = length $rbroot;
|
||||||
|
my $src;
|
||||||
|
|
||||||
for (<STDIN>) {
|
# Split the input file on any runs of '\' and whitespace.
|
||||||
if (/^([^:]+): (\S+) (.*)/) {
|
for (split(/[\s\\]+/m, <STDIN>)) {
|
||||||
my ($target, $src, $rest) = ($1, $2, $3);
|
/^(\/)?[^:]+(\:)?$/;
|
||||||
my $dir = dirname $src;
|
# Save target and continue if this item ends in ':'
|
||||||
$dir =~ s/^.*$rbroot//;
|
if (!($2 && ($target=$&))) {
|
||||||
print "$builddir$dir/$target: $src $rest\n";
|
$src = $&;
|
||||||
}
|
# If $target is set, prefix it with the target path
|
||||||
elsif (/^([^:]+): \\/) {
|
if ($target) {
|
||||||
# target and source on different lines
|
|
||||||
$target2 = $1;
|
|
||||||
}
|
|
||||||
elsif ($target2) {
|
|
||||||
if (/^\s+([^ ]+) (.*)/) {
|
|
||||||
my ($src, $rest) = ($1, $2);
|
|
||||||
my $dir = dirname $src;
|
my $dir = dirname $src;
|
||||||
$dir =~ s/^.*$rbroot//;
|
substr($dir, 0, $rootlen) = $builddir;
|
||||||
print "$builddir$dir/$target2: $src $rest\n";
|
print "\n$dir/$target";
|
||||||
$target2 = "";
|
$target = "";
|
||||||
|
# Otherwise, check for an incomplete path for the source file
|
||||||
|
} elsif (!$1) {
|
||||||
|
$src = "$builddir/$src";
|
||||||
}
|
}
|
||||||
}
|
print " \\\n $src";
|
||||||
else {
|
|
||||||
print $_;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,17 +28,12 @@ preprocess2file = $(shell $(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(
|
||||||
c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1))))
|
c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1))))
|
||||||
|
|
||||||
# calculate dependencies for a list of source files $(2) and output them
|
# 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 \
|
mkdepfile = $(shell \
|
||||||
$(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h $(2) | \
|
$(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h $(2) | \
|
||||||
$(TOOLSDIR)/addtargetdir.pl $(ROOTDIR) $(BUILDDIR) | \
|
sed -e "s: lang.h: lang/lang_core.o:" \
|
||||||
sed -e "s: lang.h: $(BUILDDIR)/lang/lang_core.o:" \
|
-e "s: max_language_size.h: lang/max_language_size.h:" | \
|
||||||
-e "s: sysfont.h: $(BUILDDIR)/sysfont.h:" \
|
$(TOOLSDIR)/addtargetdir.pl $(ROOTDIR) $(BUILDDIR) \
|
||||||
-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" \
|
|
||||||
>> $(1)_)
|
>> $(1)_)
|
||||||
|
|
||||||
# function to create .bmp dependencies
|
# function to create .bmp dependencies
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue