[dpdk-dev] [PATCH v5 4/7] doc: add pdf output

Thomas Monjalon thomas.monjalon at 6wind.com
Thu Mar 19 12:23:21 CET 2015


From: John McNamara <john.mcnamara at intel.com>

Add make system support for building PDF versions of
the guides. Requires Python Sphinx and TexLive Full.

Signed-off-by: John McNamara <john.mcnamara at intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
 doc/guides/conf.py | 13 +++++++++++--
 mk/rte.sdkdoc.mk   | 46 ++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/doc/guides/conf.py b/doc/guides/conf.py
index fba34a6..264b0cd 100644
--- a/doc/guides/conf.py
+++ b/doc/guides/conf.py
@@ -1,5 +1,5 @@
 #   BSD LICENSE
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,15 @@ project = 'DPDK'
 
 html_show_copyright = False
 
-version = subprocess.check_output(["make","-sRrC","../../", "showversion"])
+version = subprocess.check_output(['make', '-sRrC', '../../', 'showversion'])
+release = version
 
 master_doc = 'index'
+
+latex_documents = [
+    ('index',
+     'doc.tex',
+     '',
+     '',
+     'manual')
+]
diff --git a/mk/rte.sdkdoc.mk b/mk/rte.sdkdoc.mk
index dabc0d6..5b44083 100644
--- a/mk/rte.sdkdoc.mk
+++ b/mk/rte.sdkdoc.mk
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2013 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2013-2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -37,23 +37,33 @@ 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_PDF_DPI ?= 300
+
+RTE_GUIDES := $(filter %/, $(wildcard $(RTE_SDK)/doc/guides/*/))
+
 .PHONY: help
 help:
 	@cat $(RTE_SDK)/doc/build-sdk-quick.txt
 	@$(MAKE) -rR showconfigs | sed 's,^,\t\t\t\t,'
 
 .PHONY: all
-all: api-html guides-html
+all: api-html guides-html guides-pdf
 
 .PHONY: clean
-clean: api-html-clean guides-html-clean
+clean: api-html-clean guides-html-clean guides-pdf-clean
 
 .PHONY: api-html
 api-html: api-html-clean
@@ -79,7 +89,31 @@ guides-%-clean:
 	$(Q)rm -rf $(RTE_OUTPUT)/doc/$*/guides
 	$(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/$* 2>&- || true
 
+guides-pdf-clean: guides-pdf-img-clean
+guides-pdf-img-clean:
+	$(Q)rm -f $(RTE_SDK)/doc/guides/*/img/*.pdf
+
+guides-pdf: $(addprefix guides-pdf-, $(notdir $(RTE_GUIDES:/=))) ;
 guides-%:
-	@echo 'sphinx for guides...'
+	@echo 'sphinx processing $@...'
 	$(Q)$(RTE_SPHINX_BUILD) -b $* $(RTE_SPHINX_VERBOSE) \
-		-c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides $(RTE_OUTPUT)/doc/$*/guides
+		-c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides \
+		$(RTE_OUTPUT)/doc/$*/guides
+
+guides-pdf-%:
+	@echo 'sphinx processing $@...'
+	$(Q)$(RTE_SPHINX_BUILD) -b latex $(RTE_SPHINX_VERBOSE) \
+		-c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides/$* \
+		$(RTE_OUTPUT)/doc/pdf/guides/$*
+	$(Q)rm -f $^
+	@echo 'pdflatex processing $@...'
+	$(Q)$(MAKE) all-pdf -sC $(RTE_OUTPUT)/doc/pdf/guides/$* \
+		LATEXOPTS=$(RTE_PDFLATEX_VERBOSE)
+	$(Q)mv $(RTE_OUTPUT)/doc/pdf/guides/$*/doc.pdf \
+		$(RTE_OUTPUT)/doc/pdf/guides/$*.pdf
+
+# Each PDF depends on generated images *.pdf from *.svg
+$(foreach guide, $(RTE_GUIDES), $(foreach img, $(wildcard $(guide)img/*.svg), \
+	$(eval guides-pdf-$(notdir $(guide:/=)): $(img:svg=pdf))))
+%.pdf: %.svg
+	$(Q)inkscape -d $(RTE_PDF_DPI) -D -f $< -A $@ $(RTE_INKSCAPE_VERBOSE)
-- 
2.2.2



More information about the dev mailing list