diff options
Diffstat (limited to 'Documentation/doc-guide')
-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; | ||