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