Implement fate-rsync target
[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
583fcb52 12PROGS := $(PROGS-yes:%=%$(EXESUF))
583fcb52
MR
13OBJS = $(PROGS-yes:%=%.o) cmdutils.o
14MANPAGES = $(PROGS-yes:%=doc/%.1)
15PODPAGES = $(PROGS-yes:%=doc/%.pod)
16HTMLPAGES = $(PROGS-yes:%=doc/%.html)
cd6a5a57 17TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws graph2dot lavfi-showfiltfmts pktdumper probetest qt-faststart trasher))
3d157bf3
MR
18TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
19HOSTPROGS := $(TESTTOOLS:%=tests/%)
bde51e6a 20
336ce917 21BASENAMES = ffmpeg ffplay ffprobe ffserver
583fcb52 22ALLPROGS = $(BASENAMES:%=%$(EXESUF))
583fcb52 23ALLMANPAGES = $(BASENAMES:%=%.1)
bde51e6a 24
5a0f7131 25FFLIBS-$(CONFIG_AVDEVICE) += avdevice
bde51e6a 26FFLIBS-$(CONFIG_AVFILTER) += avfilter
5a0f7131 27FFLIBS-$(CONFIG_AVFORMAT) += avformat
97d5fa38 28FFLIBS-$(CONFIG_AVCODEC) += avcodec
bde51e6a 29FFLIBS-$(CONFIG_POSTPROC) += postproc
5a0f7131 30FFLIBS-$(CONFIG_SWSCALE) += swscale
bde51e6a 31
5a0f7131 32FFLIBS := avutil
bde51e6a 33
a1a84f69
RS
34DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
35
9b55e2e7
MR
36SKIPHEADERS = cmdutils_common_opts.h
37
bde51e6a
JR
38include common.mak
39
40FF_LDFLAGS := $(FFLDFLAGS)
41FF_EXTRALIBS := $(FFEXTRALIBS)
42FF_DEP_LIBS := $(DEP_LIBS)
43
c73f65d9 44ALL_TARGETS-$(CONFIG_DOC) += documentation
bde51e6a 45
a48289c7 46ifdef PROGS
a1a84f69 47INSTALL_TARGETS-yes += install-progs install-data
c73f65d9 48INSTALL_TARGETS-$(CONFIG_DOC) += install-man
bde51e6a 49endif
bea81a52 50INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
bde51e6a
JR
51
52all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
53
86601915
MR
54config.h: .config
55.config: $(wildcard $(FFLIBS:%=$(SRC_DIR)/lib%/all*.c))
9d0b3042
MR
56 @-tput bold 2>/dev/null
57 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
58 @-tput sgr0 2>/dev/null
86601915 59
95f2c769 60SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
de4070b5 61 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
a7878c9f 62 HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS
bde51e6a
JR
63
64define RESET
65$(1) :=
66$(1)-yes :=
67endef
68
69define DOSUBDIR
70$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
71SUBDIR := $(1)/
72include $(1)/Makefile
73endef
74
75$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
76
e0be794a
MR
77ffplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
78ffserver$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
bde51e6a 79
e0be794a 80%$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
684b28e0 81 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
bde51e6a 82
2dfa3054
MR
83tools/%$(EXESUF): tools/%.o
84 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
85
2205da0d 86tools/%.o: tools/%.c
4d1156cb 87 $(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
08df7f86
MR
88
89-include $(wildcard tools/*.d)
f83acb09 90-include $(wildcard tests/*.d)
bde51e6a 91
3123823c 92ffplay.o: CFLAGS += $(SDL_CFLAGS)
bde51e6a 93
6a53fffd 94VERSION_SH = $(SRC_PATH_BARE)/version.sh
f82bf850 95GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD
6a53fffd 96
faa6f1c3 97.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
6a53fffd
MR
98.version: M=@
99
100version.h .version:
0853a2b4 101 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
6a53fffd
MR
102 $(Q)touch .version
103
104# force version.sh to run whenever version might have changed
105-include .version
36798f1b 106
13b1c80b 107alltools: $(TOOLS)
9bce82fa 108
7f939f55 109DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
dd46b538 110
a0f9c8ce 111documentation: $(DOCS)
bde51e6a 112
a0f9c8ce
MR
113-include $(wildcard $(DOCS:%=%.d))
114
115TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
3275ac6a 116
7732f641 117doc/%.html: TAG = HTML
a8f0814a 118doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init
a0f9c8ce 119 $(Q)$(TEXIDEP)
a8f0814a 120 $(M)cd doc && texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init $(<:doc/%=%)
bde51e6a 121
7732f641 122doc/%.pod: TAG = POD
82ccbe6b 123doc/%.pod: doc/%.texi
a0f9c8ce 124 $(Q)$(TEXIDEP)
86be2bc3 125 $(M)doc/texi2pod.pl $< $@
bde51e6a 126
7732f641 127doc/%.1: TAG = MAN
bde51e6a 128doc/%.1: doc/%.pod
86be2bc3 129 $(M)pod2man --section=1 --center=" " --release=" " $< > $@
bde51e6a
JR
130
131install: $(INSTALL_TARGETS-yes)
132
133install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
63611f31 134 $(Q)mkdir -p "$(BINDIR)"
fd676deb 135 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
bde51e6a 136
a1a84f69 137install-data: $(DATA_FILES)
63611f31 138 $(Q)mkdir -p "$(DATADIR)"
fd676deb 139 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 140
bde51e6a 141install-man: $(MANPAGES)
63611f31 142 $(Q)mkdir -p "$(MANDIR)/man1"
fd676deb 143 $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
bde51e6a 144
d3cb93b3
RP
145uninstall: uninstall-progs uninstall-data uninstall-man
146
147uninstall-progs:
50e10cbd 148 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
d3cb93b3
RP
149
150uninstall-data:
50e10cbd 151 $(RM) -r "$(DATADIR)"
d3cb93b3
RP
152
153uninstall-man:
50e10cbd 154 $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
bde51e6a 155
250dd6f0 156testclean:
50e10cbd
MR
157 $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
158 $(RM) $(addprefix tests/,$(CLEANSUFFIXES))
159 $(RM) tests/seek_test$(EXESUF) tests/seek_test.o
3d157bf3 160 $(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF))
250dd6f0
FC
161
162clean:: testclean
e0be794a 163 $(RM) $(ALLPROGS)
50e10cbd
MR
164 $(RM) $(CLEANSUFFIXES)
165 $(RM) doc/*.html doc/*.pod doc/*.1
166 $(RM) $(TOOLS)
40321376 167 $(RM) $(CLEANSUFFIXES:%=tools/%)
bde51e6a
JR
168
169distclean::
50e10cbd
MR
170 $(RM) $(DISTCLEANSUFFIXES)
171 $(RM) version.h config.* libavutil/avconfig.h
bde51e6a 172
9d0b3042 173config:
29ba0911 174 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
0c3b2d65 175
bde51e6a
JR
176# regression tests
177
5bab8536
DB
178check: test checkheaders
179
b3dce4b9 180fulltest test: codectest lavftest lavfitest seektest
bde51e6a 181
bde51e6a 182FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
bde51e6a
JR
183SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
184
57f09630
MR
185codectest: fate-codec
186lavftest: fate-lavf
187lavfitest: fate-lavfi
188seektest: fate-seek
40e02409 189
9770a7ad
MR
190AREF = tests/data/acodec.ref.wav
191VREF = tests/data/vsynth1.ref.yuv
192REFS = $(AREF) $(VREF)
193
57f09630 194$(REFS): TAG = GEN
bde51e6a 195
9be24c60 196$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
57f09630
MR
197 $(M)$(SRC_PATH)/tests/codec-regression.sh vref vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
198 $(Q)$(SRC_PATH)/tests/codec-regression.sh vref vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 199
9be24c60 200$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
57f09630 201 $(M)$(SRC_PATH)/tests/codec-regression.sh aref acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 202
d7167f05 203ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
bde51e6a
JR
204 @echo
205 @echo "Unfortunately ffserver is broken and therefore its regression"
206 @echo "test fails randomly. Treat the results accordingly."
207 @echo
767e14c3 208 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
bde51e6a 209
82bb3329 210tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
4ab20de6
MR
211 @mkdir -p tests/vsynth1
212 $(M)$(BUILD_ROOT)/$< 'tests/vsynth1/'
bde51e6a 213
82bb3329 214tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
4ab20de6
MR
215 @mkdir -p tests/vsynth2
216 $(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
bde51e6a 217
d7167f05 218tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
4ab20de6
MR
219 @mkdir -p tests/data
220 $(M)$(BUILD_ROOT)/$< $@
221
222tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
bde51e6a 223
684b28e0
MR
224tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
225 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
bde51e6a 226
43d2c6a5
SS
227tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS)
228 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
229
2fad0977 230include $(SRC_PATH_BARE)/tests/fate.mak
7e264ca1
MR
231include $(SRC_PATH_BARE)/tests/fate2.mak
232
4c3fbd4f
MR
233include $(SRC_PATH_BARE)/tests/fate/aac.mak
234include $(SRC_PATH_BARE)/tests/fate/als.mak
235include $(SRC_PATH_BARE)/tests/fate/fft.mak
236include $(SRC_PATH_BARE)/tests/fate/h264.mak
680aefa2 237include $(SRC_PATH_BARE)/tests/fate/mp3.mak
4c3fbd4f
MR
238include $(SRC_PATH_BARE)/tests/fate/vorbis.mak
239include $(SRC_PATH_BARE)/tests/fate/vp8.mak
240
57f09630
MR
241FATE_ACODEC = $(ACODEC_TESTS:%=fate-acodec-%)
242FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%)
243FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%)
9a3f31ef 244FATE_VCODEC = $(FATE_VSYNTH1) $(FATE_VSYNTH2)
57f09630
MR
245FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%)
246FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%)
9a3f31ef
MR
247FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%)
248
249FATE = $(FATE_ACODEC) \
250 $(FATE_VCODEC) \
251 $(FATE_LAVF) \
252 $(FATE_LAVFI) \
253 $(FATE_SEEK) \
254
255$(FATE_ACODEC): $(AREF)
256$(FATE_VCODEC): $(VREF)
257$(FATE_LAVF): $(REFS)
43d2c6a5 258$(FATE_LAVFI): $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
9a3f31ef
MR
259$(FATE_SEEK): fate-codec fate-lavf tests/seek_test$(EXESUF)
260
261$(FATE_ACODEC): CMD = codectest acodec
262$(FATE_VSYNTH1): CMD = codectest vsynth1
263$(FATE_VSYNTH2): CMD = codectest vsynth2
264$(FATE_LAVF): CMD = lavftest
265$(FATE_LAVFI): CMD = lavfitest
266$(FATE_SEEK): CMD = seektest
267
268fate-codec: fate-acodec fate-vcodec
269fate-acodec: $(FATE_ACODEC)
270fate-vcodec: $(FATE_VCODEC)
271fate-lavf: $(FATE_LAVF)
272fate-lavfi: $(FATE_LAVFI)
273fate-seek: $(FATE_SEEK)
274
666d7d18 275ifdef SAMPLES
9a3f31ef 276FATE += $(FATE_TESTS)
8ce67bca
RT
277fate-rsync:
278 rsync -vaLW rsync://fate-suite.libav.org/fate-suite/ $(SAMPLES)
2fad0977 279else
8ce67bca
RT
280fate-rsync:
281 @echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate suite"
715e9be2 282$(FATE_TESTS):
2fad0977
MR
283 @echo "SAMPLES not specified, cannot run FATE"
284endif
bde51e6a 285
b82be636
MR
286FATE_UTILS = base64 tiny_psnr
287
9a3f31ef 288fate: $(FATE)
9a3f31ef 289
b82be636 290$(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
f6ae77d4 291 @echo "TEST $(@:fate-%=%)"
3283f274 292 $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)'
9a3f31ef 293
d29d9ccc
MR
294fate-list:
295 @printf '%s\n' $(sort $(FATE))
296
34ae2d90 297.PHONY: documentation *test regtest-* alltools check config