bda815307c035bbf0a887ab7ce0a16427ac0f2ec
[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 DOC_EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE)     += decode_audio
20 DOC_EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE)     += decode_video
21 DOC_EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE)     += encode_audio
22 DOC_EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE)     += encode_video
23 DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE)     += filter_audio
24 DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE)         += metadata
25 DOC_EXAMPLES-$(CONFIG_OUTPUT_EXAMPLE)           += output
26 DOC_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)           += qsvdec
27 DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE)    += transcode_aac
28 ALL_DOC_EXAMPLES = decode_audio                                         \
29                    decode_video                                         \
30                    encode_audio                                         \
31                    encode_video                                         \
32                    filter_audio                                         \
33                    metadata output                                      \
34                    transcode_aac                                        \
35
36 DOC_EXAMPLES     := $(DOC_EXAMPLES-yes:%=doc/examples/%$(EXESUF))
37 ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES:%=doc/examples/%$(EXESUF))
38 PROGS            += $(DOC_EXAMPLES)
39
40 all: $(DOCS)
41
42 apidoc: doc/doxy/html
43 documentation: $(DOCS)
44
45 examples: $(DOC_EXAMPLES)
46
47 TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
48
49 GENTEXI  = format codec
50 GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
51
52 $(MANPAGES) $(PODPAGES) $(PROGSHTML): $(GENTEXI)
53
54 $(GENTEXI): TAG = GENTEXI
55 $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
56         $(M)doc/print_options $* > $@
57
58 doc/%.html: TAG = HTML
59 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init
60         $(Q)$(TEXIDEP)
61         $(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
62
63 doc/%.pod: TAG = POD
64 doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl
65         $(Q)$(TEXIDEP)
66         $(M)$(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@
67
68 doc/%.1: TAG = MAN
69 doc/%.1: doc/%.pod
70         $(M)pod2man --section=1 --center=" " --release=" " $< > $@
71
72 $(DOCS) doc/doxy/html: | doc/
73 $(DOC_EXAMPLES:%$(EXESUF)=%.o): | doc/examples
74 OBJDIRS += doc/examples
75
76 DOXY_INPUT      = $(addprefix $(SRC_PATH)/, $(INSTHEADERS) $(DOC_EXAMPLES:%$(EXESUF)=%.c) $(LIB_EXAMPLES:%$(EXESUF)=%.c))
77 DOXY_TEMPLATES  = doxy_stylesheet.css footer.html header.html
78 DOXY_TEMPLATES := $(addprefix $(SRC_PATH)/doc/doxy/, $(DOXY_TEMPLATES))
79
80 doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(DOXY_INPUT) $(DOXY_TEMPLATES)
81         $(M)$(SRC_PATH)/doc/doxy-wrapper.sh $(SRC_PATH) $< $(DOXY_INPUT)
82
83 install-progs-$(CONFIG_POD2MAN): install-man
84 install-progs-$(CONFIG_TEXI2HTML): install-doc
85
86 install-doc: $(HTMLPAGES)
87         $(Q)mkdir -p "$(DOCDIR)"
88         $(INSTALL) -m 644 $(HTMLPAGES) "$(DOCDIR)"
89
90 install-man: $(MANPAGES)
91         $(Q)mkdir -p "$(MANDIR)/man1"
92         $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
93
94 uninstall: uninstall-doc uninstall-man
95
96 uninstall-doc:
97         $(RM) -r "$(DOCDIR)"
98
99 uninstall-man:
100         $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
101
102 clean::
103         $(RM) $(ALL_DOC_EXAMPLES)
104         $(RM) $(CLEANSUFFIXES:%=doc/%) $(CLEANSUFFIXES:%=doc/examples/%)
105         $(RM) doc/*.html doc/*.pod doc/*.1 doc/avoptions_*.texi
106         $(RM) -r doc/doxy/html
107
108 -include $(wildcard $(DOCS:%=%.d))
109
110 .PHONY: apidoc documentation