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