build: more fine-grained dependencies for documentation build tools
[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/libavfilter.html                                      \
10               doc/nut.html                                              \
11               doc/platform.html                                         \
12
13 DOCS-$(CONFIG_PERL)                             += $(MANPAGES) $(PODPAGES)
14 DOCS-$(CONFIG_TEXI2HTML)                        += $(HTMLPAGES)
15 DOCS = $(DOCS-yes)
16
17 all: $(DOCS)
18
19 apidoc: doc/doxy/html
20 documentation: $(DOCS)
21
22 TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
23
24 GENTEXI  = format codec
25 GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
26
27 $(GENTEXI): TAG = GENTEXI
28 $(GENTEXI): doc/avoptions_%.texi: doc/print_options
29         $(M)doc/print_options $* > $@
30
31 doc/%.html: TAG = HTML
32 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
33         $(Q)$(TEXIDEP)
34         $(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
35
36 doc/%.pod: TAG = POD
37 doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
38         $(Q)$(TEXIDEP)
39         $(M)$(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@
40
41 doc/%.1: TAG = MAN
42 doc/%.1: doc/%.pod $(GENTEXI)
43         $(M)pod2man --section=1 --center=" " --release=" " $< > $@
44
45 $(DOCS) doc/doxy/html: | doc/
46
47 doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(INSTHEADERS)
48         $(M)$(SRC_PATH)/doc/doxy-wrapper.sh $(SRC_PATH) $^
49
50 install-progs-$(CONFIG_PERL): install-man
51 install-progs-$(CONFIG_TEXI2HTML): install-doc
52
53 install-doc: $(HTMLPAGES)
54         $(Q)mkdir -p "$(DOCDIR)"
55         $(INSTALL) -m 644 $(HTMLPAGES) "$(DOCDIR)"
56
57 install-man: $(MANPAGES)
58         $(Q)mkdir -p "$(MANDIR)/man1"
59         $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
60
61 uninstall: uninstall-doc uninstall-man
62
63 uninstall-doc:
64         $(RM) -r "$(DOCDIR)"
65
66 uninstall-man:
67         $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
68
69 clean::
70         $(RM) doc/*.html doc/*.pod doc/*.1 $(CLEANSUFFIXES:%=doc/%) doc/avoptions_*.texi
71         $(RM) -r doc/doxy/html
72
73 -include $(wildcard $(DOCS:%=%.d))
74
75 .PHONY: apidoc documentation