]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
docs: Kbuild/Makefile: allow check for missing docs at build time
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 4 Jun 2019 12:26:27 +0000 (09:26 -0300)
committerJonathan Corbet <corbet@lwn.net>
Fri, 7 Jun 2019 17:33:16 +0000 (11:33 -0600)
While this doesn't make sense for production Kernels, in order to
avoid regressions when documents are touched, let's add a
check target at the make file.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Documentation/Kconfig [new file with mode: 0644]
Documentation/Makefile
Kconfig
scripts/documentation-file-ref-check

diff --git a/Documentation/Kconfig b/Documentation/Kconfig
new file mode 100644 (file)
index 0000000..66046fa
--- /dev/null
@@ -0,0 +1,13 @@
+config WARN_MISSING_DOCUMENTS
+
+       bool "Warn if there's a missing documentation file"
+       depends on COMPILE_TEST
+       help
+          It is not uncommon that a document gets renamed.
+          This option makes the Kernel to check for missing dependencies,
+          warning when something is missing. Works only if the Kernel
+          is built from a git tree.
+
+          If unsure, select 'N'.
+
+
index 2df0789f90b7ad116e9ec0aef8fc8f703b3afc86..e145e4db508bc6a45ed598f0cb3564893d0bc026 100644 (file)
@@ -4,6 +4,11 @@
 
 subdir-y := devicetree/bindings/
 
+# Check for broken documentation file references
+ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y)
+$(shell $(srctree)/scripts/documentation-file-ref-check --warn)
+endif
+
 # You can set these variables from the command line.
 SPHINXBUILD   = sphinx-build
 SPHINXOPTS    =
diff --git a/Kconfig b/Kconfig
index 48a80beab6853d1461f277229625aa066d75a4e7..990b0c390dfcdd44d50aef58411b620e64e4ca41 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -30,3 +30,5 @@ source "crypto/Kconfig"
 source "lib/Kconfig"
 
 source "lib/Kconfig.debug"
+
+source "Documentation/Kconfig"
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";
                }