Update documentation dependencies, make ff* tools manpages and HTML
[ffmpeg.git] / Makefile
1 include config.mak
2
3 SRC_DIR = $(SRC_PATH_BARE)
4
5 vpath %.texi $(SRC_PATH_BARE)
6
7 PROGS-$(CONFIG_FFMPEG)   += ffmpeg
8 PROGS-$(CONFIG_FFPLAY)   += ffplay
9 PROGS-$(CONFIG_FFPROBE)  += ffprobe
10 PROGS-$(CONFIG_FFSERVER) += ffserver
11
12 PROGS      := $(addsuffix   $(EXESUF), $(PROGS-yes))
13 PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
14 OBJS        = $(addsuffix .o,          $(PROGS-yes)) cmdutils.o
15 MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
16 HTMLPAGES   = $(addprefix doc/, $(addsuffix -doc.html, $(PROGS-yes)))
17 TOOLS       = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
18 HOSTPROGS   = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
19
20 BASENAMES   = ffmpeg ffplay ffprobe ffserver
21 ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
22 ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
23 ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
24 ALLHTMLPAGES= $(addsuffix -doc.html, $(BASENAMES))
25
26 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
27 FFLIBS-$(CONFIG_AVFILTER) += avfilter
28 FFLIBS-$(CONFIG_AVFORMAT) += avformat
29 FFLIBS-$(CONFIG_AVCODEC)  += avcodec
30 FFLIBS-$(CONFIG_POSTPROC) += postproc
31 FFLIBS-$(CONFIG_SWSCALE)  += swscale
32
33 FFLIBS := avutil
34
35 DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
36
37 SKIPHEADERS = cmdutils_common_opts.h
38
39 include common.mak
40
41 FF_LDFLAGS   := $(FFLDFLAGS)
42 FF_EXTRALIBS := $(FFEXTRALIBS)
43 FF_DEP_LIBS  := $(DEP_LIBS)
44
45 ALL_TARGETS-$(CONFIG_DOC)       += documentation
46
47 ifdef PROGS
48 INSTALL_TARGETS-yes             += install-progs install-data
49 INSTALL_TARGETS-$(CONFIG_DOC)   += install-man
50 endif
51 INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
52
53 all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
54
55 $(PROGS): %$(EXESUF): %_g$(EXESUF)
56         $(CP) $< $@
57         $(STRIP) $@
58
59 SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
60                ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
61                HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS
62
63 define RESET
64 $(1) :=
65 $(1)-yes :=
66 endef
67
68 define DOSUBDIR
69 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
70 SUBDIR := $(1)/
71 include $(1)/Makefile
72 endef
73
74 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
75
76 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
77 ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
78
79 %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
80         $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
81
82 tools/%$(EXESUF): tools/%.o
83         $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
84
85 tools/%.o: tools/%.c
86         $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
87
88 ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
89
90 VERSION_SH  = $(SRC_PATH_BARE)/version.sh
91 GIT_LOG     = $(SRC_PATH_BARE)/.git/logs/HEAD
92 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
93
94 .version: $(wildcard $(GIT_LOG) $(SVN_ENTRIES)) $(VERSION_SH) config.mak
95 .version: M=@
96
97 version.h .version:
98         $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
99         $(Q)touch .version
100
101 # force version.sh to run whenever version might have changed
102 -include .version
103
104 alltools: $(TOOLS)
105
106 documentation: $(addprefix doc/, developer.html faq.html general.html libavfilter.html \
107                                  $(ALLHTMLPAGES) $(ALLMANPAGES))
108
109 $(HTMLPAGES) $(MANPAGES): doc/fftools-common-opts.texi
110
111 doc/%.html: TAG = HTML
112 doc/%.html: doc/%.texi
113         $(M)cd doc && texi2html -monolithic -number $(<:doc/%=%)
114
115 doc/%.pod: TAG = POD
116 doc/%.pod: doc/%-doc.texi
117         $(M)doc/texi2pod.pl $< $@
118
119 doc/%.1: TAG = MAN
120 doc/%.1: doc/%.pod
121         $(M)pod2man --section=1 --center=" " --release=" " $< > $@
122
123 install: $(INSTALL_TARGETS-yes)
124
125 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
126         $(Q)mkdir -p "$(BINDIR)"
127         $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
128
129 install-data: $(DATA_FILES)
130         $(Q)mkdir -p "$(DATADIR)"
131         $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
132
133 install-man: $(MANPAGES)
134         $(Q)mkdir -p "$(MANDIR)/man1"
135         $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
136
137 uninstall: uninstall-progs uninstall-data uninstall-man
138
139 uninstall-progs:
140         $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
141
142 uninstall-data:
143         $(RM) -r "$(DATADIR)"
144
145 uninstall-man:
146         $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
147
148 testclean:
149         $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
150         $(RM) $(addprefix tests/,$(CLEANSUFFIXES))
151         $(RM) tests/seek_test$(EXESUF) tests/seek_test.o
152         $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
153
154 clean:: testclean
155         $(RM) $(ALLPROGS) $(ALLPROGS_G)
156         $(RM) $(CLEANSUFFIXES)
157         $(RM) doc/*.html doc/*.pod doc/*.1
158         $(RM) $(TOOLS)
159
160 distclean::
161         $(RM) $(DISTCLEANSUFFIXES)
162         $(RM) version.h config.* libavutil/avconfig.h
163
164 config:
165         $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
166
167 # regression tests
168
169 check: test checkheaders
170
171 fulltest test: codectest lavftest seektest
172
173 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
174 SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
175
176 ENCDEC = $(and $(CONFIG_$(1)_ENCODER),$(CONFIG_$(1)_DECODER))
177 MUXDEM = $(and $(CONFIG_$(1)_MUXER),$(CONFIG_$(or $(2),$(1))_DEMUXER))
178
179 VCODEC_TESTS =
180 VCODEC_TESTS-$(call ENCDEC,ASV1)             += asv1
181 VCODEC_TESTS-$(call ENCDEC,ASV2)             += asv2
182 VCODEC_TESTS-$(call ENCDEC,DNXHD)            += dnxhd_1080i dnxhd_720p dnxhd_720p_rd
183 VCODEC_TESTS-$(call ENCDEC,DVVIDEO)          += dv dv50
184 VCODEC_TESTS-$(call ENCDEC,FFV1)             += ffv1
185 VCODEC_TESTS-$(call ENCDEC,FLASHSV)          += flashsv
186 VCODEC_TESTS-$(call ENCDEC,FLV)              += flv
187 VCODEC_TESTS-$(call ENCDEC,H261)             += h261
188 VCODEC_TESTS-$(call ENCDEC,H263)             += h263 h263p
189 VCODEC_TESTS-$(call ENCDEC,HUFFYUV)          += huffyuv
190 VCODEC_TESTS-$(call ENCDEC,JPEGLS)           += jpegls
191 VCODEC_TESTS-$(call ENCDEC,MJPEG)            += mjpeg ljpeg
192 VCODEC_TESTS-$(call ENCDEC,MPEG1VIDEO)       += mpeg mpeg1b
193 VCODEC_TESTS-$(call ENCDEC,MPEG2VIDEO)       += mpeg2 mpeg2thread
194 VCODEC_TESTS-$(call ENCDEC,MPEG4)            += mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc
195 VCODEC_TESTS-$(call ENCDEC,MSMPEG4V1)        += msmpeg4
196 VCODEC_TESTS-$(call ENCDEC,MSMPEG4V2)        += msmpeg4v2
197 VCODEC_TESTS-$(call ENCDEC,RAWVIDEO)         += rgb yuv
198 VCODEC_TESTS-$(call ENCDEC,ROQ)              += roq
199 VCODEC_TESTS-$(call ENCDEC,RV10)             += rv10
200 VCODEC_TESTS-$(call ENCDEC,RV20)             += rv20
201 VCODEC_TESTS-$(call ENCDEC,SNOW)             += snow snowll
202 VCODEC_TESTS-$(call ENCDEC,SVQ1)             += svq1
203 VCODEC_TESTS-$(call ENCDEC,WMV1)             += wmv1
204 VCODEC_TESTS-$(call ENCDEC,WMV2)             += wmv2
205
206 ACODEC_TESTS =
207 ACODEC_TESTS-$(call ENCDEC,AC3)              += ac3
208 ACODEC_TESTS-$(call ENCDEC,ADPCM_G726)       += g726
209 ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_QT)     += adpcm_ima_qt
210 ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_WAV)    += adpcm_ima_wav
211 ACODEC_TESTS-$(call ENCDEC,ADPCM_MS)         += adpcm_ms
212 ACODEC_TESTS-$(call ENCDEC,ADPCM_SWF)        += adpcm_swf
213 ACODEC_TESTS-$(call ENCDEC,ADPCM_YAMAHA)     += adpcm_yam
214 ACODEC_TESTS-$(call ENCDEC,ALAC)             += alac
215 ACODEC_TESTS-$(call ENCDEC,FLAC)             += flac
216 ACODEC_TESTS-$(call ENCDEC,MP2)              += mp2
217 ACODEC_TESTS-$(call ENCDEC,PCM_S16LE)        += pcm         # fixme
218 ACODEC_TESTS-$(call ENCDEC,WMAV1)            += wmav1
219 ACODEC_TESTS-$(call ENCDEC,WMAV1)            += wmav2
220
221 LAVF_TESTS =
222 LAVF_TESTS-$(call MUXDEM,AIFF)               += aiff
223 LAVF_TESTS-$(call MUXDEM,PCM_ALAW)           += alaw
224 LAVF_TESTS-$(call MUXDEM,ASF)                += asf
225 LAVF_TESTS-$(call MUXDEM,AU)                 += au
226 LAVF_TESTS-$(call MUXDEM,AVI)                += avi
227 LAVF_TESTS-$(call ENCDEC,BMP)                += bmp
228 LAVF_TESTS-$(call MUXDEM,DV)                 += dv_fmt
229 LAVF_TESTS-$(call MUXDEM,FFM)                += ffm
230 LAVF_TESTS-$(call MUXDEM,FLV)                += flv_fmt
231 LAVF_TESTS-$(call ENCDEC,GIF)                += gif
232 LAVF_TESTS-$(call MUXDEM,GXF)                += gxf
233 LAVF_TESTS-$(call ENCDEC,MJPEG)              += jpg
234 LAVF_TESTS-$(call MUXDEM,MATROSKA)           += mkv
235 LAVF_TESTS-$(call MUXDEM,MMF)                += mmf
236 LAVF_TESTS-$(call MUXDEM,MOV)                += mov
237 LAVF_TESTS-$(call MUXDEM,MPEG1SYSTEM,MPEGPS) += mpg
238 LAVF_TESTS-$(call MUXDEM,PCM_MULAW)          += mulaw
239 LAVF_TESTS-$(call MUXDEM,MXF)                += mxf
240 LAVF_TESTS-$(call MUXDEM,NUT)                += nut
241 LAVF_TESTS-$(call MUXDEM,OGG)                += ogg
242 LAVF_TESTS-$(call ENCDEC,PBM)                += pbmpipe
243 LAVF_TESTS-$(call ENCDEC,PCX)                += pcx
244 LAVF_TESTS-$(call ENCDEC,PGM)                += pgm pgmpipe
245 LAVF_TESTS-$(call MUXDEM,RAWVIDEO)           += pixfmt
246 LAVF_TESTS-$(call ENCDEC,PPM)                += ppm ppmpipe
247 LAVF_TESTS-$(call MUXDEM,RM)                 += rm
248 LAVF_TESTS-$(call ENCDEC,SGI)                += sgi
249 LAVF_TESTS-$(call MUXDEM,SWF)                += swf
250 LAVF_TESTS-$(call ENCDEC,TARGA)              += tga
251 LAVF_TESTS-$(call ENCDEC,TIFF)               += tiff
252 LAVF_TESTS-$(call MUXDEM,MPEGTS)             += ts
253 LAVF_TESTS-$(call MUXDEM,VOC)                += voc
254 LAVF_TESTS-$(call MUXDEM,WAV)                += wav
255 LAVF_TESTS-$(call MUXDEM,YUV4MPEGPIPE)       += yuv4mpeg
256
257 LAVFI_TESTS =           \
258     crop                \
259     crop_scale          \
260     crop_scale_vflip    \
261     crop_vflip          \
262     null                \
263     scale200            \
264     scale500            \
265     vflip               \
266     vflip_crop          \
267     vflip_vflip         \
268 #   lavfi_pix_fmts      \
269
270 ACODEC_TESTS := $(addprefix regtest-, $(ACODEC_TESTS) $(ACODEC_TESTS-yes))
271 VCODEC_TESTS := $(addprefix regtest-, $(VCODEC_TESTS) $(VCODEC_TESTS-yes))
272 LAVF_TESTS  := $(addprefix regtest-, $(LAVF_TESTS)  $(LAVF_TESTS-yes))
273 LAVFI_TESTS := $(addprefix regtest-, $(LAVFI_TESTS) $(LAVFI_TESTS-yes))
274
275 CODEC_TESTS = $(VCODEC_TESTS) $(ACODEC_TESTS)
276
277 codectest: $(CODEC_TESTS)
278 lavftest:  $(LAVF_TESTS)
279 lavfitest: $(LAVFI_TESTS)
280
281 $(ACODEC_TESTS): regtest-aref
282 $(VCODEC_TESTS): regtest-vref
283 $(LAVF_TESTS) $(LAVFI_TESTS): regtest-ref
284
285 REFFILE = $(SRC_PATH)/tests/ref/$(1)/$(2:regtest-%=%)
286 RESFILE = tests/data/$(2:regtest-%=%).$(1).regression
287
288 define CODECTEST_CMD
289         $(SRC_PATH)/tests/codec-regression.sh $@ vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
290         $(SRC_PATH)/tests/codec-regression.sh $@ vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
291 endef
292
293 regtest-ref: regtest-aref regtest-vref
294
295 regtest-vref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
296         $(CODECTEST_CMD)
297
298 regtest-aref: ffmpeg$(EXESUF) tests/data/asynth1.sw
299         @$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
300
301 $(VCODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
302         @echo "TEST VCODEC $(@:regtest-%=%)"
303         @$(CODECTEST_CMD)
304         @diff -u -w $(call REFFILE,vsynth1,$@) $(call RESFILE,vsynth1,$@)
305         @diff -u -w $(call REFFILE,vsynth2,$@) $(call RESFILE,vsynth2,$@)
306
307 $(ACODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
308         @echo "TEST ACODEC $(@:regtest-%=%)"
309         @$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
310         @diff -u -w $(call REFFILE,acodec,$@) $(call RESFILE,acodec,$@)
311
312 $(LAVF_TESTS):
313         @echo "TEST LAVF  $(@:regtest-%=%)"
314         @$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
315         @diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@)
316
317 $(LAVFI_TESTS): tools/lavfi-showfiltfmts$(EXESUF)
318         @echo "TEST LAVFI $(@:regtest-%=%)"
319         @$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
320         @diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@)
321
322 seektest: codectest lavftest tests/seek_test$(EXESUF)
323         $(SRC_PATH)/tests/seek-regression.sh $(SRC_PATH) "$(TARGET_EXEC)" "$(TARGET_PATH)"
324
325 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
326         @echo
327         @echo "Unfortunately ffserver is broken and therefore its regression"
328         @echo "test fails randomly. Treat the results accordingly."
329         @echo
330         $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
331
332 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
333         mkdir -p tests/vsynth1
334         $(BUILD_ROOT)/$< 'tests/vsynth1/'
335
336 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
337         mkdir -p tests/vsynth2
338         $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
339
340 tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
341         mkdir -p tests/data
342         $(BUILD_ROOT)/$< $@
343
344 tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
345         $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
346
347 include $(SRC_PATH_BARE)/tests/fate.mak
348
349 ifdef SAMPLES
350 fate: $(FATE_TESTS)
351 $(FATE_TESTS): ffmpeg$(EXESUF)
352         @echo "TEST FATE   $(@:fate-%=%)"
353         @$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)'
354 else
355 fate $(FATE_TESTS):
356         @echo "SAMPLES not specified, cannot run FATE"
357 endif
358
359 .PHONY: documentation *test regtest-* zlib-error alltools check config