Separate audio-only tests so they are only run once
[ffmpeg.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_FFSERVER) += ffserver
10
11 PROGS      := $(addsuffix   $(EXESUF), $(PROGS-yes))
12 PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
13 OBJS        = $(addsuffix .o,          $(PROGS-yes)) cmdutils.o
14 MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
15 TOOLS       = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
16 HOSTPROGS   = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
17
18 BASENAMES   = ffmpeg ffplay ffserver
19 ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
20 ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
21 ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
22
23 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
24 FFLIBS-$(CONFIG_AVFILTER) += avfilter
25 FFLIBS-$(CONFIG_AVFORMAT) += avformat
26 FFLIBS-$(CONFIG_AVCODEC)  += avcodec
27 FFLIBS-$(CONFIG_POSTPROC) += postproc
28 FFLIBS-$(CONFIG_SWSCALE)  += swscale
29
30 FFLIBS := avutil
31
32 DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
33
34 include common.mak
35
36 FF_LDFLAGS   := $(FFLDFLAGS)
37 FF_EXTRALIBS := $(FFEXTRALIBS)
38 FF_DEP_LIBS  := $(DEP_LIBS)
39
40 ALL_TARGETS-$(CONFIG_DOC)       += documentation
41
42 ifdef PROGS
43 INSTALL_TARGETS-yes             += install-progs install-data
44 INSTALL_TARGETS-$(CONFIG_DOC)   += install-man
45 endif
46 INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
47
48 all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
49
50 $(PROGS): %$(EXESUF): %_g$(EXESUF)
51         cp -p $< $@
52         $(STRIP) $@
53
54 SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
55                ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
56                HOSTPROGS BUILT_HEADERS
57
58 define RESET
59 $(1) :=
60 $(1)-yes :=
61 endef
62
63 define DOSUBDIR
64 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
65 SUBDIR := $(1)/
66 include $(1)/Makefile
67 endef
68
69 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
70
71 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
72 ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
73
74 %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
75         $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
76
77 tools/%$(EXESUF): tools/%.o
78         $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
79
80 tools/%.o: tools/%.c
81         $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
82
83 ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
84
85 cmdutils.o cmdutils.d: version.h
86
87 alltools: $(TOOLS)
88
89 documentation: $(addprefix doc/, developer.html faq.html ffmpeg-doc.html \
90                                  ffplay-doc.html ffserver-doc.html       \
91                                  general.html libavfilter.html $(ALLMANPAGES))
92
93 doc/%.html: doc/%.texi
94         texi2html -monolithic -number $<
95         mv $(@F) $@
96
97 doc/%.pod: doc/%-doc.texi
98         doc/texi2pod.pl $< $@
99
100 doc/%.1: doc/%.pod
101         pod2man --section=1 --center=" " --release=" " $< > $@
102
103 install: $(INSTALL_TARGETS-yes)
104
105 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
106         install -d "$(BINDIR)"
107         install -c -m 755 $(PROGS) "$(BINDIR)"
108
109 install-data: $(DATA_FILES)
110         install -d "$(DATADIR)"
111         install -m 644 $(DATA_FILES) "$(DATADIR)"
112
113 install-man: $(MANPAGES)
114         install -d "$(MANDIR)/man1"
115         install -m 644 $(MANPAGES) "$(MANDIR)/man1"
116
117 uninstall: uninstall-progs uninstall-data uninstall-man
118
119 uninstall-progs:
120         rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
121
122 uninstall-data:
123         rm -rf "$(DATADIR)"
124
125 uninstall-man:
126         rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
127
128 testclean:
129         rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/*~
130
131 clean:: testclean
132         rm -f $(ALLPROGS) $(ALLPROGS_G)
133         rm -f $(CLEANSUFFIXES)
134         rm -f doc/*.html doc/*.pod doc/*.1
135         rm -f tests/seek_test$(EXESUF) tests/seek_test.o
136         rm -f $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
137         rm -f $(TOOLS)
138
139 distclean::
140         rm -f $(DISTCLEANSUFFIXES)
141         rm -f version.h config.*
142
143 config:
144         $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
145
146 # regression tests
147
148 check: test checkheaders
149
150 fulltest test: codectest lavftest seektest
151
152 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
153 SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
154
155 ENCDEC = $(and $(CONFIG_$(1)_ENCODER),$(CONFIG_$(1)_DECODER))
156 MUXDEM = $(and $(CONFIG_$(1)_MUXER),$(CONFIG_$(or $(2),$(1))_DEMUXER))
157
158 VCODEC_TESTS =
159 VCODEC_TESTS-$(call ENCDEC,ASV1)             += asv1
160 VCODEC_TESTS-$(call ENCDEC,ASV2)             += asv2
161 VCODEC_TESTS-$(call ENCDEC,DNXHD)            += dnxhd_1080i dnxhd_720p dnxhd_720p_rd
162 VCODEC_TESTS-$(call ENCDEC,DVVIDEO)          += dv dv50
163 VCODEC_TESTS-$(call ENCDEC,FFV1)             += ffv1
164 VCODEC_TESTS-$(call ENCDEC,FLASHSV)          += flashsv
165 VCODEC_TESTS-$(call ENCDEC,FLV)              += flv
166 VCODEC_TESTS-$(call ENCDEC,H261)             += h261
167 VCODEC_TESTS-$(call ENCDEC,H263)             += h263 h263p
168 VCODEC_TESTS-$(call ENCDEC,HUFFYUV)          += huffyuv
169 VCODEC_TESTS-$(call ENCDEC,JPEGLS)           += jpegls
170 VCODEC_TESTS-$(call ENCDEC,MJPEG)            += mjpeg ljpeg
171 VCODEC_TESTS-$(call ENCDEC,MPEG1VIDEO)       += mpeg mpeg1b
172 VCODEC_TESTS-$(call ENCDEC,MPEG2VIDEO)       += mpeg2 mpeg2thread
173 VCODEC_TESTS-$(call ENCDEC,MPEG4)            += mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc
174 VCODEC_TESTS-$(call ENCDEC,MSMPEG4V1)        += msmpeg4
175 VCODEC_TESTS-$(call ENCDEC,MSMPEG4V2)        += msmpeg4v2
176 VCODEC_TESTS-$(call ENCDEC,ROQ)              += roq
177 VCODEC_TESTS-$(call ENCDEC,RV10)             += rv10
178 VCODEC_TESTS-$(call ENCDEC,RV20)             += rv20
179 VCODEC_TESTS-$(call ENCDEC,SNOW)             += snow snowll
180 VCODEC_TESTS-$(call ENCDEC,SVQ1)             += svq1
181 VCODEC_TESTS-$(call ENCDEC,WMV1)             += wmv1
182 VCODEC_TESTS-$(call ENCDEC,WMV2)             += wmv2
183
184 ACODEC_TESTS =
185 ACODEC_TESTS-$(call ENCDEC,AC3)              += ac3
186 ACODEC_TESTS-$(call ENCDEC,ADPCM_G726)       += g726
187 ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_QT)     += adpcm_ima_qt
188 ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_WAV)    += adpcm_ima_wav
189 ACODEC_TESTS-$(call ENCDEC,ADPCM_MS)         += adpcm_ms
190 ACODEC_TESTS-$(call ENCDEC,ADPCM_SWF)        += adpcm_swf
191 ACODEC_TESTS-$(call ENCDEC,ADPCM_YAMAHA)     += adpcm_yam
192 ACODEC_TESTS-$(call ENCDEC,ALAC)             += alac
193 ACODEC_TESTS-$(call ENCDEC,FLAC)             += flac
194 ACODEC_TESTS-$(call ENCDEC,MP2)              += mp2
195 ACODEC_TESTS-$(call ENCDEC,PCM_S16LE)        += pcm         # fixme
196 ACODEC_TESTS-$(call ENCDEC,WMAV1)            += wmav1
197 ACODEC_TESTS-$(call ENCDEC,WMAV1)            += wmav2
198
199 LAVF_TESTS =
200 LAVF_TESTS-$(call MUXDEM,AIFF)               += aiff
201 LAVF_TESTS-$(call MUXDEM,PCM_ALAW)           += alaw
202 LAVF_TESTS-$(call MUXDEM,ASF)                += asf
203 LAVF_TESTS-$(call MUXDEM,AU)                 += au
204 LAVF_TESTS-$(call MUXDEM,AVI)                += avi
205 LAVF_TESTS-$(call ENCDEC,BMP)                += bmp
206 LAVF_TESTS-$(call MUXDEM,DV)                 += dv_fmt
207 LAVF_TESTS-$(call MUXDEM,FFM)                += ffm
208 LAVF_TESTS-$(call MUXDEM,FLV)                += flv_fmt
209 LAVF_TESTS-$(call ENCDEC,GIF)                += gif
210 LAVF_TESTS-$(call MUXDEM,GXF)                += gxf
211 LAVF_TESTS-$(call ENCDEC,MJPEG)              += jpg
212 LAVF_TESTS-$(call MUXDEM,MATROSKA)           += mkv
213 LAVF_TESTS-$(call MUXDEM,MMF)                += mmf
214 LAVF_TESTS-$(call MUXDEM,MOV)                += mov
215 LAVF_TESTS-$(call MUXDEM,MPEG1SYSTEM,MPEGPS) += mpg
216 LAVF_TESTS-$(call MUXDEM,PCM_MULAW)          += mulaw
217 LAVF_TESTS-$(call MUXDEM,MXF)                += mxf
218 LAVF_TESTS-$(call MUXDEM,NUT)                += nut
219 LAVF_TESTS-$(call MUXDEM,OGG)                += ogg
220 LAVF_TESTS-$(call ENCDEC,PBM)                += pbmpipe
221 LAVF_TESTS-$(call ENCDEC,PCX)                += pcx
222 LAVF_TESTS-$(call ENCDEC,PGM)                += pgm pgmpipe
223 LAVF_TESTS-$(call MUXDEM,RAWVIDEO)           += pixfmt
224 LAVF_TESTS-$(call ENCDEC,PPM)                += ppm ppmpipe
225 LAVF_TESTS-$(call MUXDEM,RM)                 += rm
226 LAVF_TESTS-$(call ENCDEC,SGI)                += sgi
227 LAVF_TESTS-$(call MUXDEM,SWF)                += swf
228 LAVF_TESTS-$(call ENCDEC,TARGA)              += tga
229 LAVF_TESTS-$(call ENCDEC,TIFF)               += tiff
230 LAVF_TESTS-$(call MUXDEM,MPEGTS)             += ts
231 LAVF_TESTS-$(call MUXDEM,VOC)                += voc
232 LAVF_TESTS-$(call MUXDEM,WAV)                += wav
233 LAVF_TESTS-$(call MUXDEM,YUV4MPEGPIPE)       += yuv4mpeg
234
235 LAVFI_TESTS =
236
237 ACODEC_TESTS := $(addprefix regtest-, $(ACODEC_TESTS) $(ACODEC_TESTS-yes))
238 VCODEC_TESTS := $(addprefix regtest-, $(VCODEC_TESTS) $(VCODEC_TESTS-yes))
239 LAVF_TESTS  := $(addprefix regtest-, $(LAVF_TESTS)  $(LAVF_TESTS-yes))
240 LAVFI_TESTS := $(addprefix regtest-, $(LAVFI_TESTS) $(LAVFI_TESTS-yes))
241
242 CODEC_TESTS = $(VCODEC_TESTS) $(ACODEC_TESTS)
243
244 codectest: $(CODEC_TESTS)
245 lavftest:  $(LAVF_TESTS)
246
247 # lavfitest: $(LAVFI_TESTS)
248
249 $(ACODEC_TESTS): regtest-aref
250 $(VCODEC_TESTS): regtest-vref
251 $(LAVF_TESTS) $(LAVFI_TESTS): regtest-ref
252
253 REFFILE = $(SRC_PATH)/tests/ref/$(1)/$(2:regtest-%=%)
254 RESFILE = tests/data/$(2:regtest-%=%).$(1).regression
255
256 define CODECTEST_CMD
257         $(SRC_PATH)/tests/codec-regression.sh $@ vsynth1 tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
258         $(SRC_PATH)/tests/codec-regression.sh $@ vsynth2 tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
259 endef
260
261 regtest-ref: regtest-aref regtest-vref
262
263 regtest-vref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
264         $(CODECTEST_CMD)
265
266 regtest-aref: ffmpeg$(EXESUF) tests/data/asynth1.sw
267         @$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec a "$(TARGET_EXEC)" "$(TARGET_PATH)"
268
269 $(VCODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
270         @echo "TEST VCODEC $(@:regtest-%=%)"
271         @$(CODECTEST_CMD)
272         @diff -u -w $(call REFFILE,vsynth1,$@) $(call RESFILE,vsynth1,$@)
273         @diff -u -w $(call REFFILE,vsynth2,$@) $(call RESFILE,vsynth2,$@)
274
275 $(ACODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
276         @echo "TEST ACODEC $(@:regtest-%=%)"
277         @$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec a "$(TARGET_EXEC)" "$(TARGET_PATH)"
278         @diff -u -w $(call REFFILE,acodec,$@) $(call RESFILE,acodec,$@)
279
280 $(LAVF_TESTS):
281         @echo "TEST LAVF  $(@:regtest-%=%)"
282         @$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
283         @diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@)
284
285 $(LAVFI_TESTS):
286         @echo "TEST LAVFI $(@:regtest-%=%)"
287         @$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
288         @diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@)
289
290 seektest: codectest lavftest tests/seek_test$(EXESUF)
291         $(SRC_PATH)/tests/seek-regression.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
292
293 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
294         @echo
295         @echo "Unfortunately ffserver is broken and therefore its regression"
296         @echo "test fails randomly. Treat the results accordingly."
297         @echo
298         $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
299
300 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
301         mkdir -p tests/vsynth1
302         $(BUILD_ROOT)/$< 'tests/vsynth1/'
303
304 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
305         mkdir -p tests/vsynth2
306         $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
307
308 tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
309         mkdir -p tests/data
310         $(BUILD_ROOT)/$< $@
311
312 tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
313         $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
314
315
316 .PHONY: documentation *test regtest-* zlib-error alltools check config