diff options
| author | Danilo Cesar Lemes de Paula <danilo.cesar@collabora.co.uk> | 2015-07-28 15:45:15 -0400 |
|---|---|---|
| committer | Jonathan Corbet <corbet@lwn.net> | 2015-08-17 00:11:16 -0400 |
| commit | 5699f871d2d51ce40012501378670613d4d49214 (patch) | |
| tree | b35b519696abf5a24c3ee4de623e0851607103c5 /Documentation/DocBook/Makefile | |
| parent | 9ed71e7ad95eb9885420e8d33f33bd4d49e1b775 (diff) | |
scripts/kernel-doc: Adding cross-reference links to html documentation.
Functions, Structs and Parameters definitions on kernel documentation
are pure cosmetic, it only highlights the element.
To ease the navigation in the documentation we should use <links> inside
those tags so readers can easily jump between methods directly.
This was discussed in 2014[1] and is implemented by getting a list
of <refentries> from the DocBook XML to generate a database. Then it looks
for <function>,<structnames> and <paramdef> tags that matches the ones in
the database. As it only links existent references, no broken links are
added.
[1] - lists.freedesktop.org/archives/dri-devel/2014-August/065404.html
Signed-off-by: Danilo Cesar Lemes de Paula <danilo.cesar@collabora.co.uk>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Stephan Mueller <smueller@chronox.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: intel-gfx <intel-gfx@lists.freedesktop.org>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/DocBook/Makefile')
| -rw-r--r-- | Documentation/DocBook/Makefile | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 5e9702194dfe..b1d6c951ea29 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
| @@ -66,8 +66,9 @@ installmandocs: mandocs | |||
| 66 | 66 | ||
| 67 | ### | 67 | ### |
| 68 | #External programs used | 68 | #External programs used |
| 69 | KERNELDOC = $(srctree)/scripts/kernel-doc | 69 | KERNELDOCXMLREF = $(srctree)/scripts/kernel-doc-xml-ref |
| 70 | DOCPROC = $(objtree)/scripts/docproc | 70 | KERNELDOC = $(srctree)/scripts/kernel-doc |
| 71 | DOCPROC = $(objtree)/scripts/docproc | ||
| 71 | 72 | ||
| 72 | XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl | 73 | XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl |
| 73 | XMLTOFLAGS += --skip-validation | 74 | XMLTOFLAGS += --skip-validation |
| @@ -91,7 +92,7 @@ define rule_docproc | |||
| 91 | ) > $(dir $@).$(notdir $@).cmd | 92 | ) > $(dir $@).$(notdir $@).cmd |
| 92 | endef | 93 | endef |
| 93 | 94 | ||
| 94 | %.xml: %.tmpl $(KERNELDOC) $(DOCPROC) FORCE | 95 | %.xml: %.tmpl $(KERNELDOC) $(DOCPROC) $(KERNELDOCXMLREF) FORCE |
| 95 | $(call if_changed_rule,docproc) | 96 | $(call if_changed_rule,docproc) |
| 96 | 97 | ||
| 97 | # Tell kbuild to always build the programs | 98 | # Tell kbuild to always build the programs |
| @@ -142,7 +143,20 @@ quiet_cmd_db2html = HTML $@ | |||
| 142 | echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \ | 143 | echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \ |
| 143 | $(patsubst %.html,%,$(notdir $@))</a><p>' > $@ | 144 | $(patsubst %.html,%,$(notdir $@))</a><p>' > $@ |
| 144 | 145 | ||
| 145 | %.html: %.xml | 146 | ### |
| 147 | # Rules to create an aux XML and .db, and use them to re-process the DocBook XML | ||
| 148 | # to fill internal hyperlinks | ||
| 149 | gen_aux_xml = : | ||
| 150 | quiet_gen_aux_xml = echo ' XMLREF $@' | ||
| 151 | silent_gen_aux_xml = : | ||
| 152 | %.aux.xml: %.xml | ||
| 153 | @$($(quiet)gen_aux_xml) | ||
| 154 | @rm -rf $@ | ||
| 155 | @(cat $< | egrep "^<refentry id" | egrep -o "\".*\"" | cut -f 2 -d \" > $<.db) | ||
| 156 | @$(KERNELDOCXMLREF) -db $<.db $< > $@ | ||
| 157 | .PRECIOUS: %.aux.xml | ||
| 158 | |||
| 159 | %.html: %.aux.xml | ||
| 146 | @(which xmlto > /dev/null 2>&1) || \ | 160 | @(which xmlto > /dev/null 2>&1) || \ |
| 147 | (echo "*** You need to install xmlto ***"; \ | 161 | (echo "*** You need to install xmlto ***"; \ |
| 148 | exit 1) | 162 | exit 1) |
| @@ -211,15 +225,18 @@ dochelp: | |||
| 211 | ### | 225 | ### |
| 212 | # Temporary files left by various tools | 226 | # Temporary files left by various tools |
| 213 | clean-files := $(DOCBOOKS) \ | 227 | clean-files := $(DOCBOOKS) \ |
| 214 | $(patsubst %.xml, %.dvi, $(DOCBOOKS)) \ | 228 | $(patsubst %.xml, %.dvi, $(DOCBOOKS)) \ |
| 215 | $(patsubst %.xml, %.aux, $(DOCBOOKS)) \ | 229 | $(patsubst %.xml, %.aux, $(DOCBOOKS)) \ |
| 216 | $(patsubst %.xml, %.tex, $(DOCBOOKS)) \ | 230 | $(patsubst %.xml, %.tex, $(DOCBOOKS)) \ |
| 217 | $(patsubst %.xml, %.log, $(DOCBOOKS)) \ | 231 | $(patsubst %.xml, %.log, $(DOCBOOKS)) \ |
| 218 | $(patsubst %.xml, %.out, $(DOCBOOKS)) \ | 232 | $(patsubst %.xml, %.out, $(DOCBOOKS)) \ |
| 219 | $(patsubst %.xml, %.ps, $(DOCBOOKS)) \ | 233 | $(patsubst %.xml, %.ps, $(DOCBOOKS)) \ |
| 220 | $(patsubst %.xml, %.pdf, $(DOCBOOKS)) \ | 234 | $(patsubst %.xml, %.pdf, $(DOCBOOKS)) \ |
| 221 | $(patsubst %.xml, %.html, $(DOCBOOKS)) \ | 235 | $(patsubst %.xml, %.html, $(DOCBOOKS)) \ |
| 222 | $(patsubst %.xml, %.9, $(DOCBOOKS)) \ | 236 | $(patsubst %.xml, %.9, $(DOCBOOKS)) \ |
| 237 | $(patsubst %.xml, %.aux.xml, $(DOCBOOKS)) \ | ||
| 238 | $(patsubst %.xml, %.xml.db, $(DOCBOOKS)) \ | ||
| 239 | $(patsubst %.xml, %.xml, $(DOCBOOKS)) \ | ||
| 223 | $(index) | 240 | $(index) |
| 224 | 241 | ||
| 225 | clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man | 242 | clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man |
