build: Check for pod2man instead of perl for manual page generation
[libav.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 ALL_DOC_EXAMPLES = output
20
21 DOC_EXAMPLES := $(DOC_EXAMPLES-yes:%=doc/examples/%$(EXESUF))
22 ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES:%=doc/examples/%$(EXESUF))
23 PROGS += $(DOC_EXAMPLES)
24
25 all: $(DOCS)
26
27 apidoc: doc/doxy/html
28 documentation: $(DOCS)
29
30 examples: $(DOC_EXAMPLES)
31
32 TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
33
34 GENTEXI = format codec
35 GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
36
37 $(GENTEXI): TAG = GENTEXI
38 $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
39 $(M)doc/print_options $* > $@
40
41 doc/%.html: TAG = HTML
42 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
43 $(Q)$(TEXIDEP)
44 $(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
45
46 doc/%.pod: TAG = POD
47 doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
48 $(Q)$(TEXIDEP)
49 $(M)$(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@
50
51 doc/%.1: TAG = MAN
52 doc/%.1: doc/%.pod $(GENTEXI)
53 $(M)pod2man --section=1 --center=" " --release=" " $< > $@
54
55 $(DOCS) doc/doxy/html: | doc/
56 $(DOC_EXAMPLES:%=%.o): | doc/examples
57 OBJDIRS += doc/examples
58
59 doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(INSTHEADERS)
60 $(M)$(SRC_PATH)/doc/doxy-wrapper.sh $(SRC_PATH) $^
61
62 install-progs-$(CONFIG_POD2MAN): install-man
63 install-progs-$(CONFIG_TEXI2HTML): install-doc
64
65 install-doc: $(HTMLPAGES)
66 $(Q)mkdir -p "$(DOCDIR)"
67 $(INSTALL) -m 644 $(HTMLPAGES) "$(DOCDIR)"
68
69 install-man: $(MANPAGES)
70 $(Q)mkdir -p "$(MANDIR)/man1"
71 $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
72
73 uninstall: uninstall-doc uninstall-man
74
75 uninstall-doc:
76 $(RM) -r "$(DOCDIR)"
77
78 uninstall-man:
79 $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
80
81 clean::
82 $(RM) $(ALL_DOC_EXAMPLES)
83 $(RM) $(CLEANSUFFIXES:%=doc/%) $(CLEANSUFFIXES:%=doc/examples/%)
84 $(RM) doc/*.html doc/*.pod doc/*.1 doc/avoptions_*.texi
85 $(RM) -r doc/doxy/html
86
87 -include $(wildcard $(DOCS:%=%.d))
88
89 .PHONY: apidoc documentation