1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2015 Intel Corporation.
3 # Copyright(c) 2013-2015 6WIND S.A.
6 ifeq ("$(origin T)", "command line")
7 $(error "Cannot use T= with doc target")
11 RTE_SPHINX_BUILD = sphinx-build
12 RTE_PDFLATEX_VERBOSE := --interaction=nonstopmode
15 RTE_SPHINX_VERBOSE := -q
16 RTE_PDFLATEX_VERBOSE := --interaction=batchmode
17 RTE_INKSCAPE_VERBOSE := >/dev/null 2>&1
20 RTE_SPHINX_VERBOSE := -q
21 RTE_PDFLATEX_VERBOSE := --interaction=batchmode
22 RTE_INKSCAPE_VERBOSE := >/dev/null 2>&1
27 RTE_GUIDES := $(filter %/, $(wildcard $(RTE_SDK)/doc/guides/*/))
29 API_EXAMPLES := $(RTE_OUTPUT)/doc/html/examples.dox
33 @cat $(RTE_SDK)/doc/build-sdk-quick.txt
34 @$(MAKE) -rR showconfigs | sed 's,^,\t\t\t\t,'
37 all: api-html guides-html guides-pdf
40 clean: api-html-clean guides-html-clean guides-pdf-clean guides-man-clean
43 api-html: $(API_EXAMPLES)
44 @echo 'doxygen for API...'
45 $(Q)mkdir -p $(RTE_OUTPUT)/doc/html
46 $(Q)(sed -e "s|@VERSION@|`$(MAKE) -rRs showversion`|" \
47 -e "s|@API_EXAMPLES@|$(API_EXAMPLES)|" \
48 -e "s|@OUTPUT@|$(RTE_OUTPUT)/doc|" \
49 -e "s|@HTML_OUTPUT@|html/api|" \
50 -e "s|@TOPDIR@|./|g" \
51 -e "s|@STRIP_FROM_PATH@|./|g" \
52 $(RTE_SDK)/doc/api/doxy-api.conf.in)| \
54 $(Q)$(RTE_SDK)/doc/api/doxy-html-custom.sh $(RTE_OUTPUT)/doc/html/api/doxygen.css
56 .PHONY: api-html-clean
58 $(Q)rm -f $(API_EXAMPLES)
59 $(Q)rm -f $(RTE_OUTPUT)/doc/html/api/*
60 $(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/html/api 2>&- || true
62 $(API_EXAMPLES): api-html-clean
64 $(Q)doc/api/generate_examples.sh examples $(API_EXAMPLES)
66 guides-pdf-clean: guides-pdf-img-clean
68 $(Q)rm -f $(RTE_SDK)/doc/guides/*/img/*.pdf
71 $(Q)rm -rf $(RTE_OUTPUT)/doc/$*/guides
72 $(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/$* 2>&- || true
74 guides-pdf: $(addprefix guides-pdf-, $(notdir $(RTE_GUIDES:/=))) ;
76 @echo 'sphinx processing $@...'
77 $(Q)$(RTE_SPHINX_BUILD) -b latex $(RTE_SPHINX_VERBOSE) \
78 -c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides/$* \
79 $(RTE_OUTPUT)/doc/pdf/guides/$*
81 @echo 'pdflatex processing $@...'
82 $(Q)$(MAKE) all-pdf -sC $(RTE_OUTPUT)/doc/pdf/guides/$* \
83 LATEXOPTS=$(RTE_PDFLATEX_VERBOSE)
84 $(Q)mv $(RTE_OUTPUT)/doc/pdf/guides/$*/doc.pdf \
85 $(RTE_OUTPUT)/doc/pdf/guides/$*.pdf
88 $(Q)install -D -m0644 $(RTE_SDK)/doc/guides/custom.css \
89 $(RTE_OUTPUT)/doc/html/guides/_static/css/custom.css
93 guides-%: guides-%-prepare
94 @echo 'sphinx processing $@...'
95 $(Q)$(RTE_SPHINX_BUILD) -b $* $(RTE_SPHINX_VERBOSE) \
96 -c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides \
97 $(RTE_OUTPUT)/doc/$*/guides
99 # Each PDF depends on generated images *.pdf from *.svg
100 $(foreach guide, $(RTE_GUIDES), $(foreach img, $(wildcard $(guide)img/*.svg), \
101 $(eval guides-pdf-$(notdir $(guide:/=)): $(img:svg=pdf))))
103 $(Q)inkscape -d $(RTE_PDF_DPI) -D -f $< -A $@ $(RTE_INKSCAPE_VERBOSE)