fate: pass additional variables to test script
[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_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/ffmpeg.pod doc/ffmpeg-doc.html: doc/filters.texi
112 doc/ffplay.pod doc/ffplay-doc.html: doc/filters.texi
113
114 doc/%.html: TAG = HTML
115 doc/%.html: doc/%.texi
116 $(M)cd doc && texi2html -monolithic -number $(<:doc/%=%)
117
118 doc/%.pod: TAG = POD
119 doc/%.pod: doc/%-doc.texi
120 $(M)doc/texi2pod.pl $< $@
121
122 doc/%.1: TAG = MAN
123 doc/%.1: doc/%.pod
124 $(M)pod2man --section=1 --center=" " --release=" " $< > $@
125
126 install: $(INSTALL_TARGETS-yes)
127
128 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
129 $(Q)mkdir -p "$(BINDIR)"
130 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
131
132 install-data: $(DATA_FILES)
133 $(Q)mkdir -p "$(DATADIR)"
134 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
135
136 install-man: $(MANPAGES)
137 $(Q)mkdir -p "$(MANDIR)/man1"
138 $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
139
140 uninstall: uninstall-progs uninstall-data uninstall-man
141
142 uninstall-progs:
143 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
144
145 uninstall-data:
146 $(RM) -r "$(DATADIR)"
147
148 uninstall-man:
149 $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
150
151 testclean:
152 $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
153 $(RM) $(addprefix tests/,$(CLEANSUFFIXES))
154 $(RM) tests/seek_test$(EXESUF) tests/seek_test.o
155 $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
156
157 clean:: testclean
158 $(RM) $(ALLPROGS) $(ALLPROGS_G)
159 $(RM) $(CLEANSUFFIXES)
160 $(RM) doc/*.html doc/*.pod doc/*.1
161 $(RM) $(TOOLS)
162
163 distclean::
164 $(RM) $(DISTCLEANSUFFIXES)
165 $(RM) version.h config.* libavutil/avconfig.h
166
167 config:
168 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
169
170 # regression tests
171
172 check: test checkheaders
173
174 fulltest test: codectest lavftest seektest
175
176 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
177 SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
178
179 LAVFI_TESTS = \
180 crop \
181 crop_scale \
182 crop_scale_vflip \
183 crop_vflip \
184 null \
185 scale200 \
186 scale500 \
187 vflip \
188 vflip_crop \
189 vflip_vflip \
190 lavfi_pixdesc \
191 # lavfi_pix_fmts \
192
193 ACODEC_TESTS := $(addprefix regtest-, $(ACODEC_TESTS) $(ACODEC_TESTS-yes))
194 VCODEC_TESTS := $(addprefix regtest-, $(VCODEC_TESTS) $(VCODEC_TESTS-yes))
195 LAVF_TESTS := $(addprefix regtest-, $(LAVF_TESTS) $(LAVF_TESTS-yes))
196 LAVFI_TESTS := $(addprefix regtest-, $(LAVFI_TESTS) $(LAVFI_TESTS-yes))
197
198 CODEC_TESTS = $(VCODEC_TESTS) $(ACODEC_TESTS)
199
200 codectest: $(CODEC_TESTS)
201 lavftest: $(LAVF_TESTS)
202 lavfitest: $(LAVFI_TESTS)
203
204 AREF = tests/data/acodec.ref.wav
205 VREF = tests/data/vsynth1.ref.yuv
206 REFS = $(AREF) $(VREF)
207
208 $(ACODEC_TESTS): $(AREF)
209 $(VCODEC_TESTS): $(VREF)
210 $(LAVF_TESTS) $(LAVFI_TESTS): $(REFS)
211
212 REFFILE = $(SRC_PATH)/tests/ref/$(1)/$(2:regtest-%=%)
213 RESFILE = tests/data/regression/$(1)/$(2:regtest-%=%)
214
215 define VCODECTEST
216 @echo "TEST VCODEC $(1:regtest-%=%)"
217 $(SRC_PATH)/tests/codec-regression.sh $(1) vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
218 $(SRC_PATH)/tests/codec-regression.sh $(1) vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
219 endef
220
221 define ACODECTEST
222 @echo "TEST ACODEC $(1:regtest-%=%)"
223 $(SRC_PATH)/tests/codec-regression.sh $(1) acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
224 endef
225
226 $(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
227 @$(call VCODECTEST,vref)
228
229 $(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
230 @$(call ACODECTEST,aref)
231
232 $(VCODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
233 @$(call VCODECTEST,$@)
234 @diff -u -w $(call REFFILE,vsynth1,$@) $(call RESFILE,vsynth1,$@)
235 @diff -u -w $(call REFFILE,vsynth2,$@) $(call RESFILE,vsynth2,$@)
236
237 $(ACODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
238 @$(call ACODECTEST,$@)
239 @diff -u -w $(call REFFILE,acodec,$@) $(call RESFILE,acodec,$@)
240
241 $(LAVF_TESTS):
242 @echo "TEST LAVF $(@:regtest-%=%)"
243 @$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
244 @diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@)
245
246 $(LAVFI_TESTS): tools/lavfi-showfiltfmts$(EXESUF)
247 @echo "TEST LAVFI $(@:regtest-%=%)"
248 @$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
249 @diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@)
250
251 seektest: codectest lavftest tests/seek_test$(EXESUF)
252 $(SRC_PATH)/tests/seek-regression.sh $(SRC_PATH) "$(TARGET_EXEC)" "$(TARGET_PATH)"
253
254 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
255 @echo
256 @echo "Unfortunately ffserver is broken and therefore its regression"
257 @echo "test fails randomly. Treat the results accordingly."
258 @echo
259 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
260
261 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
262 @mkdir -p tests/vsynth1
263 $(M)$(BUILD_ROOT)/$< 'tests/vsynth1/'
264
265 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
266 @mkdir -p tests/vsynth2
267 $(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
268
269 tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
270 @mkdir -p tests/data
271 $(M)$(BUILD_ROOT)/$< $@
272
273 tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
274
275 tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
276 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
277
278 include $(SRC_PATH_BARE)/tests/fate.mak
279
280 ifdef SAMPLES
281 fate: $(FATE_TESTS)
282 $(FATE_TESTS): ffmpeg$(EXESUF)
283 @echo "TEST FATE $(@:fate-%=%)"
284 @$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)'
285 else
286 fate $(FATE_TESTS):
287 @echo "SAMPLES not specified, cannot run FATE"
288 endif
289
290 .PHONY: documentation *test regtest-* zlib-error alltools check config