[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1453764522-29030-4-git-send-email-corbet@lwn.net>
Date: Mon, 25 Jan 2016 16:28:41 -0700
From: Jonathan Corbet <corbet@....net>
To: linux-doc@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Jani Nikula <jani.nikula@...el.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Jonathan Corbet <corbet@....net>
Subject: [PATCH 3/4] Docs: Makefile tweaks for asciidoc templates
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@....net>
---
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
Powered by blists - more mailing lists