split regression tests allowing make to run them in parallel
[libav.git] / Makefile
CommitLineData
a1b63811 1#
85f07f22 2# Main ffmpeg Makefile
38100e8c 3# (c) 2000-2004 Fabrice Bellard
85f07f22 4#
980fc7b8 5include config.mak
85f07f22 6
997baf01 7VPATH=$(SRC_PATH_BARE)
dd9ca370 8
cbeee4d8 9CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
a163ed1a 10 -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
c721d803 11 -I$(SRC_PATH)/libavdevice \
364a9607 12 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H
115329f1 13LDFLAGS+= -g
37736979 14
0cb8579a
MR
15PROGS-$(CONFIG_FFMPEG) += ffmpeg
16PROGS-$(CONFIG_FFPLAY) += ffplay
17PROGS-$(CONFIG_FFSERVER) += ffserver
01310af2 18
bb8fe69a
DB
19PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
20PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
21MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
85f07f22 22
bb8fe69a
DB
23BASENAMES = ffmpeg ffplay ffserver
24ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
25ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
26ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
6b991cb2 27
0fd94442 28ifeq ($(BUILD_SHARED),yes)
c721d803 29DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavdevice/$(SLIBPREF)avdevice$(SLIBSUF)
0fd94442 30else
c721d803 31DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavdevice/$(LIBPREF)avdevice$(LIBSUF)
f02be79d
RS
32endif
33
7d6ac9a3
MR
34ALL_TARGETS-$(CONFIG_VHOOK) += videohook
35ALL_TARGETS-$(BUILD_DOC) += documentation
36
37INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
1217916b
DB
38ifneq ($(PROGS),)
39INSTALL_TARGETS-yes += install-progs
282db5fd 40INSTALL_TARGETS-$(BUILD_DOC) += install-man
1217916b 41endif
dd9f3d97 42
3b26ee47 43VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
dd9f3d97
MR
44
45BASEHOOKS = fish null watermark
46ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
47ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
48
49HOOKS-$(HAVE_FORK) += ppm
50HOOKS-$(HAVE_IMLIB2) += imlib2
51HOOKS-$(HAVE_FREETYPE2) += drawtext
52
53HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
54
55VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
cbefadbd 56LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
dd9f3d97
MR
57
58VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
cbefadbd 59LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
dd9f3d97
MR
60
61VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
142fc6b9 62
7f0f6e13 63SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
c721d803
LA
64LDFLAGS := -L$(BUILD_ROOT)/libavdevice -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
65EXTRALIBS := -lavdevice$(BUILDSUF) -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
57514323 66
790c9ca7 67ifeq ($(CONFIG_SWSCALER),yes)
06694949 68LDFLAGS+=-L$(BUILD_ROOT)/libswscale
6de9e506 69EXTRALIBS+=-lswscale$(BUILDSUF)
790c9ca7
LA
70endif
71
a11f43a4
MR
72MAKE-yes = $(MAKE)
73MAKE- = : $(MAKE)
74
7d6ac9a3 75all: lib $(PROGS) $(ALL_TARGETS-yes)
85f07f22 76
951bf3e6 77lib:
20963a71
MR
78 $(MAKE) -C libavutil all
79 $(MAKE) -C libavcodec all
80 $(MAKE) -C libavformat all
81 $(MAKE) -C libavdevice all
82 $(MAKE-$(CONFIG_PP)) -C libpostproc all
a11f43a4 83 $(MAKE-$(CONFIG_SWSCALER)) -C libswscale all
85f07f22 84
951bf3e6 85ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
6de9e506 86 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
85f07f22 87
4ce5df08
SS
88ffserver$(EXESUF): ffserver.o cmdutils.o .libs
89 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o cmdutils.o $(EXTRALIBS)
85f07f22 90
951bf3e6 91ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
6de9e506 92 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
01310af2 93
0cfd96cc 94%$(EXESUF): %_g$(EXESUF)
01310af2
FB
95 cp -p $< $@
96 $(STRIP) $@
97
a4da50e1
MR
98SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
99ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
100version.h: $(SVN_ENTRIES)
101endif
102
f1cc88a5 103version.h:
997baf01 104 $(SRC_PATH)/version.sh $(SRC_PATH)
f1cc88a5 105
951bf3e6 106output_example$(EXESUF): output_example.o .libs
18caf192 107 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
8de65d4f 108
1521c500
DB
109tools/%$(EXESUF): tools/%.c
110 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
6da7cc81 111
4566de57 112ffplay.o: CFLAGS += $(SDL_CFLAGS)
2744a37f 113
496cfa3c
MR
114ffmpeg.o ffplay.o ffserver.o: version.h
115
ed5614eb
DB
116videohook: .libs $(HOOKS)
117
118vhook/%$(SLIBSUF): vhook/%.o
3b26ee47 119 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
ed5614eb 120
3b26ee47
MR
121vhook/%.o: vhook/%.c
122 $(CC) $(VHOOKCFLAGS) -c -o $@ $<
123
124%.o: %.c
125 $(CC) $(CFLAGS) -c -o $@ $<
142fc6b9 126
e9b19db8 127documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
d0e1cd3d
DB
128 ffplay-doc.html general.html hooks.html \
129 $(ALLMANPAGES))
e9b19db8
DB
130
131doc/%.html: doc/%.texi
132 texi2html -monolithic -number $<
133 mv $(@F) $@
134
135doc/%.pod: doc/%-doc.texi
136 doc/texi2pod.pl $< $@
137
138doc/%.1: doc/%.pod
139 pod2man --section=1 --center=" " --release=" " $< > $@
146ea952 140
1217916b 141install: install-libs install-headers $(INSTALL_TARGETS-yes)
81dcdc53 142
a4848db6 143ifeq ($(BUILD_SHARED),yes)
e1a3a63f 144install-progs: install-libs
a4848db6 145endif
c4fa7ebc 146install-progs: $(PROGS)
22a324da
DB
147 install -d "$(BINDIR)"
148 install -c -m 755 $(PROGS) "$(BINDIR)"
85f07f22 149
7a7be126 150# Create the Windows installer.
d35ff76b
FB
151wininstaller: all install
152 makensis ffinstall.nsi
153
23a65308 154install-man:
22a324da
DB
155 install -d "$(MANDIR)/man1"
156 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
23a65308 157
ed5614eb 158install-vhook: videohook
22a324da
DB
159 install -d "$(SHLIBDIR)/vhook"
160 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
142fc6b9 161
b12f8273 162install-libs:
20963a71
MR
163 $(MAKE) -C libavutil install-libs
164 $(MAKE) -C libavcodec install-libs
165 $(MAKE) -C libavformat install-libs
166 $(MAKE) -C libavdevice install-libs
167 $(MAKE-$(CONFIG_PP)) -C libpostproc install-libs
a11f43a4 168 $(MAKE-$(CONFIG_SWSCALER)) -C libswscale install-libs
8b2121e3 169ifeq ($(BUILD_SHARED),yes)
1e7ffa50 170 -$(LDCONFIG)
b12f8273 171endif
37736979 172
f29f3b5d 173install-headers:
20963a71
MR
174 $(MAKE) -C libavutil install-headers
175 $(MAKE) -C libavcodec install-headers
176 $(MAKE) -C libavformat install-headers
177 $(MAKE) -C libavdevice install-headers
a11f43a4 178 $(MAKE-$(CONFIG_PP)) -C libpostproc install-headers
20963a71 179 $(MAKE) -C libswscale install-headers
f29f3b5d 180
f9edb717
DB
181uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
182
f9edb717 183uninstall-progs:
1c2211bd 184 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
f9edb717 185
f9edb717 186uninstall-man:
1c2211bd 187 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
f9edb717
DB
188
189uninstall-vhook:
1c2211bd 190 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
22a324da 191 -rmdir "$(SHLIBDIR)/vhook/"
f9edb717
DB
192
193uninstall-libs:
194 $(MAKE) -C libavutil uninstall-libs
195 $(MAKE) -C libavcodec uninstall-libs
196 $(MAKE) -C libavformat uninstall-libs
c721d803 197 $(MAKE) -C libavdevice uninstall-libs
6d9a2421 198 $(MAKE) -C libpostproc uninstall-libs
65f37992 199 $(MAKE) -C libswscale uninstall-libs
f9edb717
DB
200
201uninstall-headers:
202 $(MAKE) -C libavutil uninstall-headers
203 $(MAKE) -C libavcodec uninstall-headers
204 $(MAKE) -C libavformat uninstall-headers
c721d803 205 $(MAKE) -C libavdevice uninstall-headers
6d9a2421 206 $(MAKE) -C libpostproc uninstall-headers
65f37992 207 $(MAKE) -C libswscale uninstall-headers
22a324da 208 -rmdir "$(INCDIR)"
f9edb717 209
3b26ee47 210depend dep: .depend .vhookdep
20963a71
MR
211 $(MAKE) -C libavutil depend
212 $(MAKE) -C libavcodec depend
213 $(MAKE) -C libavformat depend
214 $(MAKE) -C libavdevice depend
215 $(MAKE-$(CONFIG_PP)) -C libpostproc depend
a11f43a4 216 $(MAKE-$(CONFIG_SWSCALER)) -C libswscale depend
4b8b2edb 217
fd071c26 218.depend: $(SRCS) version.h
0032cac2 219 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
3b26ee47 220
2a4592fe 221# gcc stupidly only outputs the basename of targets with -MM
fc900b7b 222.vhookdep: $(ALLHOOKS_SRCS) version.h
3b26ee47 223 $(CC) $(VHOOKCFLAGS) -MM $^ | sed 's,^\([a-z]\),vhook/\1,' > $@
57514323 224
da34f7ac
MR
225$(DEP_LIBS): lib
226
227.libs: $(DEP_LIBS)
228 touch $@
cf2818b0 229
98013cc1 230clean:
5d22ccf7
DB
231 $(MAKE) -C libavutil clean
232 $(MAKE) -C libavcodec clean
abac6175 233 $(MAKE) -C libavformat clean
c721d803 234 $(MAKE) -C libavdevice clean
6d9a2421 235 $(MAKE) -C libpostproc clean
790c9ca7 236 $(MAKE) -C libswscale clean
b8d40825 237 rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
2b258bba 238 output_example$(EXESUF)
e9b19db8 239 rm -f doc/*.html doc/*.pod doc/*.1
4fbd52f0
DB
240 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
241 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
2b258bba 242 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
ed5614eb 243 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
142fc6b9 244
85f07f22 245distclean: clean
98013cc1
DB
246 $(MAKE) -C libavutil distclean
247 $(MAKE) -C libavcodec distclean
248 $(MAKE) -C libavformat distclean
c721d803 249 $(MAKE) -C libavdevice distclean
6d9a2421 250 $(MAKE) -C libpostproc distclean
790c9ca7 251 $(MAKE) -C libswscale distclean
2c8c5021 252 rm -f .depend .vhookdep version.h config.* *.pc
85f07f22
FB
253
254TAGS:
abac6175 255 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 256
dd9ca370
FB
257# regression tests
258
4fbd52f0 259fulltest test: codectest libavtest seektest
4fbd52f0
DB
260
261FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
262FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
263LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
264ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
265SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
266
4383ed5c
MR
267CODEC_TESTS = $(addprefix regtest-, \
268 mpeg \
269 mpeg2 \
270 mpeg2thread \
271 msmpeg4v2 \
272 msmpeg4 \
273 wmv1 \
274 wmv2 \
275 h261 \
276 h263 \
277 h263p \
278 mpeg4 \
279 huffyuv \
280 rc \
281 mpeg4adv \
282 mpeg4thread \
283 mp4psp \
284 error \
285 mpeg4nr \
286 mpeg1b \
287 mjpeg \
288 ljpeg \
289 jpegls \
290 rv10 \
291 rv20 \
292 asv1 \
293 asv2 \
294 flv \
295 ffv1 \
296 snow \
297 snowll \
298 dv \
299 dv50 \
300 svq1 \
301 flashsv \
302 mp2 \
303 ac3 \
304 g726 \
305 adpcm_ima_wav \
306 adpcm_ms \
307 adpcm_yam \
308 adpcm_swf \
309 flac \
310 wma \
311 )
312
313LAVF_TESTS = regtest-lavf
314
315REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
316
317CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
318CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
319
320LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
321
322LAVF_REG = tests/data/lavf.regression
323ROTOZOOM_REG = tests/data/rotozoom.regression
324VSYNTH_REG = tests/data/vsynth.regression
325
326codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
327 diff -u $(FFMPEG_REFFILE) $(VSYNTH_REG)
328 diff -u $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
329
330libavtest: $(LAVF_REG)
331 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
332
333$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
334 cat $^ > $@
335
336$(LAVF_REG): $(LAVF_REGFILES)
337$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
338$(VSYNTH_REG): $(CODEC_VSYNTH)
339
340$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
341
342$(LAVF_REGFILES): $(LAVF_TESTS)
343
344$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
345
346regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
347
348$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
349 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1
350 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2
351
352$(LAVF_TESTS):
353 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1
354
355seektest: codectest libavtest tests/seek_test$(EXESUF)
356 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
357
b13cdd33 358test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0
DB
359 @echo
360 @echo "Unfortunately ffserver is broken and therefore its regression"
361 @echo "test fails randomly. Treat the results accordingly."
362 @echo
363 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
364
4fbd52f0 365ifeq ($(CONFIG_SWSCALER),yes)
4383ed5c 366test-server codectest $(CODEC_TESTS) libavtest: swscale_error
4fbd52f0
DB
367swscale_error:
368 @echo
369 @echo "This regression test is incompatible with --enable-swscaler."
370 @echo
371 @exit 1
372endif
373
374tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
375 mkdir -p tests/vsynth1
376 $(BUILD_ROOT)/$< 'tests/vsynth1/'
377
378tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
379 mkdir -p tests/vsynth2
380 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
381
382tests/asynth1.sw: tests/audiogen$(EXESUF)
383 $(BUILD_ROOT)/$< $@
384
385%$(EXESUF): %.c
386 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
387
06396e11 388tests/seek_test$(EXESUF): tests/seek_test.c .libs
ff21c1b0 389 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(EXTRALIBS)
4fbd52f0 390
dd9ca370 391
3263626f 392.PHONY: all lib videohook documentation install* wininstaller uninstall*
bedb3550 393.PHONY: dep depend clean distclean TAGS
5e2dfd39 394.PHONY: codectest libavtest seektest test-server fulltest test
4383ed5c 395.PHONY: $(CODEC_TESTS) $(LAVF_TESTS) regtest-ref swscale-error
cf2818b0 396
6ca0c110 397-include .depend
3b26ee47 398-include .vhookdep