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