diff options
-rwxr-xr-x | tools/addtargetdir.pl | 40 | ||||
-rw-r--r-- | tools/functions.make | 13 |
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 | ||
15 | my $rbroot = $ARGV[0]; | 15 | my $rbroot = $ARGV[0]; |
16 | my $builddir = $ARGV[1]; | 16 | my $builddir = $ARGV[1]; |
17 | undef $/; | ||
17 | 18 | ||
18 | my $target2; | 19 | my $target; |
20 | my $rootlen = length $rbroot; | ||
21 | my $src; | ||
19 | 22 | ||
20 | for (<STDIN>) { | 23 | # Split the input file on any runs of '\' and whitespace. |
21 | if (/^([^:]+): (\S+) (.*)/) { | 24 | for (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 $( | |||
28 | c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1)))) | 28 | c2obj = $(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). |
32 | mkdepfile = $(shell \ | 32 | mkdepfile = $(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 |