From patchwork Mon Jan 25 23:28:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Corbet X-Patchwork-Id: 60430 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1647291lbb; Mon, 25 Jan 2016 15:29:18 -0800 (PST) X-Received: by 10.66.55.73 with SMTP id q9mr29662134pap.44.1453764555471; Mon, 25 Jan 2016 15:29:15 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pg10si36675945pac.16.2016.01.25.15.29.15; Mon, 25 Jan 2016 15:29:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933858AbcAYX3I (ORCPT + 30 others); Mon, 25 Jan 2016 18:29:08 -0500 Received: from tex.lwn.net ([70.33.254.29]:60366 "EHLO vena.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933493AbcAYX2w (ORCPT ); Mon, 25 Jan 2016 18:28:52 -0500 Received: from dt.lwn.net (localhost.localdomain [127.0.0.1]) by vena.lwn.net (Postfix) with ESMTP id 21EC1154004B; Mon, 25 Jan 2016 16:28:52 -0700 (MST) From: Jonathan Corbet To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jani Nikula , Daniel Vetter , Jonathan Corbet Subject: [PATCH 3/4] Docs: Makefile tweaks for asciidoc templates Date: Mon, 25 Jan 2016 16:28:41 -0700 Message-Id: <1453764522-29030-4-git-send-email-corbet@lwn.net> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453764522-29030-1-git-send-email-corbet@lwn.net> References: <1453764522-29030-1-git-send-email-corbet@lwn.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Documentation/DocBook/Makefile | 72 +++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 29 deletions(-) -- 2.7.0 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))