diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-06-04 08:26:27 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2019-06-07 13:33:16 -0400 |
commit | b1663d7e3a7961fc45262fd68a89253f2803036c (patch) | |
tree | e7e424e2d6bf9b53d846db99d421c19ffb1042ec | |
parent | 3f9564e680efb2092dfb826e2f768920c9eb203b (diff) |
docs: Kbuild/Makefile: allow check for missing docs at build time
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>
-rw-r--r-- | Documentation/Kconfig | 13 | ||||
-rw-r--r-- | Documentation/Makefile | 5 | ||||
-rw-r--r-- | Kconfig | 2 | ||||
-rwxr-xr-x | scripts/documentation-file-ref-check | 9 |
4 files changed, 29 insertions, 0 deletions
diff --git a/Documentation/Kconfig b/Documentation/Kconfig new file mode 100644 index 000000000000..66046fa1c341 --- /dev/null +++ b/Documentation/Kconfig | |||
@@ -0,0 +1,13 @@ | |||
1 | config WARN_MISSING_DOCUMENTS | ||
2 | |||
3 | bool "Warn if there's a missing documentation file" | ||
4 | depends on COMPILE_TEST | ||
5 | help | ||
6 | It is not uncommon that a document gets renamed. | ||
7 | This option makes the Kernel to check for missing dependencies, | ||
8 | warning when something is missing. Works only if the Kernel | ||
9 | is built from a git tree. | ||
10 | |||
11 | If unsure, select 'N'. | ||
12 | |||
13 | |||
diff --git a/Documentation/Makefile b/Documentation/Makefile index 2df0789f90b7..e145e4db508b 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile | |||
@@ -4,6 +4,11 @@ | |||
4 | 4 | ||
5 | subdir-y := devicetree/bindings/ | 5 | subdir-y := devicetree/bindings/ |
6 | 6 | ||
7 | # Check for broken documentation file references | ||
8 | ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y) | ||
9 | $(shell $(srctree)/scripts/documentation-file-ref-check --warn) | ||
10 | endif | ||
11 | |||
7 | # You can set these variables from the command line. | 12 | # You can set these variables from the command line. |
8 | SPHINXBUILD = sphinx-build | 13 | SPHINXBUILD = sphinx-build |
9 | SPHINXOPTS = | 14 | SPHINXOPTS = |
@@ -30,3 +30,5 @@ source "crypto/Kconfig" | |||
30 | source "lib/Kconfig" | 30 | source "lib/Kconfig" |
31 | 31 | ||
32 | source "lib/Kconfig.debug" | 32 | source "lib/Kconfig.debug" |
33 | |||
34 | source "Documentation/Kconfig" | ||
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check index ff16db269079..440227bb55a9 100755 --- a/scripts/documentation-file-ref-check +++ b/scripts/documentation-file-ref-check | |||
@@ -22,9 +22,16 @@ $scriptname =~ s,.*/([^/]+/),$1,; | |||
22 | # Parse arguments | 22 | # Parse arguments |
23 | my $help = 0; | 23 | my $help = 0; |
24 | my $fix = 0; | 24 | my $fix = 0; |
25 | my $warn = 0; | ||
26 | |||
27 | if (! -d ".git") { | ||
28 | printf "Warning: can't check if file exists, as this is not a git tree"; | ||
29 | exit 0; | ||
30 | } | ||
25 | 31 | ||
26 | GetOptions( | 32 | GetOptions( |
27 | 'fix' => \$fix, | 33 | 'fix' => \$fix, |
34 | 'warn' => \$warn, | ||
28 | 'h|help|usage' => \$help, | 35 | 'h|help|usage' => \$help, |
29 | ); | 36 | ); |
30 | 37 | ||
@@ -139,6 +146,8 @@ while (<IN>) { | |||
139 | if (!($ref =~ m/(scripts|Kconfig|Kbuild)/)) { | 146 | if (!($ref =~ m/(scripts|Kconfig|Kbuild)/)) { |
140 | $broken_ref{$ref}++; | 147 | $broken_ref{$ref}++; |
141 | } | 148 | } |
149 | } elsif ($warn) { | ||
150 | print STDERR "Warning: $f references a file that doesn't exist: $fulref\n"; | ||
142 | } else { | 151 | } else { |
143 | print STDERR "$f: $fulref\n"; | 152 | print STDERR "$f: $fulref\n"; |
144 | } | 153 | } |