Reorder arguments for av_fifo_generic_read to be more logical 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)))
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
c87348a9 48SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTS
bde51e6a
JR
49
50define RESET
51$(1) :=
52$(1)-yes :=
53endef
54
55define DOSUBDIR
56$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
57SUBDIR := $(1)/
58include $(1)/Makefile
59endef
60
61$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
62
63ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
64ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
65
66%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
67 $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
68
69output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
70 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
71
72tools/%$(EXESUF): tools/%.c
73 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
74
75ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
76
36798f1b
MR
77cmdutils.o cmdutils.d: version.h
78
9bce82fa
DB
79alltools: $(addsuffix $(EXESUF),$(addprefix tools/, cws2fws pktdumper qt-faststart trasher))
80
bde51e6a 81documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
fdf11906 82 ffplay-doc.html general.html $(ALLMANPAGES))
bde51e6a
JR
83
84doc/%.html: doc/%.texi
85 texi2html -monolithic -number $<
86 mv $(@F) $@
87
88doc/%.pod: doc/%-doc.texi
89 doc/texi2pod.pl $< $@
90
91doc/%.1: doc/%.pod
92 pod2man --section=1 --center=" " --release=" " $< > $@
93
94install: $(INSTALL_TARGETS-yes)
95
96install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
97 install -d "$(BINDIR)"
98 install -c -m 755 $(PROGS) "$(BINDIR)"
99
a1a84f69
RS
100install-data: $(DATA_FILES)
101 install -d "$(DATADIR)"
102 install -m 644 $(DATA_FILES) "$(DATADIR)"
103
bde51e6a
JR
104install-man: $(MANPAGES)
105 install -d "$(MANDIR)/man1"
106 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
107
fdf11906 108uninstall: uninstall-progs uninstall-data uninstall-man
bde51e6a
JR
109
110uninstall-progs:
111 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
112
a1a84f69
RS
113uninstall-data:
114 rm -rf "$(DATADIR)"
115
bde51e6a
JR
116uninstall-man:
117 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
118
250dd6f0
FC
119testclean:
120 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
121
122clean:: testclean
bde51e6a
JR
123 rm -f $(ALLPROGS) $(ALLPROGS_G) output_example$(EXESUF)
124 rm -f doc/*.html doc/*.pod doc/*.1
82bb3329
MR
125 rm -f tests/seek_test$(EXESUF)
126 rm -f $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
bde51e6a 127 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
bde51e6a
JR
128
129distclean::
fdf11906 130 rm -f version.h config.*
bde51e6a
JR
131
132# regression tests
133
5bab8536
DB
134check: test checkheaders
135
bde51e6a
JR
136fulltest test: codectest libavtest seektest
137
138FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
139FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
140LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
141ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
142SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
143
144CODEC_TESTS = $(addprefix regtest-, \
145 mpeg \
146 mpeg2 \
147 mpeg2thread \
148 msmpeg4v2 \
149 msmpeg4 \
150 wmv1 \
151 wmv2 \
152 h261 \
153 h263 \
154 h263p \
155 mpeg4 \
156 huffyuv \
157 rc \
158 mpeg4adv \
159 mpeg4thread \
160 error \
161 mpeg4nr \
162 mpeg1b \
163 mjpeg \
164 ljpeg \
165 jpegls \
166 rv10 \
167 rv20 \
168 asv1 \
169 asv2 \
170 flv \
171 ffv1 \
172 snow \
173 snowll \
174 dv \
175 dv50 \
176 svq1 \
177 flashsv \
178 mp2 \
179 ac3 \
180 g726 \
181 adpcm_ima_wav \
182 adpcm_ima_qt \
183 adpcm_ms \
184 adpcm_yam \
185 adpcm_swf \
186 flac \
187 wma \
188 pcm \
189 )
190
191LAVF_TESTS = $(addprefix regtest-, \
192 avi \
193 asf \
194 rm \
195 mpg \
196 ts \
197 swf \
198 ffm \
199 flv_fmt \
200 mov \
201 dv_fmt \
202 gxf \
203 nut \
204 mkv \
205 pbmpipe \
206 pgmpipe \
207 ppmpipe \
208 gif \
209 yuv4mpeg \
210 pgm \
211 ppm \
212 bmp \
213 tga \
214 tiff \
215 sgi \
216 jpg \
217 wav \
218 alaw \
219 mulaw \
220 au \
221 mmf \
222 aiff \
223 voc \
224 ogg \
225 pixfmt \
226 )
227
228REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
229
230CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
231CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
232
233LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
234
235LAVF_REG = tests/data/lavf.regression
236ROTOZOOM_REG = tests/data/rotozoom.regression
237VSYNTH_REG = tests/data/vsynth.regression
238
20a93972
DB
239ifneq ($(CONFIG_ZLIB),yes)
240regtest-flashsv codectest: zlib-error
241endif
242zlib-error:
243 @echo
244 @echo "This regression test requires zlib."
245 @echo
246 @exit 1
247
bde51e6a
JR
248codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
249 diff -u -w $(FFMPEG_REFFILE) $(VSYNTH_REG)
250 diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
251
252libavtest: $(LAVF_REG)
253 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
254
255$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
256 cat $^ > $@
257
258$(LAVF_REG): $(LAVF_REGFILES)
259$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
260$(VSYNTH_REG): $(CODEC_VSYNTH)
261
262$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
263
264$(LAVF_REGFILES): $(LAVF_TESTS)
265
266$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
267
268regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
269
82bb3329 270$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(HOSTEXESUF)
9a5771e9
MR
271 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
272 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a
JR
273
274$(LAVF_TESTS):
9a5771e9 275 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a
JR
276
277seektest: codectest libavtest tests/seek_test$(EXESUF)
9a5771e9 278 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a
JR
279
280servertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
281 @echo
282 @echo "Unfortunately ffserver is broken and therefore its regression"
283 @echo "test fails randomly. Treat the results accordingly."
284 @echo
285 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
286
82bb3329 287tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
bde51e6a
JR
288 mkdir -p tests/vsynth1
289 $(BUILD_ROOT)/$< 'tests/vsynth1/'
290
82bb3329 291tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
bde51e6a
JR
292 mkdir -p tests/vsynth2
293 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
294
82bb3329 295tests/asynth1.sw: tests/audiogen$(HOSTEXESUF)
bde51e6a
JR
296 $(BUILD_ROOT)/$< $@
297
82bb3329 298tests/%$(HOSTEXESUF): tests/%.c
dbad2c29 299 $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
bde51e6a
JR
300
301tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
302 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
303
304
fdf11906 305.PHONY: lib documentation *test regtest-* swscale-error zlib-error alltools check