doc/Makefile fix PROGS
[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   = $(AVPROGS-yes:%=doc/%.1)    $(AVPROGS-yes:%=doc/%-all.1)    $(COMPONENTS-yes:%=doc/%.1)
18 MANPAGES3   = $(LIBRARIES-yes:%=doc/%.3)
19 MANPAGES    = $(MANPAGES1) $(MANPAGES3)
20 PODPAGES    = $(AVPROGS-yes:%=doc/%.pod)  $(AVPROGS-yes:%=doc/%-all.pod)  $(COMPONENTS-yes:%=doc/%.pod)  $(LIBRARIES-yes:%=doc/%.pod)
21 HTMLPAGES   = $(AVPROGS-yes:%=doc/%.html) $(AVPROGS-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 DOC_EXAMPLES-$(CONFIG_MUXING_EXAMPLE)           += muxing
40 ALL_DOC_EXAMPLES = muxing
41
42 DOC_EXAMPLES     := $(DOC_EXAMPLES-yes:%=doc/examples/%$(EXESUF))
43 ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES:%=doc/examples/%$(EXESUF))
44 PROGS            += $(DOC_EXAMPLES-yes:%=doc/examples/%)
45
46 all-$(CONFIG_DOC): doc
47
48 doc: documentation
49
50 apidoc: doc/doxy/html
51 documentation: $(DOCS)
52
53 examples: $(DOC_EXAMPLES)
54
55 TEXIDEP = awk '/^@(verbatim)?include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
56
57 doc/%.txt: TAG = TXT
58 doc/%.txt: doc/%.texi
59         $(Q)$(TEXIDEP)
60         $(M)makeinfo --force --no-headers -o $@ $< 2>/dev/null
61
62 GENTEXI  = format codec
63 GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
64
65 $(GENTEXI): TAG = GENTEXI
66 $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
67         $(M)doc/print_options $* > $@
68
69 doc/%.html: TAG = HTML
70 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
71         $(Q)$(TEXIDEP)
72         $(M)texi2html -I doc -monolithic --D=config-not-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
73
74 doc/%-all.html: TAG = HTML
75 doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
76         $(Q)$(TEXIDEP)
77         $(M)texi2html -I doc -monolithic --D=config-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
78
79 doc/%.pod: TAG = POD
80 doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
81         $(Q)$(TEXIDEP)
82         $(M)perl $(SRC_PATH)/doc/texi2pod.pl -Dconfig-not-all=yes -Idoc $< $@
83
84 doc/%-all.pod: TAG = POD
85 doc/%-all.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
86         $(Q)$(TEXIDEP)
87         $(M)perl $(SRC_PATH)/doc/texi2pod.pl -Dconfig-all=yes -Idoc $< $@
88
89 doc/%.1 doc/%.3: TAG = MAN
90 doc/%.1: doc/%.pod $(GENTEXI)
91         $(M)pod2man --section=1 --center=" " --release=" " $< > $@
92 doc/%.3: doc/%.pod $(GENTEXI)
93         $(M)pod2man --section=3 --center=" " --release=" " $< > $@
94
95 $(DOCS) doc/doxy/html: | doc/
96 $(DOC_EXAMPLES:%=%.o): | doc/examples
97 OBJDIRS += doc/examples
98
99 doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(INSTHEADERS)
100         $(M)$(SRC_PATH)/doc/doxy-wrapper.sh $(SRC_PATH) $^
101
102 install-doc: install-html install-man
103
104 install-html:
105
106 install-man:
107
108 ifdef CONFIG_HTMLPAGES
109 install-progs-$(CONFIG_DOC): install-html
110
111 install-html: $(HTMLPAGES)
112         $(Q)mkdir -p "$(DOCDIR)"
113         $(INSTALL) -m 644 $(HTMLPAGES) "$(DOCDIR)"
114 endif
115
116 ifdef CONFIG_MANPAGES
117 install-progs-$(CONFIG_DOC): install-man
118
119 install-man: $(MANPAGES)
120         $(Q)mkdir -p "$(MANDIR)/man1"
121         $(INSTALL) -m 644 $(MANPAGES1) "$(MANDIR)/man1"
122         $(Q)mkdir -p "$(MANDIR)/man3"
123         $(INSTALL) -m 644 $(MANPAGES3) "$(MANDIR)/man3"
124 endif
125
126 uninstall: uninstall-doc
127
128 uninstall-doc: uninstall-html uninstall-man
129
130 uninstall-html:
131         $(RM) -r "$(DOCDIR)"
132
133 uninstall-man:
134         $(RM) $(addprefix "$(MANDIR)/man1/",$(AVPROGS-yes:%=%.1) $(AVPROGS-yes:%=%-all.1) $(COMPONENTS-yes:%=%.1))
135         $(RM) $(addprefix "$(MANDIR)/man3/",$(LIBRARIES-yes:%=%.3))
136
137 clean:: docclean
138
139 distclean:: docclean
140         $(RM) doc/config.texi
141
142 docclean:
143         $(RM) $(ALL_DOC_EXAMPLES)
144         $(RM) $(CLEANSUFFIXES:%=doc/%) $(CLEANSUFFIXES:%=doc/examples/%)
145         $(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 doc/*.3 doc/avoptions_*.texi
146         $(RM) -r doc/doxy/html
147
148 -include $(wildcard $(DOCS:%=%.d))
149
150 .PHONY: apidoc doc documentation