diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-18 07:30:07 -0500 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2017-12-21 15:41:46 -0500 |
commit | 93626d7a76e3aa854bb116f5894322e121cd84b1 (patch) | |
tree | 4bb68962d4a1513e4adc04b82dd9876dba024525 | |
parent | bdb76f9e305a45a7a1f0073a4b3a0fae9900bf97 (diff) |
docs: kernel-doc.rst: add documentation about man pages
kernel-doc-nano-HOWTO.txt has a chapter about man pages
production. While we don't have a working "make manpages"
target, add it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rw-r--r-- | Documentation/doc-guide/kernel-doc.rst | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Documentation/doc-guide/kernel-doc.rst b/Documentation/doc-guide/kernel-doc.rst index b178857866f8..14c226e8154f 100644 --- a/Documentation/doc-guide/kernel-doc.rst +++ b/Documentation/doc-guide/kernel-doc.rst | |||
@@ -452,3 +452,37 @@ file. | |||
452 | 452 | ||
453 | Data structures visible in kernel include files should also be documented using | 453 | Data structures visible in kernel include files should also be documented using |
454 | kernel-doc formatted comments. | 454 | kernel-doc formatted comments. |
455 | |||
456 | How to use kernel-doc to generate man pages | ||
457 | ------------------------------------------- | ||
458 | |||
459 | If you just want to use kernel-doc to generate man pages you can do this | ||
460 | from the Kernel git tree:: | ||
461 | |||
462 | $ scripts/kernel-doc -man $(git grep -l '/\*\*' |grep -v Documentation/) | ./split-man.pl /tmp/man | ||
463 | |||
464 | Using the small ``split-man.pl`` script below:: | ||
465 | |||
466 | |||
467 | #!/usr/bin/perl | ||
468 | |||
469 | if ($#ARGV < 0) { | ||
470 | die "where do I put the results?\n"; | ||
471 | } | ||
472 | |||
473 | mkdir $ARGV[0],0777; | ||
474 | $state = 0; | ||
475 | while (<STDIN>) { | ||
476 | if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) { | ||
477 | if ($state == 1) { close OUT } | ||
478 | $state = 1; | ||
479 | $fn = "$ARGV[0]/$1.9"; | ||
480 | print STDERR "Creating $fn\n"; | ||
481 | open OUT, ">$fn" or die "can't open $fn: $!\n"; | ||
482 | print OUT $_; | ||
483 | } elsif ($state != 0) { | ||
484 | print OUT $_; | ||
485 | } | ||
486 | } | ||
487 | |||
488 | close OUT; | ||