Partially revert "Merge commit 'f187557ab4612776f7f527ecf3d40062975c3e4c'"
[ffmpeg.git] / doc / Makefile
1 LIBRARIES-$(CONFIG_AVUTIL)     += libavutil
2 LIBRARIES-$(CONFIG_SWSCALE)    += libswscale
3 LIBRARIES-$(CONFIG_SWRESAMPLE) += libswresample
4 LIBRARIES-$(CONFIG_AVCODEC)    += libavcodec
5 LIBRARIES-$(CONFIG_AVFORMAT)   += libavformat
6 LIBRARIES-$(CONFIG_AVDEVICE)   += libavdevice
7 LIBRARIES-$(CONFIG_AVFILTER)   += libavfilter
8
9 COMPONENTS-$(CONFIG_AVUTIL)     += ffmpeg-utils
10 COMPONENTS-$(CONFIG_SWSCALE)    += ffmpeg-scaler
11 COMPONENTS-$(CONFIG_SWRESAMPLE) += ffmpeg-resampler
12 COMPONENTS-$(CONFIG_AVCODEC)    += ffmpeg-codecs ffmpeg-bitstream-filters
13 COMPONENTS-$(CONFIG_AVFORMAT)   += ffmpeg-formats ffmpeg-protocols
14 COMPONENTS-$(CONFIG_AVDEVICE)   += ffmpeg-devices
15 COMPONENTS-$(CONFIG_AVFILTER)   += ffmpeg-filters
16
17 MANPAGES1   = $(PROGS-yes:%=doc/%.1)    $(PROGS-yes:%=doc/%-all.1)    $(COMPONENTS-yes:%=doc/%.1)
18 MANPAGES3   = $(LIBRARIES-yes:%=doc/%.3)
19 MANPAGES    = $(MANPAGES1) $(MANPAGES3)
20 PODPAGES    = $(PROGS-yes:%=doc/%.pod)  $(PROGS-yes:%=doc/%-all.pod)  $(COMPONENTS-yes:%=doc/%.pod)  $(LIBRARIES-yes:%=doc/%.pod)
21 HTMLPAGES   = $(PROGS-yes:%=doc/%.html) $(PROGS-yes:%=doc/%-all.html) $(COMPONENTS-yes:%=doc/%.html) $(LIBRARIES-yes:%=doc/%.html) \
22               doc/developer.html                                        \
23               doc/faq.html                                              \
24               doc/fate.html                                             \
25               doc/general.html                                          \
26               doc/git-howto.html                                        \
27               doc/nut.html                                              \
28               doc/platform.html                                         \
29
30 TXTPAGES    = doc/fate.txt                                              \
31
32
33 DOCS-$(CONFIG_HTMLPAGES) += $(HTMLPAGES)
34 DOCS-$(CONFIG_PODPAGES)  += $(PODPAGES)
35 DOCS-$(CONFIG_MANPAGES)  += $(MANPAGES)
36 DOCS-$(CONFIG_TXTPAGES)  += $(TXTPAGES)
37 DOCS = $(DOCS-yes)
38
39 all-$(CONFIG_DOC): doc
40
41 doc: documentation
42
43 apidoc: doc/doxy/html
44 documentation: $(DOCS)
45
46 TEXIDEP = awk '/^@(verbatim)?include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
47
48 doc/%.txt: TAG = TXT
49 doc/%.txt: doc/%.texi
50         $(Q)$(TEXIDEP)
51         $(M)makeinfo --force --no-headers -o $@ $< 2>/dev/null
52
53 GENTEXI  = format codec
54 GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
55
56 $(GENTEXI): TAG = GENTEXI
57 $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
58         $(M)doc/print_options $* > $@
59
60 doc/%.html: TAG = HTML
61 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
62         $(Q)$(TEXIDEP)
63         $(M)texi2html -I doc -monolithic --D=config-not-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
64
65 doc/%-all.html: TAG = HTML
66 doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
67         $(Q)$(TEXIDEP)
68         $(M)texi2html -I doc -monolithic --D=config-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
69
70 doc/%.pod: TAG = POD
71 doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
72         $(Q)$(TEXIDEP)
73         $(M)perl $(SRC_PATH)/doc/texi2pod.pl -Dconfig-not-all=yes -Idoc $< $@
74
75 doc/%-all.pod: TAG = POD
76 doc/%-all.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
77         $(Q)$(TEXIDEP)
78         $(M)perl $(SRC_PATH)/doc/texi2pod.pl -Dconfig-all=yes -Idoc $< $@
79
80 doc/%.1 doc/%.3: TAG = MAN
81 doc/%.1: doc/%.pod $(GENTEXI)
82         $(M)pod2man --section=1 --center=" " --release=" " $< > $@
83 doc/%.3: doc/%.pod $(GENTEXI)
84         $(M)pod2man --section=3 --center=" " --release=" " $< > $@
85
86 $(DOCS) doc/doxy/html: | doc/
87
88 doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(INSTHEADERS)
89         $(M)$(SRC_PATH)/doc/doxy-wrapper.sh $(SRC_PATH) $^
90
91 install-doc: install-html install-man
92
93 install-html:
94
95 install-man:
96
97 ifdef CONFIG_HTMLPAGES
98 install-progs-$(CONFIG_DOC): install-html
99
100 install-html: $(HTMLPAGES)
101         $(Q)mkdir -p "$(DOCDIR)"
102         $(INSTALL) -m 644 $(HTMLPAGES) "$(DOCDIR)"
103 endif
104
105 ifdef CONFIG_MANPAGES
106 install-progs-$(CONFIG_DOC): install-man
107
108 install-man: $(MANPAGES)
109         $(Q)mkdir -p "$(MANDIR)/man1"
110         $(INSTALL) -m 644 $(MANPAGES1) "$(MANDIR)/man1"
111         $(Q)mkdir -p "$(MANDIR)/man3"
112         $(INSTALL) -m 644 $(MANPAGES3) "$(MANDIR)/man3"
113 endif
114
115 uninstall: uninstall-doc
116
117 uninstall-doc: uninstall-html uninstall-man
118
119 uninstall-html:
120         $(RM) -r "$(DOCDIR)"
121
122 uninstall-man:
123         $(RM) $(addprefix "$(MANDIR)/man1/",$(PROGS-yes:%=%.1) $(PROGS-yes:%=%-all.1) $(COMPONENTS-yes:%=%.1))
124         $(RM) $(addprefix "$(MANDIR)/man3/",$(LIBRARIES-yes:%=%.3))
125
126 clean:: docclean
127
128 distclean:: docclean
129         $(RM) doc/config.texi
130
131 docclean:
132         $(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 doc/*.3 $(CLEANSUFFIXES:%=doc/%) doc/avoptions_*.texi
133         $(RM) -r doc/doxy/html
134
135 -include $(wildcard $(DOCS:%=%.d))
136
137 .PHONY: apidoc doc documentation