PCM regression tests.
[libav.git] / Makefile
CommitLineData
980fc7b8 1include config.mak
85f07f22 2
a426bbfc
MR
3SRC_DIR = $(SRC_PATH_BARE)
4
de2f77d8 5vpath %.texi $(SRC_PATH_BARE)
dd9ca370 6
0cb8579a
MR
7PROGS-$(CONFIG_FFMPEG) += ffmpeg
8PROGS-$(CONFIG_FFPLAY) += ffplay
9PROGS-$(CONFIG_FFSERVER) += ffserver
01310af2 10
bb8fe69a
DB
11PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
12PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
caec74dd 13OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
bb8fe69a 14MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
85f07f22 15
bb8fe69a
DB
16BASENAMES = ffmpeg ffplay ffserver
17ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
18ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
19ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
6b991cb2 20
b8fcb619
MR
21FFLIBS-$(CONFIG_AVFILTER) += avfilter
22FFLIBS-$(CONFIG_POSTPROC) += postproc
23FFLIBS-$(CONFIG_SWSCALE) += swscale
43527e3e 24
b8fcb619 25FFLIBS := avdevice avformat avcodec avutil
f02be79d 26
71c61f62
MR
27include common.mak
28
29FF_LDFLAGS := $(FFLDFLAGS)
30FF_EXTRALIBS := $(FFEXTRALIBS)
791a3fc8 31FF_DEP_LIBS := $(DEP_LIBS)
71c61f62 32
7d6ac9a3
MR
33ALL_TARGETS-$(CONFIG_VHOOK) += videohook
34ALL_TARGETS-$(BUILD_DOC) += documentation
35
36INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
1217916b
DB
37ifneq ($(PROGS),)
38INSTALL_TARGETS-yes += install-progs
282db5fd 39INSTALL_TARGETS-$(BUILD_DOC) += install-man
1217916b 40endif
dfd10838 41INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
dd9f3d97 42
791a3fc8 43all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
27217159 44
473a88ca 45$(PROGS): %$(EXESUF): %_g$(EXESUF)
27217159
DB
46 cp -p $< $@
47 $(STRIP) $@
48
54381d75 49SUBDIR_VARS := OBJS ASM_OBJS CPP_OBJS FFLIBS CLEANFILES DIRS TESTS
9bcc2883 50
71c61f62
MR
51define RESET
52$(1) :=
53$(1)-yes :=
54endef
7716f7ff 55
71c61f62
MR
56define DOSUBDIR
57$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
58SUBDIR := $(1)/
59include $(1)/Makefile
60endef
61
62$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
b8fcb619 63
71c61f62
MR
64ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
65ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
85f07f22 66
791a3fc8 67%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
71c61f62 68 $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
01310af2 69
791a3fc8 70output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
71c61f62 71 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
8de65d4f 72
1521c500 73tools/%$(EXESUF): tools/%.c
71c61f62 74 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
6da7cc81 75
d1300235 76ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
496cfa3c 77
465d9b1f
MR
78VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
79
80BASEHOOKS = fish null watermark
81ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
82ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
83
84HOOKS-$(HAVE_FORK) += ppm
85HOOKS-$(HAVE_IMLIB2) += imlib2
86HOOKS-$(HAVE_FREETYPE2) += drawtext
87
88HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
89
90VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
91LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
92
93VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
94LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
95
96VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
97
caec74dd 98vhook/%.o vhook/%.d: CFLAGS:=$(VHOOKCFLAGS)
465d9b1f 99
bab785a5 100# vhooks compile fine without libav*, but need them nonetheless.
791a3fc8 101videohook: $(FF_DEP_LIBS) $(HOOKS)
ed5614eb 102
9987769a 103$(eval VHOOKSHFLAGS=$(VHOOKSHFLAGS))
ed5614eb 104vhook/%$(SLIBSUF): vhook/%.o
3b26ee47 105 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
ed5614eb 106
caec74dd
MR
107VHOOK_DEPS = $(HOOKS:$(SLIBSUF)=.d)
108depend dep: $(VHOOK_DEPS)
465d9b1f 109
e9b19db8 110documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
d0e1cd3d
DB
111 ffplay-doc.html general.html hooks.html \
112 $(ALLMANPAGES))
e9b19db8
DB
113
114doc/%.html: doc/%.texi
115 texi2html -monolithic -number $<
116 mv $(@F) $@
117
118doc/%.pod: doc/%-doc.texi
119 doc/texi2pod.pl $< $@
120
121doc/%.1: doc/%.pod
122 pod2man --section=1 --center=" " --release=" " $< > $@
146ea952 123
a7319cc2
DB
124install: $(INSTALL_TARGETS-yes)
125
c1ac39b3 126install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
22a324da
DB
127 install -d "$(BINDIR)"
128 install -c -m 755 $(PROGS) "$(BINDIR)"
85f07f22 129
d05e360c 130install-man: $(MANPAGES)
22a324da
DB
131 install -d "$(MANDIR)/man1"
132 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
23a65308 133
ed5614eb 134install-vhook: videohook
22a324da
DB
135 install -d "$(SHLIBDIR)/vhook"
136 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
142fc6b9 137
7716f7ff 138uninstall: uninstall-progs uninstall-man uninstall-vhook
f9edb717 139
f9edb717 140uninstall-progs:
1c2211bd 141 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
f9edb717 142
f9edb717 143uninstall-man:
1c2211bd 144 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
f9edb717
DB
145
146uninstall-vhook:
1c2211bd 147 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
22a324da 148 -rmdir "$(SHLIBDIR)/vhook/"
f9edb717 149
7716f7ff 150clean::
1eacdcc6 151 rm -f $(ALLPROGS) $(ALLPROGS_G) output_example$(EXESUF)
e9b19db8 152 rm -f doc/*.html doc/*.pod doc/*.1
4fbd52f0
DB
153 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
154 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
2b258bba 155 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
ed5614eb 156 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
142fc6b9 157
7716f7ff 158distclean::
25cd5cb3 159 rm -f version.h config.* vhook/*.d
85f07f22 160
dd9ca370
FB
161# regression tests
162
4fbd52f0 163fulltest test: codectest libavtest seektest
4fbd52f0
DB
164
165FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
166FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
167LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
168ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
169SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
170
4383ed5c
MR
171CODEC_TESTS = $(addprefix regtest-, \
172 mpeg \
173 mpeg2 \
174 mpeg2thread \
175 msmpeg4v2 \
176 msmpeg4 \
177 wmv1 \
178 wmv2 \
179 h261 \
180 h263 \
181 h263p \
182 mpeg4 \
183 huffyuv \
184 rc \
185 mpeg4adv \
186 mpeg4thread \
4383ed5c
MR
187 error \
188 mpeg4nr \
189 mpeg1b \
190 mjpeg \
191 ljpeg \
192 jpegls \
193 rv10 \
194 rv20 \
195 asv1 \
196 asv2 \
197 flv \
198 ffv1 \
199 snow \
200 snowll \
201 dv \
202 dv50 \
203 svq1 \
204 flashsv \
205 mp2 \
206 ac3 \
207 g726 \
208 adpcm_ima_wav \
9dc92a38 209 adpcm_ima_qt \
4383ed5c
MR
210 adpcm_ms \
211 adpcm_yam \
212 adpcm_swf \
213 flac \
214 wma \
4f5c72e8 215 pcm \
4383ed5c
MR
216 )
217
2009721d
MR
218LAVF_TESTS = $(addprefix regtest-, \
219 avi \
220 asf \
221 rm \
222 mpg \
223 ts \
224 swf \
225 ffm \
226 flv_fmt \
227 mov \
228 dv_fmt \
229 gxf \
230 nut \
231 mkv \
232 pbmpipe \
233 pgmpipe \
234 ppmpipe \
235 gif \
236 yuv4mpeg \
237 pgm \
238 ppm \
239 bmp \
240 tga \
241 tiff \
242 sgi \
243 jpg \
244 wav \
245 alaw \
246 mulaw \
247 au \
248 mmf \
249 aiff \
250 voc \
251 ogg \
252 pixfmt \
253 )
4383ed5c
MR
254
255REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
256
257CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
258CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
259
260LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
261
262LAVF_REG = tests/data/lavf.regression
263ROTOZOOM_REG = tests/data/rotozoom.regression
264VSYNTH_REG = tests/data/vsynth.regression
265
2ece2e97
DB
266ifeq ($(CONFIG_SWSCALE),yes)
267servertest codectest $(CODEC_TESTS) libavtest: swscale_error
268swscale_error:
269 @echo
270 @echo "This regression test is incompatible with --enable-swscale."
271 @echo
272 @exit 1
273endif
274
4383ed5c 275codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
4411cb11
MR
276 diff -u -w $(FFMPEG_REFFILE) $(VSYNTH_REG)
277 diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
4383ed5c
MR
278
279libavtest: $(LAVF_REG)
280 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
281
282$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
283 cat $^ > $@
284
285$(LAVF_REG): $(LAVF_REGFILES)
286$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
287$(VSYNTH_REG): $(CODEC_VSYNTH)
288
289$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
290
291$(LAVF_REGFILES): $(LAVF_TESTS)
292
293$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
294
295regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
296
297$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
2009721d
MR
298 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a
299 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a
4383ed5c
MR
300
301$(LAVF_TESTS):
2009721d 302 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b
4383ed5c
MR
303
304seektest: codectest libavtest tests/seek_test$(EXESUF)
305 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
306
60598b2f 307servertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0
DB
308 @echo
309 @echo "Unfortunately ffserver is broken and therefore its regression"
310 @echo "test fails randomly. Treat the results accordingly."
311 @echo
312 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
313
4fbd52f0
DB
314tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
315 mkdir -p tests/vsynth1
316 $(BUILD_ROOT)/$< 'tests/vsynth1/'
317
318tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
319 mkdir -p tests/vsynth2
320 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
321
322tests/asynth1.sw: tests/audiogen$(EXESUF)
323 $(BUILD_ROOT)/$< $@
324
325%$(EXESUF): %.c
71c61f62 326 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $<
4fbd52f0 327
791a3fc8 328tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
71c61f62 329 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
4fbd52f0 330
dd9ca370 331
936d4891 332.PHONY: lib videohook documentation *test regtest-* swscale-error
cf2818b0 333
caec74dd 334-include $(VHOOK_DEPS)