Be less noisy with invalid pts/dts.
[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
23FFLIBS-$(CONFIG_SWSCALE) += swscale
24
25FFLIBS := avdevice avformat avcodec avutil
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
35ALL_TARGETS-$(CONFIG_VHOOK) += videohook
36ALL_TARGETS-$(BUILD_DOC) += documentation
37
38INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
39ifneq ($(PROGS),)
a1a84f69 40INSTALL_TARGETS-yes += install-progs install-data
bde51e6a
JR
41INSTALL_TARGETS-$(BUILD_DOC) += install-man
42endif
43INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
44
45all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
46
47$(PROGS): %$(EXESUF): %_g$(EXESUF)
48 cp -p $< $@
49 $(STRIP) $@
50
c87348a9 51SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTS
bde51e6a
JR
52
53define RESET
54$(1) :=
55$(1)-yes :=
56endef
57
58define DOSUBDIR
59$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
60SUBDIR := $(1)/
61include $(1)/Makefile
62endef
63
64$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
65
66ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
67ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
68
69%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
70 $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
71
72output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
73 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
74
75tools/%$(EXESUF): tools/%.c
76 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
77
78ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
79
9bce82fa
DB
80alltools: $(addsuffix $(EXESUF),$(addprefix tools/, cws2fws pktdumper qt-faststart trasher))
81
bde51e6a
JR
82VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
83
84BASEHOOKS = fish null watermark
85ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
86ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
87
88HOOKS-$(HAVE_FORK) += ppm
89HOOKS-$(HAVE_IMLIB2) += imlib2
90HOOKS-$(HAVE_FREETYPE2) += drawtext
91
92HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
93
94VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
95LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
96
97VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
98LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
99
100VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
101
102vhook/%.o vhook/%.d: CFLAGS:=$(VHOOKCFLAGS)
103
104# vhooks compile fine without libav*, but need them nonetheless.
105videohook: $(FF_DEP_LIBS) $(HOOKS)
106
107$(eval VHOOKSHFLAGS=$(VHOOKSHFLAGS))
108vhook/%$(SLIBSUF): vhook/%.o
109 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
110
111VHOOK_DEPS = $(HOOKS:$(SLIBSUF)=.d)
112depend dep: $(VHOOK_DEPS)
113
114documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
115 ffplay-doc.html general.html hooks.html \
116 $(ALLMANPAGES))
117
118doc/%.html: doc/%.texi
119 texi2html -monolithic -number $<
120 mv $(@F) $@
121
122doc/%.pod: doc/%-doc.texi
123 doc/texi2pod.pl $< $@
124
125doc/%.1: doc/%.pod
126 pod2man --section=1 --center=" " --release=" " $< > $@
127
128install: $(INSTALL_TARGETS-yes)
129
130install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
131 install -d "$(BINDIR)"
132 install -c -m 755 $(PROGS) "$(BINDIR)"
133
a1a84f69
RS
134install-data: $(DATA_FILES)
135 install -d "$(DATADIR)"
136 install -m 644 $(DATA_FILES) "$(DATADIR)"
137
bde51e6a
JR
138install-man: $(MANPAGES)
139 install -d "$(MANDIR)/man1"
140 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
141
142install-vhook: videohook
143 install -d "$(SHLIBDIR)/vhook"
144 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
145
a1a84f69 146uninstall: uninstall-progs uninstall-data uninstall-man uninstall-vhook
bde51e6a
JR
147
148uninstall-progs:
149 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
150
a1a84f69
RS
151uninstall-data:
152 rm -rf "$(DATADIR)"
153
bde51e6a
JR
154uninstall-man:
155 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
156
157uninstall-vhook:
158 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
159 -rmdir "$(SHLIBDIR)/vhook/"
160
250dd6f0
FC
161testclean:
162 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
163
164clean:: testclean
bde51e6a
JR
165 rm -f $(ALLPROGS) $(ALLPROGS_G) output_example$(EXESUF)
166 rm -f doc/*.html doc/*.pod doc/*.1
bde51e6a
JR
167 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
168 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
169 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
170
171distclean::
172 rm -f version.h config.* vhook/*.d
173
174# regression tests
175
5bab8536
DB
176check: test checkheaders
177
bde51e6a
JR
178fulltest test: codectest libavtest seektest
179
180FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
181FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
182LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
183ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
184SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
185
186CODEC_TESTS = $(addprefix regtest-, \
187 mpeg \
188 mpeg2 \
189 mpeg2thread \
190 msmpeg4v2 \
191 msmpeg4 \
192 wmv1 \
193 wmv2 \
194 h261 \
195 h263 \
196 h263p \
197 mpeg4 \
198 huffyuv \
199 rc \
200 mpeg4adv \
201 mpeg4thread \
202 error \
203 mpeg4nr \
204 mpeg1b \
205 mjpeg \
206 ljpeg \
207 jpegls \
208 rv10 \
209 rv20 \
210 asv1 \
211 asv2 \
212 flv \
213 ffv1 \
214 snow \
215 snowll \
216 dv \
217 dv50 \
218 svq1 \
219 flashsv \
220 mp2 \
221 ac3 \
222 g726 \
223 adpcm_ima_wav \
224 adpcm_ima_qt \
225 adpcm_ms \
226 adpcm_yam \
227 adpcm_swf \
228 flac \
229 wma \
230 pcm \
231 )
232
233LAVF_TESTS = $(addprefix regtest-, \
234 avi \
235 asf \
236 rm \
237 mpg \
238 ts \
239 swf \
240 ffm \
241 flv_fmt \
242 mov \
243 dv_fmt \
244 gxf \
245 nut \
246 mkv \
247 pbmpipe \
248 pgmpipe \
249 ppmpipe \
250 gif \
251 yuv4mpeg \
252 pgm \
253 ppm \
254 bmp \
255 tga \
256 tiff \
257 sgi \
258 jpg \
259 wav \
260 alaw \
261 mulaw \
262 au \
263 mmf \
264 aiff \
265 voc \
266 ogg \
267 pixfmt \
268 )
269
270REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
271
272CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
273CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
274
275LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
276
277LAVF_REG = tests/data/lavf.regression
278ROTOZOOM_REG = tests/data/rotozoom.regression
279VSYNTH_REG = tests/data/vsynth.regression
280
3e3c638e 281ifneq ($(CONFIG_SWSCALE),yes)
bde51e6a
JR
282servertest codectest $(CODEC_TESTS) libavtest: swscale_error
283swscale_error:
284 @echo
3e3c638e 285 @echo "This regression test requires --enable-swscale."
bde51e6a
JR
286 @echo
287 @exit 1
288endif
289
290codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
291 diff -u -w $(FFMPEG_REFFILE) $(VSYNTH_REG)
292 diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
293
294libavtest: $(LAVF_REG)
295 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
296
297$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
298 cat $^ > $@
299
300$(LAVF_REG): $(LAVF_REGFILES)
301$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
302$(VSYNTH_REG): $(CODEC_VSYNTH)
303
304$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
305
306$(LAVF_REGFILES): $(LAVF_TESTS)
307
308$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
309
310regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
311
312$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
9a5771e9
MR
313 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
314 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a
JR
315
316$(LAVF_TESTS):
9a5771e9 317 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a
JR
318
319seektest: codectest libavtest tests/seek_test$(EXESUF)
9a5771e9 320 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a
JR
321
322servertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
323 @echo
324 @echo "Unfortunately ffserver is broken and therefore its regression"
325 @echo "test fails randomly. Treat the results accordingly."
326 @echo
327 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
328
329tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
330 mkdir -p tests/vsynth1
331 $(BUILD_ROOT)/$< 'tests/vsynth1/'
332
333tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
334 mkdir -p tests/vsynth2
335 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
336
337tests/asynth1.sw: tests/audiogen$(EXESUF)
338 $(BUILD_ROOT)/$< $@
339
dbad2c29
MR
340tests/%$(EXESUF): tests/%.c
341 $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
bde51e6a
JR
342
343tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
344 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
345
346
5bab8536 347.PHONY: lib videohook documentation *test regtest-* swscale-error alltools check
bde51e6a
JR
348
349-include $(VHOOK_DEPS)