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