ethdev: deprecate attach and detach functions
[dpdk.git] / mk / rte.sdkdoc.mk
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2015 Intel Corporation.
3 # Copyright(c) 2013-2015 6WIND S.A.
4
5 ifdef T
6 ifeq ("$(origin T)", "command line")
7 $(error "Cannot use T= with doc target")
8 endif
9 endif
10
11 RTE_SPHINX_BUILD = sphinx-build
12 RTE_PDFLATEX_VERBOSE := --interaction=nonstopmode
13
14 ifndef V
15 RTE_SPHINX_VERBOSE := -q
16 RTE_PDFLATEX_VERBOSE := --interaction=batchmode
17 RTE_INKSCAPE_VERBOSE := >/dev/null 2>&1
18 endif
19 ifeq '$V' '0'
20 RTE_SPHINX_VERBOSE := -q
21 RTE_PDFLATEX_VERBOSE := --interaction=batchmode
22 RTE_INKSCAPE_VERBOSE := >/dev/null 2>&1
23 endif
24
25 RTE_PDF_DPI ?= 300
26
27 RTE_GUIDES := $(filter %/, $(wildcard $(RTE_SDK)/doc/guides/*/))
28
29 API_EXAMPLES := $(RTE_OUTPUT)/doc/html/examples.dox
30
31 .PHONY: help
32 help:
33         @cat $(RTE_SDK)/doc/build-sdk-quick.txt
34         @$(MAKE) -rR showconfigs | sed 's,^,\t\t\t\t,'
35
36 .PHONY: all
37 all: api-html guides-html guides-pdf
38
39 .PHONY: clean
40 clean: api-html-clean guides-html-clean guides-pdf-clean guides-man-clean
41
42 .PHONY: api-html
43 api-html: $(API_EXAMPLES)
44         @echo 'doxygen for API...'
45         $(Q)mkdir -p $(RTE_OUTPUT)/doc/html
46         $(Q)(cat $(RTE_SDK)/doc/api/doxy-api.conf     && \
47             printf 'PROJECT_NUMBER = '                && \
48                              $(MAKE) -rRs showversion && \
49             echo INPUT           += $(API_EXAMPLES)   && \
50             echo OUTPUT_DIRECTORY = $(RTE_OUTPUT)/doc && \
51             echo HTML_OUTPUT      = html/api          && \
52             echo GENERATE_HTML    = YES               && \
53             echo GENERATE_LATEX   = NO                && \
54             echo GENERATE_MAN     = NO                )| \
55             doxygen -
56         $(Q)$(RTE_SDK)/doc/api/doxy-html-custom.sh $(RTE_OUTPUT)/doc/html/api/doxygen.css
57
58 .PHONY: api-html-clean
59 api-html-clean:
60         $(Q)rm -f $(API_EXAMPLES)
61         $(Q)rm -f $(RTE_OUTPUT)/doc/html/api/*
62         $(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/html/api 2>&- || true
63
64 $(API_EXAMPLES): api-html-clean
65         $(Q)mkdir -p $(@D)
66         @printf '/**\n' > $(API_EXAMPLES)
67         @printf '@page examples DPDK Example Programs\n\n' >> $(API_EXAMPLES)
68         @find examples -type f -name '*.c' -printf '@example %p\n' | LC_ALL=C sort >> $(API_EXAMPLES)
69         @printf '*/\n' >> $(API_EXAMPLES)
70
71 guides-pdf-clean: guides-pdf-img-clean
72 guides-pdf-img-clean:
73         $(Q)rm -f $(RTE_SDK)/doc/guides/*/img/*.pdf
74
75 guides-%-clean:
76         $(Q)rm -rf $(RTE_OUTPUT)/doc/$*/guides
77         $(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/$* 2>&- || true
78
79 guides-pdf: $(addprefix guides-pdf-, $(notdir $(RTE_GUIDES:/=))) ;
80 guides-pdf-%:
81         @echo 'sphinx processing $@...'
82         $(Q)$(RTE_SPHINX_BUILD) -b latex $(RTE_SPHINX_VERBOSE) \
83                 -c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides/$* \
84                 $(RTE_OUTPUT)/doc/pdf/guides/$*
85         $(if $^,$(Q)rm -f $^)
86         @echo 'pdflatex processing $@...'
87         $(Q)$(MAKE) all-pdf -sC $(RTE_OUTPUT)/doc/pdf/guides/$* \
88                 LATEXOPTS=$(RTE_PDFLATEX_VERBOSE)
89         $(Q)mv $(RTE_OUTPUT)/doc/pdf/guides/$*/doc.pdf \
90                 $(RTE_OUTPUT)/doc/pdf/guides/$*.pdf
91
92 guides-html-prepare:
93         $(Q)install -D -m0644 $(RTE_SDK)/doc/guides/custom.css \
94                 $(RTE_OUTPUT)/doc/html/guides/_static/css/custom.css
95
96 guides-%-prepare: ;
97
98 guides-%: guides-%-prepare
99         @echo 'sphinx processing $@...'
100         $(Q)$(RTE_SPHINX_BUILD) -b $* $(RTE_SPHINX_VERBOSE) \
101                 -c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides \
102                 $(RTE_OUTPUT)/doc/$*/guides
103
104 # Each PDF depends on generated images *.pdf from *.svg
105 $(foreach guide, $(RTE_GUIDES), $(foreach img, $(wildcard $(guide)img/*.svg), \
106         $(eval guides-pdf-$(notdir $(guide:/=)): $(img:svg=pdf))))
107 %.pdf: %.svg
108         $(Q)inkscape -d $(RTE_PDF_DPI) -D -f $< -A $@ $(RTE_INKSCAPE_VERBOSE)