Make newlib manpages via DocBook XML (v3)

Add makedocbook, a tool to process makedoc markup and output DocBook XML
refentries.

Process all the source files which are processed with makedoc with
makedocbook as well

Add chapter-texi2docbook, a tool to automatically generate DocBook XML
chapter files from the chapter .texi files.  For generating man pages all we
care about is the content of the refentries, so all this needs to do is
convert the @include of the makedoc generated .def files to xi:include of
the makedocbook generated .xml files.

Add skeleton Docbook XML book files, lib[cm].in.xml which include these
generated chapters, which in turn include the generated files containing
refentries, which is processed with xsltproc to generate the lib[cm].xml

Add new make targets to generate and install man pages from lib[cm].xml
This commit is contained in:
Jon Turney
2016-06-24 21:50:15 +01:00
parent fdc45c4bfb
commit 041ea41068
16 changed files with 1047 additions and 4 deletions

View File

@ -142,6 +142,9 @@ SUBDEFS = \
$(LIBC_EXTRA_DEF) \
misc/stmp-def
# ditto for stmp-xml files in each subdirectory which builds .xml files
SUBXMLS = $(SUBDEFS:stmp-def=stmp-xml)
libc.info: sigset.texi extra.texi stdio64.texi posix.texi iconvset.texi \
targetdep.tex $(SUBDEFS)
@ -223,6 +226,23 @@ info_TEXINFOS = libc.texinfo
libc_TEXINFOS = sigset.texi extra.texi posix.texi stdio64.texi iconvset.texi \
targetdep.tex $(SUBDEFS)
docbook-recursive: force
for d in $(SUBDIRS); do \
if test "$$d" != "."; then \
(cd $$d && $(MAKE) docbook) || exit 1; \
fi; \
done
$(SUBXMLS): docbook-recursive
man: $(SUBXMLS) libc.in.xml
xsltproc --xinclude --path ${builddir} --nonet ${srcdir}/../refcontainers.xslt ${srcdir}/libc.in.xml >libc.xml
xmlto --skip-validation man -m ${srcdir}/../man.xsl libc.xml
install-man: man
mkdir -p $(DESTDIR)$(mandir)/man3
$(INSTALL_DATA) *.3 $(DESTDIR)$(mandir)/man3
.PHONY: force
force:
@ -230,7 +250,8 @@ CLEANFILES = $(CRT0) \
sigset.texi stmp-sigset extra.texi stmp-extra \
stdio64.texi stmp-stdio64 targetdep.tex stmp-targetdep \
tmp-sigset.texi tmp-iconvset.texi tmp-extra.texi \
tmp-stdio64.texi tmp-posix.texi tmp-targetdep.texi
tmp-stdio64.texi tmp-posix.texi tmp-targetdep.texi \
*.xml *.3
ACLOCAL_AMFLAGS = -I .. -I ../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host

View File

@ -18,6 +18,9 @@ CHAPTERS = iconv.tex
iconv.def: lib/iconv.def
cp lib/iconv.def iconv.def
iconv.xml: lib/iconv.xml
cp lib/iconv.xml iconv.xml
stmp-def: force
(cd lib && $(MAKE) doc)
touch $@

42
newlib/libc/libc.in.xml Normal file
View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<book id="libc" xmlns:xi="http://www.w3.org/2001/XInclude">
<bookinfo>
<productname>newlib</productname>
</bookinfo>
<xi:include href="stdlib.xml"/>
<xi:include href="ctype.xml"/>
<xi:include href="stdio.xml"/>
<!-- stdio64 is optional -->
<xi:include href="stdio64.xml">
<xi:fallback/>
</xi:include>
<xi:include href="strings.xml"/>
<xi:include href="wcstrings.xml"/>
<!-- signals is optional -->
<xi:include href="signal.xml">
<xi:fallback/>
</xi:include>
<xi:include href="time.xml"/>
<xi:include href="locale.xml"/>
<!-- reent.tex contains fixed content and nothing seems to include the .def made in reent/ -->
<xi:include href="misc.xml"/>
<!-- posix is optional -->
<xi:include href="posix.xml">
<xi:fallback/>
</xi:include>
<!-- XXX: stdarg.h and vararg.h are directly described in libc.texinfo -->
<!-- iconv is optional -->
<xi:include href="iconv.xml">
<xi:fallback/>
</xi:include>
<!-- processing should insert index here -->
<index/>
</book>

View File

@ -22,5 +22,7 @@ $(machine_dir)/lib.a:
doc:
docbook:
ACLOCAL_AMFLAGS = -I ../.. -I ../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host

View File

@ -33,5 +33,7 @@ CLEANFILES = $(CRT0)
doc:
docbook:
ACLOCAL_AMFLAGS = -I ../.. -I ../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host