regtest: split reference files allowing tests to run individually
[libav.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_FFSERVER) += ffserver
10
11 PROGS := $(addsuffix $(EXESUF), $(PROGS-yes))
12 PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
13 OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
14 MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
15 TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
16 HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
17
18 BASENAMES = ffmpeg ffplay ffserver
19 ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
20 ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
21 ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
22
23 FFLIBS-$(CONFIG_AVFILTER) += avfilter
24 FFLIBS-$(CONFIG_POSTPROC) += postproc
25
26 FFLIBS := avdevice avformat avcodec avutil swscale
27
28 DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
29
30 include common.mak
31
32 FF_LDFLAGS := $(FFLDFLAGS)
33 FF_EXTRALIBS := $(FFEXTRALIBS)
34 FF_DEP_LIBS := $(DEP_LIBS)
35
36 ALL_TARGETS-$(CONFIG_DOC) += documentation
37
38 ifdef PROGS
39 INSTALL_TARGETS-yes += install-progs install-data
40 INSTALL_TARGETS-$(CONFIG_DOC) += install-man
41 endif
42 INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
43
44 all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
45
46 $(PROGS): %$(EXESUF): %_g$(EXESUF)
47 cp -p $< $@
48 $(STRIP) $@
49
50 SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
51 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
52 HOSTPROGS
53
54 define RESET
55 $(1) :=
56 $(1)-yes :=
57 endef
58
59 define DOSUBDIR
60 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
61 SUBDIR := $(1)/
62 include $(1)/Makefile
63 endef
64
65 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
66
67 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
68 ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
69
70 %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
71 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
72
73 tools/%$(EXESUF): tools/%.o
74 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
75
76 tools/%.o: tools/%.c
77 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
78
79 ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
80
81 cmdutils.o cmdutils.d: version.h
82
83 alltools: $(TOOLS)
84
85 documentation: $(addprefix doc/, developer.html faq.html ffmpeg-doc.html \
86 ffplay-doc.html ffserver-doc.html \
87 general.html libavfilter.html $(ALLMANPAGES))
88
89 doc/%.html: doc/%.texi
90 texi2html -monolithic -number $<
91 mv $(@F) $@
92
93 doc/%.pod: doc/%-doc.texi
94 doc/texi2pod.pl $< $@
95
96 doc/%.1: doc/%.pod
97 pod2man --section=1 --center=" " --release=" " $< > $@
98
99 install: $(INSTALL_TARGETS-yes)
100
101 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
102 install -d "$(BINDIR)"
103 install -c -m 755 $(PROGS) "$(BINDIR)"
104
105 install-data: $(DATA_FILES)
106 install -d "$(DATADIR)"
107 install -m 644 $(DATA_FILES) "$(DATADIR)"
108
109 install-man: $(MANPAGES)
110 install -d "$(MANDIR)/man1"
111 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
112
113 uninstall:
114 @echo "I'm sorry, Dave. I'm afraid I can't do that"
115
116 testclean:
117 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/*~
118
119 clean:: testclean
120 rm -f $(ALLPROGS) $(ALLPROGS_G)
121 rm -f $(CLEANSUFFIXES)
122 rm -f doc/*.html doc/*.pod doc/*.1
123 rm -f tests/seek_test$(EXESUF) tests/seek_test.o
124 rm -f $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
125 rm -f $(TOOLS)
126
127 distclean::
128 rm -f $(DISTCLEANSUFFIXES)
129 rm -f version.h config.*
130
131 config:
132 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
133
134 # regression tests
135
136 check: test checkheaders
137
138 fulltest test: codectest lavftest seektest
139
140 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
141 SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
142
143 CODEC_TESTS = $(addprefix regtest-, \
144 mpeg \
145 mpeg2 \
146 mpeg2thread \
147 msmpeg4v2 \
148 msmpeg4 \
149 wmv1 \
150 wmv2 \
151 h261 \
152 h263 \
153 h263p \
154 mpeg4 \
155 huffyuv \
156 rc \
157 mpeg4adv \
158 mpeg4thread \
159 error \
160 mpeg4nr \
161 mpeg1b \
162 mjpeg \
163 ljpeg \
164 jpegls \
165 rv10 \
166 rv20 \
167 asv1 \
168 asv2 \
169 flv \
170 ffv1 \
171 snow \
172 snowll \
173 dv \
174 dv50 \
175 dnxhd_1080i \
176 dnxhd_720p \
177 dnxhd_720p_rd \
178 svq1 \
179 flashsv \
180 roq \
181 mp2 \
182 ac3 \
183 g726 \
184 adpcm_ima_wav \
185 adpcm_ima_qt \
186 adpcm_ms \
187 adpcm_yam \
188 adpcm_swf \
189 alac \
190 flac \
191 wma \
192 pcm \
193 )
194
195 LAVF_TESTS = $(addprefix regtest-, \
196 avi \
197 asf \
198 rm \
199 mpg \
200 mxf \
201 ts \
202 swf \
203 ffm \
204 flv_fmt \
205 mov \
206 dv_fmt \
207 gxf \
208 nut \
209 mkv \
210 pbmpipe \
211 pgmpipe \
212 ppmpipe \
213 gif \
214 yuv4mpeg \
215 pgm \
216 ppm \
217 bmp \
218 tga \
219 tiff \
220 sgi \
221 jpg \
222 wav \
223 alaw \
224 mulaw \
225 au \
226 mmf \
227 aiff \
228 voc \
229 ogg \
230 pixfmt \
231 pcx \
232 )
233
234 LAVFI_TESTS = $(addprefix regtest-, \
235 )
236
237 ifneq ($(CONFIG_ZLIB),yes)
238 regtest-flashsv codectest: zlib-error
239 endif
240 zlib-error:
241 @echo
242 @echo "This regression test requires zlib."
243 @echo
244 @exit 1
245
246 codectest: $(CODEC_TESTS)
247 lavftest: $(LAVF_TESTS)
248
249 # lavfitest: $(LAVFI_TESTS)
250
251 $(CODEC_TESTS) $(LAVF_TESTS) $(LAVFI_TESTS): regtest-ref
252
253 REFFILE = $(SRC_PATH)/tests/ref/$(1)/$(2:regtest-%=%)
254 RESFILE = tests/data/$(2:regtest-%=%).$(1).regression
255
256 define CODECTEST_CMD
257 $(SRC_PATH)/tests/codec-regression.sh $@ vsynth1 tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
258 $(SRC_PATH)/tests/codec-regression.sh $@ vsynth2 tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
259 endef
260
261 regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/data/asynth1.sw
262 $(CODECTEST_CMD)
263
264 $(CODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
265 @echo "TEST CODEC $(@:regtest-%=%)"
266 @$(CODECTEST_CMD)
267 @diff -u -w $(call REFFILE,vsynth1,$@) $(call RESFILE,vsynth1,$@)
268 @diff -u -w $(call REFFILE,vsynth2,$@) $(call RESFILE,vsynth2,$@)
269
270 $(LAVF_TESTS):
271 @echo "TEST LAVF $(@:regtest-%=%)"
272 @$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
273 @diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@)
274
275 $(LAVFI_TESTS):
276 @echo "TEST LAVFI $(@:regtest-%=%)"
277 @$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
278 @diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@)
279
280 seektest: codectest lavftest tests/seek_test$(EXESUF)
281 $(SRC_PATH)/tests/seek-regression.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
282
283 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
284 @echo
285 @echo "Unfortunately ffserver is broken and therefore its regression"
286 @echo "test fails randomly. Treat the results accordingly."
287 @echo
288 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
289
290 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
291 mkdir -p tests/vsynth1
292 $(BUILD_ROOT)/$< 'tests/vsynth1/'
293
294 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
295 mkdir -p tests/vsynth2
296 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
297
298 tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
299 mkdir -p tests/data
300 $(BUILD_ROOT)/$< $@
301
302 tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
303 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
304
305
306 .PHONY: documentation *test regtest-* zlib-error alltools check config