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