From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 29F039AC9 for ; Tue, 3 Feb 2015 15:11:25 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 03 Feb 2015 06:11:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,513,1418112000"; d="scan'208";a="646666851" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 03 Feb 2015 06:11:22 -0800 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t13EBLcL015569; Tue, 3 Feb 2015 14:11:21 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t13EBL3f008033; Tue, 3 Feb 2015 14:11:21 GMT Received: (from jmcnam2x@localhost) by sivswdev02.ir.intel.com with id t13EBLKJ008029; Tue, 3 Feb 2015 14:11:21 GMT From: John McNamara To: dev@dpdk.org Date: Tue, 3 Feb 2015 14:11:14 +0000 Message-Id: <1422972678-7982-2-git-send-email-john.mcnamara@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1422972678-7982-1-git-send-email-john.mcnamara@intel.com> References: <1421255657-19521-1-git-send-email-john.mcnamara@intel.com> <1422972678-7982-1-git-send-email-john.mcnamara@intel.com> Subject: [dpdk-dev] [PATCH v4 1/5] mk: Add 'make doc-pdf' target to convert guide docs to pdf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2015 14:11:28 -0000 Added make system support for building PDF versions of the guides. Requires Python Sphinx and TexLive Full. Signed-off-by: John McNamara --- mk/rte.sdkdoc.mk | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 42 insertions(+), 1 deletions(-) diff --git a/mk/rte.sdkdoc.mk b/mk/rte.sdkdoc.mk index dabc0d6..e09628f 100644 --- a/mk/rte.sdkdoc.mk +++ b/mk/rte.sdkdoc.mk @@ -37,13 +37,24 @@ endif endif RTE_SPHINX_BUILD = sphinx-build +RTE_PDFLATEX_VERBOSE := --interaction=nonstopmode + ifndef V RTE_SPHINX_VERBOSE := -q +RTE_PDFLATEX_VERBOSE := --interaction=batchmode +RTE_INKSCAPE_VERBOSE := > /dev/null 2>&1 endif ifeq '$V' '0' RTE_SPHINX_VERBOSE := -q +RTE_PDFLATEX_VERBOSE := --interaction=batchmode +RTE_INKSCAPE_VERBOSE := > /dev/null 2>&1 endif +RTE_GUIDE_PDFS := $(filter %/, $(wildcard $(RTE_SDK)/doc/guides/*/)) +RTE_GUIDE_PDFS := $(RTE_GUIDE_PDFS:$(RTE_SDK)/doc/guides%=$(RTE_OUTPUT)/doc/latex/guides%) +RTE_GUIDE_PDFS := $(RTE_GUIDE_PDFS:%/=%.pdf) +RTE_DEFAULT_DPI ?= 300 + .PHONY: help help: @cat $(RTE_SDK)/doc/build-sdk-quick.txt @@ -53,7 +64,7 @@ help: all: api-html guides-html .PHONY: clean -clean: api-html-clean guides-html-clean +clean: api-html-clean guides-html-clean guides-latex-clean .PHONY: api-html api-html: api-html-clean @@ -83,3 +94,33 @@ guides-%: @echo 'sphinx for guides...' $(Q)$(RTE_SPHINX_BUILD) -b $* $(RTE_SPHINX_VERBOSE) \ -c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides $(RTE_OUTPUT)/doc/$*/guides + + +pdf: $(RTE_GUIDE_PDFS) + +.SECONDEXPANSION: +# Use wildcard expansion to avoid * expansion issue with make 3.82. +$(RTE_OUTPUT)/doc/latex/guides/%.pdf: $$(wildcard $(RTE_SDK)/doc/guides/%/*.rst) + @echo 'creating' $* 'pdf ...' + + @# Convert the svg files to png for pdflatex. + $(eval tmp_images = $(wildcard $(RTE_SDK)/doc/guides/$*/img/*.svg)) + $(Q)for image in $(tmp_images:.svg=); do \ + inkscape -d $(RTE_DEFAULT_DPI) -D -b ffffff \ + -f $$image.svg -e $$image.png $(RTE_INKSCAPE_VERBOSE); \ + done + + @# Generate the latex files. + $(Q)$(RTE_SPHINX_BUILD) -b latex $(RTE_SPHINX_VERBOSE) \ + -c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides/$* \ + $(RTE_OUTPUT)/doc/latex/guides/$* + + @# Remove the generated png files. + $(Q)rm -f $(tmp_images:.svg=.png) + + @# Generate the pdf files. + $(Q)sed -i 's/LATEXOPTS =/LATEXOPTS = $(RTE_PDFLATEX_VERBOSE)/' \ + $(RTE_OUTPUT)/doc/latex/guides/$*/Makefile + $(Q)make all-pdf -s -C $(RTE_OUTPUT)/doc/latex/guides/$* + + $(Q)mv $(RTE_OUTPUT)/doc/latex/guides/$*/dpdk_doc.pdf $@ -- 1.7.4.1