change name from stream type to frame type in AC3 code
[libav.git] / Makefile
1 #
2 # Main ffmpeg Makefile
3 # (c) 2000-2004 Fabrice Bellard
4 #
5 include config.mak
6
7 SRC_DIR = $(SRC_PATH_BARE)
8
9 vpath %.c $(SRC_PATH_BARE)
10 vpath %.h $(SRC_PATH_BARE)
11 vpath %.texi $(SRC_PATH_BARE)
12
13 PROGS-$(CONFIG_FFMPEG) += ffmpeg
14 PROGS-$(CONFIG_FFPLAY) += ffplay
15 PROGS-$(CONFIG_FFSERVER) += ffserver
16
17 PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
18 PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
19 PROGS_SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
20 MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
21
22 BASENAMES = ffmpeg ffplay ffserver
23 ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
24 ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
25 ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
26
27 ifeq ($(BUILD_SHARED),yes)
28 DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavdevice/$(SLIBPREF)avdevice$(SLIBSUF)
29 else
30 DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavdevice/$(LIBPREF)avdevice$(LIBSUF)
31 endif
32
33 ALL_TARGETS-$(CONFIG_VHOOK) += videohook
34 ALL_TARGETS-$(BUILD_DOC) += documentation
35
36 INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
37 ifneq ($(PROGS),)
38 INSTALL_TARGETS-yes += install-progs
39 INSTALL_TARGETS-$(BUILD_DOC) += install-man
40 endif
41 INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
42
43 main: lib $(PROGS_G) $(PROGS) $(ALL_TARGETS-yes)
44
45 %$(EXESUF): %_g$(EXESUF)
46 cp -p $< $@
47 $(STRIP) $@
48
49 vhook/%.o: vhook/%.c
50 $(CC) $(VHOOKCFLAGS) -c -o $@ $<
51
52 .depend: version.h $(PROGS_SRCS)
53
54 # bandaid to disable triggering shared library installation routines
55 DISABLE=yes
56
57 include common.mak
58
59 VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
60
61 BASEHOOKS = fish null watermark
62 ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
63 ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
64
65 HOOKS-$(HAVE_FORK) += ppm
66 HOOKS-$(HAVE_IMLIB2) += imlib2
67 HOOKS-$(HAVE_FREETYPE2) += drawtext
68
69 HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
70
71 VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
72 LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
73
74 VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
75 LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
76
77 VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
78
79 LDFLAGS-$(CONFIG_SWSCALE) += -L$(BUILD_ROOT)/libswscale
80 LDFLAGS-$(CONFIG_AVFILTER) += -L$(BUILD_ROOT)/libavfilter
81 LDFLAGS := $(LDFLAGS-yes) -L$(BUILD_ROOT)/libavdevice -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil -g $(LDFLAGS)
82
83 EXTRALIBS-$(CONFIG_AVFILTER) += -lavfilter$(BUILDSUF)
84 EXTRALIBS-$(CONFIG_SWSCALE) += -lswscale$(BUILDSUF)
85 EXTRALIBS := $(EXTRALIBS-yes) -lavdevice$(BUILDSUF) -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
86
87 MAKE-yes = $(MAKE)
88 MAKE- = : $(MAKE)
89
90 lib:
91 $(MAKE) -C libavutil all
92 $(MAKE) -C libavcodec all
93 $(MAKE) -C libavformat all
94 $(MAKE) -C libavdevice all
95 $(MAKE-$(CONFIG_POSTPROC)) -C libpostproc all
96 $(MAKE-$(CONFIG_SWSCALE)) -C libswscale all
97 $(MAKE-$(CONFIG_AVFILTER)) -C libavfilter all
98
99 ffplay_g$(EXESUF): EXTRALIBS += $(SDL_LIBS)
100 ffserver_g$(EXESUF): LDFLAGS += $(FFSERVERLDFLAGS)
101
102 %_g$(EXESUF): %.o cmdutils.o .libs
103 $(CC) $(LDFLAGS) -o $@ $< cmdutils.o $(EXTRALIBS)
104
105 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
106 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
107 version.h: $(SVN_ENTRIES)
108 endif
109
110 version.h:
111 $(SRC_PATH)/version.sh $(SRC_PATH)
112
113 output_example$(EXESUF): output_example.o .libs
114 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
115
116 tools/%$(EXESUF): tools/%.c
117 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
118
119 ffplay.o .depend: CFLAGS += $(SDL_CFLAGS)
120
121 ffmpeg.o ffplay.o ffserver.o: version.h
122
123 # vhooks compile fine without libav*, but need them nonetheless.
124 videohook: .libs $(HOOKS)
125
126 vhook/%$(SLIBSUF): vhook/%.o
127 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
128
129 documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
130 ffplay-doc.html general.html hooks.html \
131 $(ALLMANPAGES))
132
133 doc/%.html: doc/%.texi
134 texi2html -monolithic -number $<
135 mv $(@F) $@
136
137 doc/%.pod: doc/%-doc.texi
138 doc/texi2pod.pl $< $@
139
140 doc/%.1: doc/%.pod
141 pod2man --section=1 --center=" " --release=" " $< > $@
142
143 install: $(INSTALL_TARGETS-yes)
144
145 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
146 install -d "$(BINDIR)"
147 install -c -m 755 $(PROGS) "$(BINDIR)"
148
149 install-man:
150 install -d "$(MANDIR)/man1"
151 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
152
153 install-vhook: videohook
154 install -d "$(SHLIBDIR)/vhook"
155 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
156
157 install-libs:
158 $(MAKE) -C libavutil install-libs
159 $(MAKE) -C libavcodec install-libs
160 $(MAKE) -C libavformat install-libs
161 $(MAKE) -C libavdevice install-libs
162 $(MAKE-$(CONFIG_POSTPROC)) -C libpostproc install-libs
163 $(MAKE-$(CONFIG_SWSCALE)) -C libswscale install-libs
164 $(MAKE-$(CONFIG_AVFILTER)) -C libavfilter install-libs
165
166 install-headers::
167 $(MAKE) -C libavutil install-headers
168 $(MAKE) -C libavcodec install-headers
169 $(MAKE) -C libavformat install-headers
170 $(MAKE) -C libavdevice install-headers
171 $(MAKE-$(CONFIG_POSTPROC)) -C libpostproc install-headers
172 $(MAKE) -C libswscale install-headers
173 $(MAKE-$(CONFIG_AVFILTER)) -C libavfilter install-headers
174
175 uninstall: uninstall-progs uninstall-man uninstall-vhook
176
177 uninstall-progs:
178 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
179
180 uninstall-man:
181 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
182
183 uninstall-vhook:
184 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
185 -rmdir "$(SHLIBDIR)/vhook/"
186
187 uninstall-libs::
188 $(MAKE) -C libavutil uninstall-libs
189 $(MAKE) -C libavcodec uninstall-libs
190 $(MAKE) -C libavformat uninstall-libs
191 $(MAKE) -C libavdevice uninstall-libs
192 $(MAKE) -C libpostproc uninstall-libs
193 $(MAKE) -C libswscale uninstall-libs
194 $(MAKE) -C libavfilter uninstall-libs
195
196 uninstall-headers::
197 $(MAKE) -C libavutil uninstall-headers
198 $(MAKE) -C libavcodec uninstall-headers
199 $(MAKE) -C libavformat uninstall-headers
200 $(MAKE) -C libavdevice uninstall-headers
201 $(MAKE) -C libpostproc uninstall-headers
202 $(MAKE) -C libswscale uninstall-headers
203 $(MAKE) -C libavfilter uninstall-headers
204 -rmdir "$(INCDIR)"
205
206 depend dep: .vhookdep
207 $(MAKE) -C libavutil depend
208 $(MAKE) -C libavcodec depend
209 $(MAKE) -C libavformat depend
210 $(MAKE) -C libavdevice depend
211 $(MAKE-$(CONFIG_POSTPROC)) -C libpostproc depend
212 $(MAKE-$(CONFIG_SWSCALE)) -C libswscale depend
213 $(MAKE-$(CONFIG_AVFILTER)) -C libavfilter depend
214
215 .vhookdep: $(ALLHOOKS_SRCS) version.h
216 $(VHOOK_DEPEND_CMD) > $@
217
218 $(DEP_LIBS): lib
219
220 .libs: $(DEP_LIBS)
221 touch $@
222
223 clean::
224 $(MAKE) -C libavutil clean
225 $(MAKE) -C libavcodec clean
226 $(MAKE) -C libavformat clean
227 $(MAKE) -C libavdevice clean
228 $(MAKE) -C libpostproc clean
229 $(MAKE) -C libswscale clean
230 $(MAKE) -C libavfilter clean
231 rm -f .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
232 output_example$(EXESUF)
233 rm -f doc/*.html doc/*.pod doc/*.1
234 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
235 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
236 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
237 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
238
239 distclean::
240 $(MAKE) -C libavutil distclean
241 $(MAKE) -C libavcodec distclean
242 $(MAKE) -C libavformat distclean
243 $(MAKE) -C libavdevice distclean
244 $(MAKE) -C libpostproc distclean
245 $(MAKE) -C libswscale distclean
246 $(MAKE) -C libavfilter distclean
247 rm -f .vhookdep version.h config.* *.pc
248
249 # regression tests
250
251 fulltest test: codectest libavtest seektest
252
253 FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
254 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
255 LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
256 ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
257 SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
258
259 CODEC_TESTS = $(addprefix regtest-, \
260 mpeg \
261 mpeg2 \
262 mpeg2thread \
263 msmpeg4v2 \
264 msmpeg4 \
265 wmv1 \
266 wmv2 \
267 h261 \
268 h263 \
269 h263p \
270 mpeg4 \
271 huffyuv \
272 rc \
273 mpeg4adv \
274 mpeg4thread \
275 error \
276 mpeg4nr \
277 mpeg1b \
278 mjpeg \
279 ljpeg \
280 jpegls \
281 rv10 \
282 rv20 \
283 asv1 \
284 asv2 \
285 flv \
286 ffv1 \
287 snow \
288 snowll \
289 dv \
290 dv50 \
291 svq1 \
292 flashsv \
293 mp2 \
294 ac3 \
295 g726 \
296 adpcm_ima_wav \
297 adpcm_ima_qt \
298 adpcm_ms \
299 adpcm_yam \
300 adpcm_swf \
301 flac \
302 wma \
303 )
304
305 LAVF_TESTS = $(addprefix regtest-, \
306 avi \
307 asf \
308 rm \
309 mpg \
310 ts \
311 swf \
312 ffm \
313 flv_fmt \
314 mov \
315 dv_fmt \
316 gxf \
317 nut \
318 mkv \
319 pbmpipe \
320 pgmpipe \
321 ppmpipe \
322 gif \
323 yuv4mpeg \
324 pgm \
325 ppm \
326 bmp \
327 tga \
328 tiff \
329 sgi \
330 jpg \
331 wav \
332 alaw \
333 mulaw \
334 au \
335 mmf \
336 aiff \
337 voc \
338 ogg \
339 pixfmt \
340 )
341
342 REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
343
344 CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
345 CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
346
347 LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
348
349 LAVF_REG = tests/data/lavf.regression
350 ROTOZOOM_REG = tests/data/rotozoom.regression
351 VSYNTH_REG = tests/data/vsynth.regression
352
353 codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
354 diff -u -w $(FFMPEG_REFFILE) $(VSYNTH_REG)
355 diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
356
357 libavtest: $(LAVF_REG)
358 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
359
360 $(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
361 cat $^ > $@
362
363 $(LAVF_REG): $(LAVF_REGFILES)
364 $(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
365 $(VSYNTH_REG): $(CODEC_VSYNTH)
366
367 $(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
368
369 $(LAVF_REGFILES): $(LAVF_TESTS)
370
371 $(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
372
373 regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
374
375 $(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
376 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a
377 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a
378
379 $(LAVF_TESTS):
380 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b
381
382 seektest: codectest libavtest tests/seek_test$(EXESUF)
383 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
384
385 test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
386 @echo
387 @echo "Unfortunately ffserver is broken and therefore its regression"
388 @echo "test fails randomly. Treat the results accordingly."
389 @echo
390 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
391
392 ifeq ($(CONFIG_SWSCALE),yes)
393 test-server codectest $(CODEC_TESTS) libavtest: swscale_error
394 swscale_error:
395 @echo
396 @echo "This regression test is incompatible with --enable-swscale."
397 @echo
398 @exit 1
399 endif
400
401 tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
402 mkdir -p tests/vsynth1
403 $(BUILD_ROOT)/$< 'tests/vsynth1/'
404
405 tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
406 mkdir -p tests/vsynth2
407 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
408
409 tests/asynth1.sw: tests/audiogen$(EXESUF)
410 $(BUILD_ROOT)/$< $@
411
412 %$(EXESUF): %.c
413 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
414
415 tests/seek_test$(EXESUF): tests/seek_test.c .libs
416 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(EXTRALIBS)
417
418
419 .PHONY: lib videohook documentation TAGS
420 .PHONY: codectest libavtest seektest test-server fulltest test
421 .PHONY: $(CODEC_TESTS) $(LAVF_TESTS) regtest-ref swscale-error
422
423 -include .vhookdep