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 -rf $(RTE_OUTPUT)/doc/html/api/search
60 $(Q)rm -f $(RTE_OUTPUT)/doc/html/api/*
61 $(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/html/api 2>&- || true
63 $(API_EXAMPLES): api-html-clean
65 $(Q)doc/api/generate_examples.sh examples $(API_EXAMPLES)
67 guides-pdf-clean: guides-pdf-img-clean
69 $(Q)rm -f $(RTE_SDK)/doc/guides/*/img/*.pdf
72 $(Q)rm -rf $(RTE_OUTPUT)/doc/$*/guides
73 $(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/$* 2>&- || true
75 guides-pdf: $(addprefix guides-pdf-, $(notdir $(RTE_GUIDES:/=))) ;
77 @echo 'sphinx processing $@...'
78 $(Q)$(RTE_SPHINX_BUILD) -b latex $(RTE_SPHINX_VERBOSE) \
79 -c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides/$* \
80 $(RTE_OUTPUT)/doc/pdf/guides/$*
82 @echo 'pdflatex processing $@...'
83 $(Q)$(MAKE) all-pdf -sC $(RTE_OUTPUT)/doc/pdf/guides/$* \
84 LATEXOPTS=$(RTE_PDFLATEX_VERBOSE)
85 $(Q)mv $(RTE_OUTPUT)/doc/pdf/guides/$*/doc.pdf \
86 $(RTE_OUTPUT)/doc/pdf/guides/$*.pdf
89 $(Q)install -D -m0644 $(RTE_SDK)/doc/guides/custom.css \
90 $(RTE_OUTPUT)/doc/html/guides/_static/css/custom.css
94 guides-%: guides-%-prepare
95 @echo 'sphinx processing $@...'
96 $(Q)$(RTE_SPHINX_BUILD) -b $* $(RTE_SPHINX_VERBOSE) \
97 -c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides \
98 $(RTE_OUTPUT)/doc/$*/guides
100 # Each PDF depends on generated images *.pdf from *.svg
101 $(foreach guide, $(RTE_GUIDES), $(foreach img, $(wildcard $(guide)img/*.svg), \
102 $(eval guides-pdf-$(notdir $(guide:/=)): $(img:svg=pdf))))
104 $(Q)inkscape -d $(RTE_PDF_DPI) -D -f $< -A $@ $(RTE_INKSCAPE_VERBOSE)