docs: Kbuild/Makefile: allow check for missing docs at build time
[linux-2.6-block.git] / scripts / documentation-file-ref-check
index ff16db2690793ea43ac7fe06e7c971121b3bfab8..440227bb55a943d71ec177a3f5f027bdc143b15a 100755 (executable)
@@ -22,9 +22,16 @@ $scriptname =~ s,.*/([^/]+/),$1,;
 # Parse arguments
 my $help = 0;
 my $fix = 0;
+my $warn = 0;
+
+if (! -d ".git") {
+       printf "Warning: can't check if file exists, as this is not a git tree";
+       exit 0;
+}
 
 GetOptions(
        'fix' => \$fix,
+       'warn' => \$warn,
        'h|help|usage' => \$help,
 );
 
@@ -139,6 +146,8 @@ while (<IN>) {
                        if (!($ref =~ m/(scripts|Kconfig|Kbuild)/)) {
                                $broken_ref{$ref}++;
                        }
+               } elsif ($warn) {
+                       print STDERR "Warning: $f references a file that doesn't exist: $fulref\n";
                } else {
                        print STDERR "$f: $fulref\n";
                }