[PATCH] generate man pages from kernel inline documentation

From: Christoph Hellwig (hch@caldera.de)
Date: Mon Aug 14 2000 - 11:28:07 EST


Hi Linus,
this patch adds generating man pages out of the kernel inline documentation
to the top-level Makefile. The split man script is a modified version
of the one in Tim Waugh's kernel-doc nano HOWTO.

I have changed follwoing things in kernel-doc and split-man:
 - man pages are now in section 9 instead of 4, beacause that's
   the right one for the internal kernel api.
 - made all man page sections uppercase
 - the section description ist now 'Kernel Hacker's Manual' which
   seems more consitant with the other man pages.

A little rule that is part of an earlier version of this patch has slipped into
Documentation/DocBook/Makefile lately. This patch will remove it.

        Christoph

P.S. make mandocs gives some error messages that can be safely ignored.

-- 
Always remember that you are unique.  Just like everyone else.

diff -uNr --exclude-from=exclude linux.orig/Documentation/DocBook/Makefile linux/Documentation/DocBook/Makefile --- linux.orig/Documentation/DocBook/Makefile Sun Aug 13 15:31:55 2000 +++ linux/Documentation/DocBook/Makefile Sun Aug 13 15:37:23 2000 @@ -81,11 +81,6 @@ $(TOPDIR)/scripts/docgen $(APISOURCES) \ <kernel-api.tmpl >kernel-api.sgml -kernel-api-man: $(APISOURCES) - @rm -rf $(TOPDIR)/Documentation/man - $(TOPDIR)/scripts/kernel-doc -man $^ | \ - $(PERL) $(TOPDIR)/scripts/split-man $(TOPDIR)/Documentation/man - parportbook: $(JPG-parportbook) parportbook.ps: $(EPS-parportbook) parportbook.sgml: parportbook.tmpl $(TOPDIR)/drivers/parport/init.c diff -uNr --exclude-from=exclude linux.orig/Makefile linux/Makefile --- linux.orig/Makefile Sun Aug 13 15:31:55 2000 +++ linux/Makefile Sun Aug 13 15:35:16 2000 @@ -40,6 +40,8 @@ CFLAGS_KERNEL = PERL = perl +MANDIR = /usr/local/share/man/en + export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS MODFLAGS PERL @@ -354,6 +356,10 @@ @exit 1 endif +man_install: mandocs + test -d $(MANDIR)/man9 || mkdir -p $(MANDIR)/man9 + cp $(TOPDIR)/Documentation/man/*.9 $(MANDIR)/man9 + clean: archclean rm -f kernel/ksyms.lst include/linux/compile.h find . -name '*.[oas]' -type f -print | grep -v lxdialog/ | xargs rm -f @@ -370,6 +376,7 @@ rm -f net/khttpd/times.h rm -f submenu* rm -rf modules + rm -rf Documentation/man $(MAKE) -C Documentation/DocBook clean mrproper: clean archmrproper @@ -421,6 +428,21 @@ htmldocs: sgmldocs $(MAKE) -C Documentation/DocBook html +mandocs: + @rm -rf $(TOPDIR)/Documentation/man + chmod 755 $(TOPDIR)/scripts/kernel-doc + chmod 755 $(TOPDIR)/scripts/split-man + ( \ + find include/asm-$(ARCH) -name '*.h' -print; \ + find $(SUBDIRS) init -name '*.c' -print; \ + find include -type d \( -name "asm-*" -o -name config \) \ + -prune -o -name '*.h' -print \ + ) | xargs $(TOPDIR)/scripts/kernel-doc | \ + $(TOPDIR)/scripts/split-man \ + $(TOPDIR)/Documentation/man + + + sums: find . -type f -print | sort | xargs sum > .SUMS diff -uNr --exclude-from=exclude linux.orig/scripts/kernel-doc linux/scripts/kernel-doc --- linux.orig/scripts/kernel-doc Wed Jul 5 21:56:01 2000 +++ linux/scripts/kernel-doc Sun Aug 13 15:35:16 2000 @@ -537,7 +537,7 @@ my ($parameter, $section); my $count; - print ".TH \"$args{'module'}\" 4 \"$args{'function'}\" \"25 May 1998\" \"API Manual\" LINUX\n"; + print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"25 May 1998\" \"Kernel Hacker's Manual\" LINUX\n"; print ".SH NAME\n"; print $args{'function'}." \\- ".$args{'purpose'}."\n"; @@ -563,13 +563,13 @@ $parenth = ""; } - print ".SH Arguments\n"; + print ".SH ARGUMENTS\n"; foreach $parameter (@{$args{'parameterlist'}}) { print ".IP \"".$parameter."\" 12\n"; output_highlight($args{'parameters'}{$parameter}); } foreach $section (@{$args{'sectionlist'}}) { - print ".SH \"$section\"\n"; + print ".SH \"", uc $section, "\"\n"; output_highlight($args{'sections'}{$section}); } } diff -uNr --exclude-from=exclude linux.orig/scripts/split-man linux/scripts/split-man --- linux.orig/scripts/split-man Thu Jan 1 01:00:00 1970 +++ linux/scripts/split-man Sun Aug 13 15:35:16 2000 @@ -0,0 +1,32 @@ +#!/usr/bin/perl +# +# split-man: create man pages from kernel-doc -man output +# +# Author: Tim Waugh <twaugh@redhat.com> +# Modified by: Christoph Hellwig <hch@caldera.de> +# + +use strict; + +die "$0: where do I put the results?\n" unless ($#ARGV >= 0); +die "$0: can't create $ARGV[0]: $!\n" unless mkdir $ARGV[0], 0777; + +my $state = 0; + +while (<STDIN>) { + s/&amp;(\w+)/\\fB\1\\fP/g; # fix smgl uglinesses + if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) { + close OUT unless ($state++ == 0); + my $fn = "$ARGV[0]/$1.9"; + if (open OUT, ">$fn") { + print STDERR "creating $fn\n"; + } else { + die "can't open $fn: $!\n"; + } + print OUT $_; + } elsif ($state != 0) { + print OUT $_; + } +} + +close OUT;

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:33 EST