[PATCH 3/4] Docs: Makefile tweaks for asciidoc templates
From: Jonathan Corbet
Date: Mon Jan 25 2016 - 18:29:11 EST
This is a hatchet job, but it's something to start with. Generalize some
of the string manipulation to not assume that templates have a ".tmpl"
suffix, and add rules to translate asciidoc templates to HTML. Nothing for
any other output formats at this point.
Signed-off-by: Jonathan Corbet <corbet@xxxxxxx>
---
Documentation/DocBook/Makefile | 72 +++++++++++++++++++++++++-----------------
1 file changed, 43 insertions(+), 29 deletions(-)
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index d70f9b6..f04e8c8 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -6,16 +6,16 @@
# To add a new book the only step required is to add the book to the
# list of DOCBOOKS.
-DOCBOOKS := z8530book.xml device-drivers.xml \
- kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
- writing_usb_driver.xml networking.xml \
- kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
- gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
- genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
- 80211.xml debugobjects.xml sh.xml regulator.xml \
- alsa-driver-api.xml writing-an-alsa-driver.xml \
- tracepoint.xml gpu.xml media_api.xml w1.xml \
- writing_musb_glue_layer.xml crypto-API.xml iio.xml
+DOCBOOKS := z8530book device-drivers \
+ kernel-hacking kernel-locking deviceiobook \
+ writing_usb_driver networking \
+ kernel-api filesystems lsm usb kgdb \
+ gadget libata mtdnand librs rapidio \
+ genericirq s390-drivers uio-howto scsi \
+ 80211 debugobjects sh regulator \
+ alsa-driver-api writing-an-alsa-driver \
+ tracepoint gpu media_api w1 \
+ writing_musb_glue_layer crypto-API iio
include Documentation/DocBook/media/Makefile
@@ -39,21 +39,21 @@ PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleando
targets += $(DOCBOOKS)
BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
-xmldocs: $(BOOKS)
+xmldocs: $(addsuffix .xml, $(BOOKS))
sgmldocs: xmldocs
-PS := $(patsubst %.xml, %.ps, $(BOOKS))
+PS := $(addsuffix .ps, $(BOOKS))
psdocs: $(PS)
-PDF := $(patsubst %.xml, %.pdf, $(BOOKS))
+PDF := $(addsuffix .pdf, $(BOOKS))
pdfdocs: $(PDF)
-HTML := $(sort $(patsubst %.xml, %.html, $(BOOKS)))
+HTML := $(sort $(addsuffix .html, $(BOOKS)))
htmldocs: $(HTML)
$(call cmd,build_main_index)
$(call install_media_images)
-MAN := $(patsubst %.xml, %.9, $(BOOKS))
+MAN := $(addsuffix .9, $(BOOKS))
mandocs: $(MAN)
find $(obj)/man -name '*.9' | xargs gzip -nf
@@ -103,6 +103,19 @@ endef
# Tell kbuild to always build the programs
always := $(hostprogs-y)
+#
+# asciidoc stuff.
+#
+quiet_cmd_ad2html = ASCIIDOC $@
+ cmd_ad2html = asciidoc -b html $< > $@
+
+%.ad: %.adt $(KERNELDOC) $(DOCPROC) FORCE
+ $(call cmd,docproc)
+
+%.html: %.ad
+ $(call cmd,ad2html)
+
+
notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \
exit 1
db2xtemplate = db2TYPE -o $(dir $@) $<
@@ -234,22 +247,23 @@ dochelp:
###
# Temporary files left by various tools
-clean-files := $(DOCBOOKS) \
- $(patsubst %.xml, %.dvi, $(DOCBOOKS)) \
- $(patsubst %.xml, %.aux, $(DOCBOOKS)) \
- $(patsubst %.xml, %.tex, $(DOCBOOKS)) \
- $(patsubst %.xml, %.log, $(DOCBOOKS)) \
- $(patsubst %.xml, %.out, $(DOCBOOKS)) \
- $(patsubst %.xml, %.ps, $(DOCBOOKS)) \
- $(patsubst %.xml, %.pdf, $(DOCBOOKS)) \
- $(patsubst %.xml, %.html, $(DOCBOOKS)) \
- $(patsubst %.xml, %.9, $(DOCBOOKS)) \
- $(patsubst %.xml, %.aux.xml, $(DOCBOOKS)) \
- $(patsubst %.xml, %.xml.db, $(DOCBOOKS)) \
- $(patsubst %.xml, %.xml, $(DOCBOOKS)) \
+clean-files := \
+ $(addsuffix .dvi, $(DOCBOOKS)) \
+ $(addsuffix .aux, $(DOCBOOKS)) \
+ $(addsuffix .tex, $(DOCBOOKS)) \
+ $(addsuffix .log, $(DOCBOOKS)) \
+ $(addsuffix .out, $(DOCBOOKS)) \
+ $(addsuffix .ps, $(DOCBOOKS)) \
+ $(addsuffix .pdf, $(DOCBOOKS)) \
+ $(addsuffix .html, $(DOCBOOKS)) \
+ $(addsuffix .9, $(DOCBOOKS)) \
+ $(addsuffix .aux.xml, $(DOCBOOKS)) \
+ $(addsuffix .xml.db, $(DOCBOOKS)) \
+ $(addsuffix .xml, $(DOCBOOKS)) \
+ $(addsuffix .ad, $(DOCBOOKS)) \
$(index)
-clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man
+clean-dirs := $(DOCBOOKS) man
cleandocs: cleanmediadocs
$(Q)rm -f $(call objectify, $(clean-files))
--
2.7.0