Collect list of seek tests in configure
[libav.git] / Makefile
CommitLineData
bde51e6a
JR
1include config.mak
2
3SRC_DIR = $(SRC_PATH_BARE)
4
5vpath %.texi $(SRC_PATH_BARE)
6
7PROGS-$(CONFIG_FFMPEG) += ffmpeg
8PROGS-$(CONFIG_FFPLAY) += ffplay
336ce917 9PROGS-$(CONFIG_FFPROBE) += ffprobe
bde51e6a
JR
10PROGS-$(CONFIG_FFSERVER) += ffserver
11
00962aba 12PROGS := $(addsuffix $(EXESUF), $(PROGS-yes))
bde51e6a
JR
13PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
14OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
15MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
dd46b538 16HTMLPAGES = $(addprefix doc/, $(addsuffix -doc.html, $(PROGS-yes)))
94f3c0e5 17TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
de4070b5 18HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
bde51e6a 19
336ce917 20BASENAMES = ffmpeg ffplay ffprobe ffserver
bde51e6a
JR
21ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
22ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
23ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
dd46b538 24ALLHTMLPAGES= $(addsuffix -doc.html, $(BASENAMES))
bde51e6a 25
5a0f7131 26FFLIBS-$(CONFIG_AVDEVICE) += avdevice
bde51e6a 27FFLIBS-$(CONFIG_AVFILTER) += avfilter
5a0f7131 28FFLIBS-$(CONFIG_AVFORMAT) += avformat
97d5fa38 29FFLIBS-$(CONFIG_AVCODEC) += avcodec
bde51e6a 30FFLIBS-$(CONFIG_POSTPROC) += postproc
5a0f7131 31FFLIBS-$(CONFIG_SWSCALE) += swscale
bde51e6a 32
5a0f7131 33FFLIBS := avutil
bde51e6a 34
a1a84f69
RS
35DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
36
9b55e2e7
MR
37SKIPHEADERS = cmdutils_common_opts.h
38
bde51e6a
JR
39include common.mak
40
41FF_LDFLAGS := $(FFLDFLAGS)
42FF_EXTRALIBS := $(FFEXTRALIBS)
43FF_DEP_LIBS := $(DEP_LIBS)
44
c73f65d9 45ALL_TARGETS-$(CONFIG_DOC) += documentation
bde51e6a 46
a48289c7 47ifdef PROGS
a1a84f69 48INSTALL_TARGETS-yes += install-progs install-data
c73f65d9 49INSTALL_TARGETS-$(CONFIG_DOC) += install-man
bde51e6a 50endif
bea81a52 51INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
bde51e6a
JR
52
53all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
54
55$(PROGS): %$(EXESUF): %_g$(EXESUF)
4335125c 56 $(CP) $< $@
bde51e6a
JR
57 $(STRIP) $@
58
95f2c769 59SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
de4070b5 60 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
f89c1402 61 HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS
bde51e6a
JR
62
63define RESET
64$(1) :=
65$(1)-yes :=
66endef
67
68define DOSUBDIR
69$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
70SUBDIR := $(1)/
71include $(1)/Makefile
72endef
73
74$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
75
76ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
77ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
78
79%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
684b28e0 80 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
bde51e6a 81
2dfa3054
MR
82tools/%$(EXESUF): tools/%.o
83 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
84
2205da0d 85tools/%.o: tools/%.c
2dfa3054 86 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
bde51e6a
JR
87
88ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
89
6a53fffd 90VERSION_SH = $(SRC_PATH_BARE)/version.sh
f82bf850 91GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD
6a53fffd
MR
92SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
93
f82bf850 94.version: $(wildcard $(GIT_LOG) $(SVN_ENTRIES)) $(VERSION_SH) config.mak
6a53fffd
MR
95.version: M=@
96
97version.h .version:
0853a2b4 98 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
6a53fffd
MR
99 $(Q)touch .version
100
101# force version.sh to run whenever version might have changed
102-include .version
36798f1b 103
13b1c80b 104alltools: $(TOOLS)
9bce82fa 105
dd46b538
SS
106documentation: $(addprefix doc/, developer.html faq.html general.html libavfilter.html \
107 $(ALLHTMLPAGES) $(ALLMANPAGES))
108
109$(HTMLPAGES) $(MANPAGES): doc/fftools-common-opts.texi
bde51e6a 110
3275ac6a
SS
111doc/ffmpeg.pod doc/ffmpeg-doc.html: doc/filters.texi
112doc/ffplay.pod doc/ffplay-doc.html: doc/filters.texi
113
7732f641 114doc/%.html: TAG = HTML
bde51e6a 115doc/%.html: doc/%.texi
86be2bc3 116 $(M)cd doc && texi2html -monolithic -number $(<:doc/%=%)
bde51e6a 117
7732f641 118doc/%.pod: TAG = POD
bde51e6a 119doc/%.pod: doc/%-doc.texi
86be2bc3 120 $(M)doc/texi2pod.pl $< $@
bde51e6a 121
7732f641 122doc/%.1: TAG = MAN
bde51e6a 123doc/%.1: doc/%.pod
86be2bc3 124 $(M)pod2man --section=1 --center=" " --release=" " $< > $@
bde51e6a
JR
125
126install: $(INSTALL_TARGETS-yes)
127
128install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
63611f31 129 $(Q)mkdir -p "$(BINDIR)"
fd676deb 130 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
bde51e6a 131
a1a84f69 132install-data: $(DATA_FILES)
63611f31 133 $(Q)mkdir -p "$(DATADIR)"
fd676deb 134 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 135
bde51e6a 136install-man: $(MANPAGES)
63611f31 137 $(Q)mkdir -p "$(MANDIR)/man1"
fd676deb 138 $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
bde51e6a 139
d3cb93b3
RP
140uninstall: uninstall-progs uninstall-data uninstall-man
141
142uninstall-progs:
50e10cbd 143 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
d3cb93b3
RP
144
145uninstall-data:
50e10cbd 146 $(RM) -r "$(DATADIR)"
d3cb93b3
RP
147
148uninstall-man:
50e10cbd 149 $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
bde51e6a 150
250dd6f0 151testclean:
50e10cbd
MR
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))
250dd6f0
FC
156
157clean:: testclean
50e10cbd
MR
158 $(RM) $(ALLPROGS) $(ALLPROGS_G)
159 $(RM) $(CLEANSUFFIXES)
160 $(RM) doc/*.html doc/*.pod doc/*.1
161 $(RM) $(TOOLS)
bde51e6a
JR
162
163distclean::
50e10cbd
MR
164 $(RM) $(DISTCLEANSUFFIXES)
165 $(RM) version.h config.* libavutil/avconfig.h
bde51e6a 166
0c3b2d65
MR
167config:
168 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
169
bde51e6a
JR
170# regression tests
171
5bab8536
DB
172check: test checkheaders
173
1cde611d 174fulltest test: codectest lavftest seektest
bde51e6a 175
bde51e6a 176FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
bde51e6a
JR
177SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
178
c676895f
MR
179ACODEC_TESTS := $(addprefix regtest-, $(ACODEC_TESTS) $(ACODEC_TESTS-yes))
180VCODEC_TESTS := $(addprefix regtest-, $(VCODEC_TESTS) $(VCODEC_TESTS-yes))
05e24fa8
MR
181LAVF_TESTS := $(addprefix regtest-, $(LAVF_TESTS) $(LAVF_TESTS-yes))
182LAVFI_TESTS := $(addprefix regtest-, $(LAVFI_TESTS) $(LAVFI_TESTS-yes))
20a93972 183
c676895f
MR
184CODEC_TESTS = $(VCODEC_TESTS) $(ACODEC_TESTS)
185
eca478c3
MR
186codectest: $(CODEC_TESTS)
187lavftest: $(LAVF_TESTS)
cec96e8d 188lavfitest: $(LAVFI_TESTS)
40e02409 189
9770a7ad
MR
190AREF = tests/data/acodec.ref.wav
191VREF = tests/data/vsynth1.ref.yuv
192REFS = $(AREF) $(VREF)
193
194$(ACODEC_TESTS): $(AREF)
195$(VCODEC_TESTS): $(VREF)
196$(LAVF_TESTS) $(LAVFI_TESTS): $(REFS)
bde51e6a 197
eca478c3 198REFFILE = $(SRC_PATH)/tests/ref/$(1)/$(2:regtest-%=%)
f955d452 199RESFILE = tests/data/regression/$(1)/$(2:regtest-%=%)
bde51e6a 200
e1621087
MR
201define VCODECTEST
202 @echo "TEST VCODEC $(1:regtest-%=%)"
203 $(SRC_PATH)/tests/codec-regression.sh $(1) vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
204 $(SRC_PATH)/tests/codec-regression.sh $(1) vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
205endef
206
207define ACODECTEST
208 @echo "TEST ACODEC $(1:regtest-%=%)"
209 $(SRC_PATH)/tests/codec-regression.sh $(1) acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
eca478c3 210endef
bde51e6a 211
9be24c60 212$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
e1621087 213 @$(call VCODECTEST,vref)
bde51e6a 214
9be24c60 215$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
e1621087 216 @$(call ACODECTEST,aref)
c676895f
MR
217
218$(VCODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
e1621087 219 @$(call VCODECTEST,$@)
eca478c3
MR
220 @diff -u -w $(call REFFILE,vsynth1,$@) $(call RESFILE,vsynth1,$@)
221 @diff -u -w $(call REFFILE,vsynth2,$@) $(call RESFILE,vsynth2,$@)
bde51e6a 222
c676895f 223$(ACODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
e1621087 224 @$(call ACODECTEST,$@)
c676895f
MR
225 @diff -u -w $(call REFFILE,acodec,$@) $(call RESFILE,acodec,$@)
226
bde51e6a 227$(LAVF_TESTS):
eca478c3 228 @echo "TEST LAVF $(@:regtest-%=%)"
801b571e 229 @$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
eca478c3 230 @diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@)
bde51e6a 231
e34d5db5 232$(LAVFI_TESTS): tools/lavfi-showfiltfmts$(EXESUF)
eca478c3 233 @echo "TEST LAVFI $(@:regtest-%=%)"
801b571e 234 @$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
eca478c3 235 @diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@)
40e02409 236
1cde611d 237seektest: codectest lavftest tests/seek_test$(EXESUF)
d7096d6f 238 $(SRC_PATH)/tests/seek-regression.sh $(SRC_PATH) "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 239
d7167f05 240ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
bde51e6a
JR
241 @echo
242 @echo "Unfortunately ffserver is broken and therefore its regression"
243 @echo "test fails randomly. Treat the results accordingly."
244 @echo
767e14c3 245 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
bde51e6a 246
82bb3329 247tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
4ab20de6
MR
248 @mkdir -p tests/vsynth1
249 $(M)$(BUILD_ROOT)/$< 'tests/vsynth1/'
bde51e6a 250
82bb3329 251tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
4ab20de6
MR
252 @mkdir -p tests/vsynth2
253 $(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
bde51e6a 254
d7167f05 255tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
4ab20de6
MR
256 @mkdir -p tests/data
257 $(M)$(BUILD_ROOT)/$< $@
258
259tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
bde51e6a 260
684b28e0
MR
261tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
262 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
bde51e6a 263
2fad0977 264include $(SRC_PATH_BARE)/tests/fate.mak
7e264ca1
MR
265include $(SRC_PATH_BARE)/tests/fate2.mak
266
267FATE_TESTS += $(FATE2_TESTS)
666d7d18
MR
268
269ifdef SAMPLES
2fad0977 270fate: $(FATE_TESTS)
7e264ca1 271fate2: $(FATE2_TESTS)
aab3ea5f 272$(FATE_TESTS): ffmpeg$(EXESUF) tests/tiny_psnr$(HOSTEXESUF)
2fad0977 273 @echo "TEST FATE $(@:fate-%=%)"
2e204aeb 274 $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)'
2fad0977 275else
7e264ca1 276fate fate2 $(FATE_TESTS):
2fad0977
MR
277 @echo "SAMPLES not specified, cannot run FATE"
278endif
bde51e6a 279
34ae2d90 280.PHONY: documentation *test regtest-* alltools check config