summaryrefslogtreecommitdiff
path: root/v4l/scripts/make_makefile.pl
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/scripts/make_makefile.pl')
-rwxr-xr-xv4l/scripts/make_makefile.pl54
1 files changed, 53 insertions, 1 deletions
diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl
index 8a31c025c..709546fca 100755
--- a/v4l/scripts/make_makefile.pl
+++ b/v4l/scripts/make_makefile.pl
@@ -124,6 +124,53 @@ sub open_makefile($) {
close $in;
}
+my $obsolete;
+sub getobsolete()
+{
+ open OBSOLETE, "<obsolete.txt";
+ while (<OBSOLETE>) {
+ if (m/^\s*\#/) {
+ next;
+ }
+ s/\s*\#.*$//;
+ s/\n$//;
+
+ my $idir=$_;
+
+ if (!$idir) {
+ next;
+ }
+ my $file=$_;
+
+ $idir=~ s|(^.*)/[^/]+|\1|;
+ $file=~ s|^.*/||;
+ $file.=".ko";
+
+ $obsolete{$idir}{$file} = 1;
+ }
+
+ 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\@files='", join(' ', keys %$files), "'; ";
+
+ print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i ]; then ";
+ print OUT "echo -n \"\$\$i \";";
+ print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i; fi; done; ";
+
+ print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz ]; then ";
+ print OUT "echo -n \"\$\$i.gz \";";
+ print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n";
+ }
+}
+
+
+getobsolete();
+
open OUT, '>Makefile.media' or die 'Unable to write Makefile.media';
open_makefile('../linux/drivers/media/Makefile');
@@ -131,6 +178,9 @@ open_makefile('../linux/drivers/media/Makefile');
print OUT "media-install::\n";
print OUT "\t\@echo \"Stripping debug info from files\"\n";
print OUT "\t\@strip --strip-debug \$(inst-m)\n\n";
+
+removeobsolete();
+
print OUT "\t\@echo \"Installing kernel modules under \$(DESTDIR)\$(KDIR26)/:\"\n";
while (my ($dir, $files) = each %instdir) {
@@ -150,8 +200,10 @@ print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b \$(DESTDIR))
# Creating Remove rule
print OUT "media-rminstall::\n";
-print OUT "\t\@echo -e \"\\nRemoving old \$(DEST) files\\n\"\n";
+removeobsolete();
+
+print OUT "\t\@echo -e \"\\nRemoving old \$(DEST) files\\n\"\n";
while ( my ($dir, $files) = each(%instdir) ) {
print OUT "\t\@echo -e \"\\nRemoving old \$(KDIR26)/$dir files:\"\n";
print OUT "\t\@files='", join(' ', keys %$files), "'; ";