From 01dae6cd40b3b47dfd2b70868fca713fadb8eb31 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 3 Oct 2007 15:39:25 -0700 Subject: build: clean up some ugly perl code From: Trent Piepho Much better now. Also handles some more error conditions and prints a bit more information. Signed-off-by: Trent Piepho --- v4l/scripts/make_makefile.pl | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'v4l/scripts/make_makefile.pl') 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, ") { - if (m/^\s*\#/) { - next; - } - s/\s*\#.*$//; - s/\n$//; - - my $idir=$_; - - if (!$idir) { - next; + open 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; -- cgit v1.2.3