build: doxy: Include code examples in Doxygen documentation
[ffmpeg.git] / doc / Makefile
1 ALLMANPAGES = $(AVBASENAMES:%=%.1)
2 MANPAGES    = $(AVPROGS-yes:%=doc/%.1)
3 PODPAGES    = $(AVPROGS-yes:%=doc/%.pod)
4 HTMLPAGES   = $(AVPROGS-yes:%=doc/%.html)                               \
5               doc/developer.html                                        \
6               doc/faq.html                                              \
7               doc/fate.html                                             \
8               doc/general.html                                          \
9               doc/git-howto.html                                        \
10               doc/libavfilter.html                                      \
11               doc/nut.html                                              \
12               doc/platform.html                                         \
13
14 DOCS-$(CONFIG_POD2MAN)                          += $(MANPAGES) $(PODPAGES)
15 DOCS-$(CONFIG_TEXI2HTML)                        += $(HTMLPAGES)
16 DOCS = $(DOCS-yes)
17
18 DOC_EXAMPLES-$(CONFIG_OUTPUT_EXAMPLE)           += output
19 DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE)    += transcode_aac
20 ALL_DOC_EXAMPLES = output transcode_aac
21
22 DOC_EXAMPLES     := $(DOC_EXAMPLES-yes:%=doc/examples/%$(EXESUF))
23 ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES:%=doc/examples/%$(EXESUF))
24 PROGS            += $(DOC_EXAMPLES)
25
26 all: $(DOCS)
27
28 apidoc: doc/doxy/html
29 documentation: $(DOCS)
30
31 examples: $(DOC_EXAMPLES)
32
33 TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
34
35 GENTEXI  = format codec
36 GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
37
38 $(GENTEXI): TAG = GENTEXI
39 $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
40         $(M)doc/print_options $* > $@
41
42 doc/%.html: TAG = HTML
43 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
44         $(Q)$(TEXIDEP)
45         $(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
46
47 doc/%.pod: TAG = POD
48 doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
49         $(Q)$(TEXIDEP)
50         $(M)$(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@
51
52 doc/%.1: TAG = MAN
53 doc/%.1: doc/%.pod $(GENTEXI)
54         $(M)pod2man --section=1 --center=" " --release=" " $< > $@
55
56 $(DOCS) doc/doxy/html: | doc/
57 $(DOC_EXAMPLES:%$(EXESUF)=%.o): | doc/examples
58 OBJDIRS += doc/examples
59
60 DOXY_INPUT      = $(addprefix $(SRC_PATH)/, $(INSTHEADERS) $(DOC_EXAMPLES:%$(EXESUF)=%.c) $(LIB_EXAMPLES:%$(EXESUF)=%.c))
61 DOXY_TEMPLATES  = doxy_stylesheet.css footer.html header.html
62 DOXY_TEMPLATES := $(addprefix $(SRC_PATH)/doc/doxy/, $(DOXY_TEMPLATES))
63
64 doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(DOXY_INPUT) $(DOXY_TEMPLATES)
65         $(M)$(SRC_PATH)/doc/doxy-wrapper.sh $(SRC_PATH) $< $(DOXY_INPUT)
66
67 install-progs-$(CONFIG_POD2MAN): install-man
68 install-progs-$(CONFIG_TEXI2HTML): install-doc
69
70 install-doc: $(HTMLPAGES)
71         $(Q)mkdir -p "$(DOCDIR)"
72         $(INSTALL) -m 644 $(HTMLPAGES) "$(DOCDIR)"
73
74 install-man: $(MANPAGES)
75         $(Q)mkdir -p "$(MANDIR)/man1"
76         $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
77
78 uninstall: uninstall-doc uninstall-man
79
80 uninstall-doc:
81         $(RM) -r "$(DOCDIR)"
82
83 uninstall-man:
84         $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
85
86 clean::
87         $(RM) $(ALL_DOC_EXAMPLES)
88         $(RM) $(CLEANSUFFIXES:%=doc/%) $(CLEANSUFFIXES:%=doc/examples/%)
89         $(RM) doc/*.html doc/*.pod doc/*.1 doc/avoptions_*.texi
90         $(RM) -r doc/doxy/html
91
92 -include $(wildcard $(DOCS:%=%.d))
93
94 .PHONY: apidoc documentation