summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-03-06 00:05:33 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-03-06 00:05:33 +0000
commit1167b403e65cbf6bf9e8b4fc27e212e2c913d717 (patch)
treee9269b4c031cf89bafdc5f3d4236d1de72828e3f
parentdb7986cf0e79728a16650ea6238ed99e98a2fa53 (diff)
downloadrockbox-1167b403e65cbf6bf9e8b4fc27e212e2c913d717.tar.gz
rockbox-1167b403e65cbf6bf9e8b4fc27e212e2c913d717.zip
first shot at a perl script that generates the dependencies for the .elf files
that are the plugins. Not used by anything just yet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6149 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/elfdep.pl48
1 files changed, 48 insertions, 0 deletions
diff --git a/apps/plugins/elfdep.pl b/apps/plugins/elfdep.pl
new file mode 100644
index 0000000000..0e32852b3d
--- /dev/null
+++ b/apps/plugins/elfdep.pl
@@ -0,0 +1,48 @@
1#!/usr/bin/perl
2
3sub getdir {
4 my ($some_dir, $files)=@_;
5 opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
6 my @all = grep { /$files$/ && -f "$some_dir/$_" } readdir(DIR);
7 closedir DIR;
8 return @all;
9}
10
11my @all=getdir(".", "\.c");
12my @pluginhead=getdir("lib", "\.h");
13
14for(@pluginhead) {
15 $plug{$_}=$_;
16}
17
18my %head2lib=('Tremor' => 'libTremor');
19
20my $s;
21foreach $s (sort @all) {
22
23 my $plib=0;
24 my $codec;
25 open(F, "<$s");
26 while(<F>) {
27 if($_ =~ /^ *\#include [\"<]([^\"]+)[\">]/) {
28 my $f = $1;
29 if($plug{$f}) {
30 $plib=1;
31 }
32 if($f =~ /codecs\/([^\/]+)/) {
33 $codec=$1;
34 my $d = $head2lib{$codec};
35 if($d) {
36 $codec = $d;
37 }
38 }
39 }
40 }
41
42 #print "$s uses $plib and $codec\n";
43
44 $s =~ s/\.c//;
45 printf("\$(OBJDIR)/$s.elf: \$(OBJDIR)/$s.o \$(LINKFILE)%s%s\n\t\$(ELFIT)\n\n",
46 $plib?" \$(OBJDIR)/libplugin.a":"",
47 $codec?" \$(OBJDIR)/$codec.a":"");
48}