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