diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-10-03 15:39:25 -0700 |
---|---|---|
committer | Trent Piepho <xyzzy@speakeasy.org> | 2007-10-03 15:39:25 -0700 |
commit | 01dae6cd40b3b47dfd2b70868fca713fadb8eb31 (patch) | |
tree | 9cb0c2a9de8023d890ef06d35f56bcff9ead1288 /v4l/scripts/make_makefile.pl | |
parent | 625ecf1f1257810d3496d143c3016e051269294d (diff) | |
download | mediapointer-dvb-s2-01dae6cd40b3b47dfd2b70868fca713fadb8eb31.tar.gz mediapointer-dvb-s2-01dae6cd40b3b47dfd2b70868fca713fadb8eb31.tar.bz2 |
build: clean up some ugly perl code
From: Trent Piepho <xyzzy@speakeasy.org>
Much better now. Also handles some more error conditions and prints a bit
more information.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Diffstat (limited to 'v4l/scripts/make_makefile.pl')
-rwxr-xr-x | v4l/scripts/make_makefile.pl | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index 709546fca..82821b43b 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -124,38 +124,27 @@ sub open_makefile($) { close $in; } -my $obsolete; +my %obsolete; sub getobsolete() { - open OBSOLETE, "<obsolete.txt"; - while (<OBSOLETE>) { - if (m/^\s*\#/) { - next; - } - s/\s*\#.*$//; - s/\n$//; - - my $idir=$_; - - if (!$idir) { - next; + open OBSOLETE, '<obsolete.txt' or die "Can't open obsolete.txt: $!"; + while (<OBSOLETE>) { + next if (/^\s*#/ || /^\s*$/); + chomp; + if (m|^(.*)/([^/]*)$|) { + $obsolete{$1}{"$2.ko"} = 1; + } else { + print "Unable to parse obsolete.txt:$.\n$_\n"; } - my $file=$_; - - $idir=~ s|(^.*)/[^/]+|\1|; - $file=~ s|^.*/||; - $file.=".ko"; - - $obsolete{$idir}{$file} = 1; - } + } - close OBSOLETE; + close OBSOLETE; } sub removeobsolete() { while ( my ($dir, $files) = each(%obsolete) ) { - print OUT "\t\@echo -e \"\\nRemoving obsolete files at \$(KDIR26)/$dir:\"\n"; + print OUT "\t\@echo -e \"\\nRemoving obsolete files from \$(KDIR26)/$dir:\"\n"; print OUT "\t\@files='", join(' ', keys %$files), "'; "; print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i ]; then "; @@ -219,6 +208,7 @@ while ( my ($dir, $files) = each(%instdir) ) { # Print dependencies of Makefile.media print OUT "Makefile.media: ../linux/drivers/media/Makefile \\\n"; +print OUT "\tobsolete.txt \\\n"; print OUT join(" \\\n", map("\t../linux/drivers/media/$_/Makefile", keys %instdir)); print OUT "\n"; close OUT; |