build: extend documentation building mechanism
[ffmpeg.git] / doc / Makefile
1 MANPAGES    = $(PROGS-yes:%=doc/%.1)
2 PODPAGES    = $(PROGS-yes:%=doc/%.pod)
3 HTMLPAGES   = $(PROGS-yes:%=doc/%.html)                                 \
4               doc/developer.html                                        \
5               doc/faq.html                                              \
6               doc/fate.html                                             \
7               doc/general.html                                          \
8               doc/git-howto.html                                        \
9               doc/platform.html                                         \
10               doc/syntax.html                                           \
11
12 TXTPAGES    = doc/fate.txt                                              \
13
14
15 DOCS-$(CONFIG_HTMLPAGES) += $(HTMLPAGES)
16 DOCS-$(CONFIG_PODPAGES)  += $(PODPAGES)
17 DOCS-$(CONFIG_MANPAGES)  += $(MANPAGES)
18 DOCS-$(CONFIG_TXTPAGES)  += $(TXTPAGES)
19 DOCS = $(DOCS-yes)
20
21 all-$(CONFIG_DOC): documentation
22
23 documentation: $(DOCS)
24
25 TEXIDEP = awk '/^@(verbatim)?include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
26
27 doc/%.txt: TAG = TXT
28 doc/%.txt: doc/%.texi
29         $(Q)$(TEXIDEP)
30         $(M)makeinfo --force --no-headers -o $@ $< 2>/dev/null
31
32 GENTEXI  = format codec
33 GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
34
35 $(GENTEXI): TAG = GENTEXI
36 $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
37         $(M)doc/print_options $* > $@
38
39 doc/%.html: TAG = HTML
40 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
41         $(Q)$(TEXIDEP)
42         $(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
43
44 doc/%.pod: TAG = POD
45 doc/%.pod: doc/%.texi $(GENTEXI)
46         $(Q)$(TEXIDEP)
47         $(M)perl $(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@
48
49 doc/%.1: TAG = MAN
50 doc/%.1: doc/%.pod $(GENTEXI)
51         $(M)pod2man --section=1 --center=" " --release=" " $< > $@
52
53 $(DOCS): | doc/
54
55 install-man:
56
57 ifdef CONFIG_MANPAGES
58 install-progs-$(CONFIG_DOC): install-man
59
60 install-man: $(MANPAGES)
61         $(Q)mkdir -p "$(MANDIR)/man1"
62         $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
63 endif
64
65 uninstall: uninstall-man
66
67 uninstall-man:
68         $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
69
70 clean::
71         $(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 $(CLEANSUFFIXES:%=doc/%) doc/avoptions_*.texi
72
73 -include $(wildcard $(DOCS:%=%.d))
74
75 .PHONY: documentation