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