Browse Source

Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
  export_report: use warn() to issue WARNING, so they go to stderr
  export_report: sort SECTION 2 output
  export_report: do collectcfiles work in perl itself
  kbuild: make versioncheck work in KBUILD_OUTDIR
  kbuild: make includecheck work in KBUILD_OUTDIR
  kbuild: make headerdep work in KBUILD_OUTDIR
  kbuild: add targets to PHONY
  kbuild: don't warn about include/linux/version.h not including itself
  eradicate bashisms in scripts/patch-kernel
Linus Torvalds 14 years ago
parent
commit
51b550a41c
4 changed files with 28 additions and 10 deletions
  1. 6 3
      Makefile
  2. 1 0
      scripts/checkversion.pl
  3. 20 6
      scripts/export_report.pl
  4. 1 1
      scripts/patch-kernel

+ 6 - 3
Makefile

@@ -1009,7 +1009,8 @@ include/generated/utsrelease.h: include/config/kernel.release FORCE
 
 
 PHONY += headerdep
 PHONY += headerdep
 headerdep:
 headerdep:
-	$(Q)find include/ -name '*.h' | xargs --max-args 1 scripts/headerdep.pl
+	$(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
+	$(srctree)/scripts/headerdep.pl -I$(srctree)/include
 
 
 # ---------------------------------------------------------------------------
 # ---------------------------------------------------------------------------
 
 
@@ -1417,13 +1418,15 @@ tags TAGS cscope gtags: FORCE
 # Scripts to check various things for consistency
 # Scripts to check various things for consistency
 # ---------------------------------------------------------------------------
 # ---------------------------------------------------------------------------
 
 
+PHONY += includecheck versioncheck coccicheck namespacecheck export_report
+
 includecheck:
 includecheck:
-	find * $(RCS_FIND_IGNORE) \
+	find $(srctree)/* $(RCS_FIND_IGNORE) \
 		-name '*.[hcS]' -type f -print | sort \
 		-name '*.[hcS]' -type f -print | sort \
 		| xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
 		| xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
 
 
 versioncheck:
 versioncheck:
-	find * $(RCS_FIND_IGNORE) \
+	find $(srctree)/* $(RCS_FIND_IGNORE) \
 		-name '*.[hcS]' -type f -print | sort \
 		-name '*.[hcS]' -type f -print | sort \
 		| xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
 		| xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
 
 

+ 1 - 0
scripts/checkversion.pl

@@ -12,6 +12,7 @@ $| = 1;
 my $debugging;
 my $debugging;
 
 
 foreach my $file (@ARGV) {
 foreach my $file (@ARGV) {
+    next if $file =~ "include/linux/version\.h";
     # Open this file.
     # Open this file.
     open( my $f, '<', $file )
     open( my $f, '<', $file )
       or die "Can't open $file: $!\n";
       or die "Can't open $file: $!\n";

+ 20 - 6
scripts/export_report.pl

@@ -25,11 +25,12 @@ sub alphabetically {
 sub print_depends_on {
 sub print_depends_on {
 	my ($href) = @_;
 	my ($href) = @_;
 	print "\n";
 	print "\n";
-	while (my ($mod, $list) = each %$href) {
+	for my $mod (sort keys %$href) {
+		my $list = $href->{$mod};
 		print "\t$mod:\n";
 		print "\t$mod:\n";
 		foreach my $sym (sort numerically @{$list}) {
 		foreach my $sym (sort numerically @{$list}) {
 			my ($symbol, $no) = split /\s+/, $sym;
 			my ($symbol, $no) = split /\s+/, $sym;
-			printf("\t\t%-25s\t%-25d\n", $symbol, $no);
+			printf("\t\t%-25s\n", $symbol);
 		}
 		}
 		print "\n";
 		print "\n";
 	}
 	}
@@ -49,8 +50,14 @@ sub usage {
 }
 }
 
 
 sub collectcfiles {
 sub collectcfiles {
-    my @file
-	= `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`;
+    my @file;
+    while (<.tmp_versions/*.mod>) {
+	open my $fh, '<', $_ or die "cannot open $_: $!\n";
+	push (@file,
+	      grep s/\.ko/.mod.c/,	# change the suffix
+	      grep m/.+\.ko/,		# find the .ko path
+	      <$fh>);			# lines in opened file
+    }
     chomp @file;
     chomp @file;
     return @file;
     return @file;
 }
 }
@@ -95,6 +102,8 @@ close($module_symvers);
 #
 #
 # collect the usage count of each symbol.
 # collect the usage count of each symbol.
 #
 #
+my $modversion_warnings = 0;
+
 foreach my $thismod (@allcfiles) {
 foreach my $thismod (@allcfiles) {
 	my $module;
 	my $module;
 
 
@@ -125,7 +134,8 @@ foreach my $thismod (@allcfiles) {
 		}
 		}
 	}
 	}
 	if ($state != 2) {
 	if ($state != 2) {
-		print "WARNING:$thismod is not built with CONFIG_MODVERSION enabled\n";
+		warn "WARNING:$thismod is not built with CONFIG_MODVERSIONS enabled\n";
+		$modversion_warnings++;
 	}
 	}
 	close($module);
 	close($module);
 }
 }
@@ -159,8 +169,12 @@ printf("SECTION 2:\n\tThis section reports export-symbol-usage of in-kernel
 modules. Each module lists the modules, and the symbols from that module that
 modules. Each module lists the modules, and the symbols from that module that
 it uses.  Each listed symbol reports the number of modules using it\n");
 it uses.  Each listed symbol reports the number of modules using it\n");
 
 
+print "\nNOTE: Got $modversion_warnings CONFIG_MODVERSIONS warnings\n\n"
+    if $modversion_warnings;
+
 print "~"x80 , "\n";
 print "~"x80 , "\n";
-while (my ($thismod, $list) = each %MODULE) {
+for my $thismod (sort keys %MODULE) {
+	my $list = $MODULE{$thismod};
 	my %depends;
 	my %depends;
 	$thismod =~ s/\.mod\.c/.ko/;
 	$thismod =~ s/\.mod\.c/.ko/;
 	print "\t\t\t$thismod\n";
 	print "\t\t\t$thismod\n";

+ 1 - 1
scripts/patch-kernel

@@ -250,7 +250,7 @@ while :				# incrementing SUBLEVEL (s in v.p.s)
 do
 do
     CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
     CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
     EXTRAVER=
     EXTRAVER=
-    if [ $STOPFULLVERSION = $CURRENTFULLVERSION ]; then
+    if [ x$STOPFULLVERSION = x$CURRENTFULLVERSION ]; then
         echo "Stopping at $CURRENTFULLVERSION base as requested."
         echo "Stopping at $CURRENTFULLVERSION base as requested."
         break
         break
     fi
     fi