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