Introduce libavdevice
[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
997baf01 7VPATH=$(SRC_PATH_BARE)
dd9ca370 8
cbeee4d8 9CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
a163ed1a 10 -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
c721d803 11 -I$(SRC_PATH)/libavdevice \
364a9607 12 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H
115329f1 13LDFLAGS+= -g
37736979 14
0cb8579a
MR
15PROGS-$(CONFIG_FFMPEG) += ffmpeg
16PROGS-$(CONFIG_FFPLAY) += ffplay
17PROGS-$(CONFIG_FFSERVER) += ffserver
01310af2 18
bb8fe69a
DB
19PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
20PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
21MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
85f07f22 22
bb8fe69a
DB
23BASENAMES = ffmpeg ffplay ffserver
24ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
25ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
26ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
6b991cb2 27
0fd94442 28ifeq ($(BUILD_SHARED),yes)
c721d803 29DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavdevice/$(SLIBPREF)avdevice$(SLIBSUF)
0fd94442 30else
c721d803 31DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavdevice/$(LIBPREF)avdevice$(LIBSUF)
f02be79d
RS
32endif
33
7d6ac9a3
MR
34ALL_TARGETS-$(CONFIG_VHOOK) += videohook
35ALL_TARGETS-$(BUILD_DOC) += documentation
36
37INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
1217916b
DB
38ifneq ($(PROGS),)
39INSTALL_TARGETS-yes += install-progs
282db5fd 40INSTALL_TARGETS-$(BUILD_DOC) += install-man
1217916b 41endif
dd9f3d97 42
3b26ee47 43VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
dd9f3d97
MR
44
45BASEHOOKS = fish null watermark
46ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
47ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
48
49HOOKS-$(HAVE_FORK) += ppm
50HOOKS-$(HAVE_IMLIB2) += imlib2
51HOOKS-$(HAVE_FREETYPE2) += drawtext
52
53HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
54
55VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
cbefadbd 56LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
dd9f3d97
MR
57
58VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
cbefadbd 59LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
dd9f3d97
MR
60
61VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
142fc6b9 62
7f0f6e13 63SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
c721d803
LA
64LDFLAGS := -L$(BUILD_ROOT)/libavdevice -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
65EXTRALIBS := -lavdevice$(BUILDSUF) -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
57514323 66
790c9ca7 67ifeq ($(CONFIG_SWSCALER),yes)
06694949 68LDFLAGS+=-L$(BUILD_ROOT)/libswscale
6de9e506 69EXTRALIBS+=-lswscale$(BUILDSUF)
790c9ca7
LA
70endif
71
7d6ac9a3 72all: lib $(PROGS) $(ALL_TARGETS-yes)
85f07f22 73
951bf3e6 74lib:
5d22ccf7
DB
75 $(MAKE) -C libavutil all
76 $(MAKE) -C libavcodec all
abac6175 77 $(MAKE) -C libavformat all
c721d803 78 $(MAKE) -C libavdevice all
1a9150b1 79ifeq ($(CONFIG_PP),yes)
6d9a2421 80 $(MAKE) -C libpostproc all
1a9150b1 81endif
790c9ca7
LA
82ifeq ($(CONFIG_SWSCALER),yes)
83 $(MAKE) -C libswscale all
84endif
85f07f22 85
951bf3e6 86ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
6de9e506 87 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
85f07f22 88
4ce5df08
SS
89ffserver$(EXESUF): ffserver.o cmdutils.o .libs
90 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o cmdutils.o $(EXTRALIBS)
85f07f22 91
951bf3e6 92ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
6de9e506 93 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
01310af2 94
0cfd96cc 95%$(EXESUF): %_g$(EXESUF)
01310af2
FB
96 cp -p $< $@
97 $(STRIP) $@
98
a4da50e1
MR
99SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
100ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
101version.h: $(SVN_ENTRIES)
102endif
103
f1cc88a5 104version.h:
997baf01 105 $(SRC_PATH)/version.sh $(SRC_PATH)
f1cc88a5 106
951bf3e6 107output_example$(EXESUF): output_example.o .libs
18caf192 108 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
8de65d4f 109
83ef1fea 110tools/qt-faststart$(EXESUF): tools/qt-faststart.c
3acc68b4 111 $(CC) $(CFLAGS) $< -o $@
38100e8c 112
83ef1fea 113tools/cws2fws$(EXESUF): tools/cws2fws.c
18caf192 114 $(CC) $(CFLAGS) $< -o $@ -lz
f7599d5f 115
4566de57 116ffplay.o: CFLAGS += $(SDL_CFLAGS)
2744a37f 117
496cfa3c
MR
118ffmpeg.o ffplay.o ffserver.o: version.h
119
ed5614eb
DB
120videohook: .libs $(HOOKS)
121
122vhook/%$(SLIBSUF): vhook/%.o
3b26ee47 123 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
ed5614eb 124
3b26ee47
MR
125vhook/%.o: vhook/%.c
126 $(CC) $(VHOOKCFLAGS) -c -o $@ $<
127
128%.o: %.c
129 $(CC) $(CFLAGS) -c -o $@ $<
142fc6b9 130
e9b19db8 131documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
d0e1cd3d
DB
132 ffplay-doc.html general.html hooks.html \
133 $(ALLMANPAGES))
e9b19db8
DB
134
135doc/%.html: doc/%.texi
136 texi2html -monolithic -number $<
137 mv $(@F) $@
138
139doc/%.pod: doc/%-doc.texi
140 doc/texi2pod.pl $< $@
141
142doc/%.1: doc/%.pod
143 pod2man --section=1 --center=" " --release=" " $< > $@
146ea952 144
1217916b 145install: install-libs install-headers $(INSTALL_TARGETS-yes)
81dcdc53 146
a4848db6 147ifeq ($(BUILD_SHARED),yes)
e1a3a63f 148install-progs: install-libs
a4848db6 149endif
c4fa7ebc 150install-progs: $(PROGS)
22a324da
DB
151 install -d "$(BINDIR)"
152 install -c -m 755 $(PROGS) "$(BINDIR)"
85f07f22 153
7a7be126 154# Create the Windows installer.
d35ff76b
FB
155wininstaller: all install
156 makensis ffinstall.nsi
157
23a65308 158install-man:
22a324da
DB
159 install -d "$(MANDIR)/man1"
160 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
23a65308 161
ed5614eb 162install-vhook: videohook
22a324da
DB
163 install -d "$(SHLIBDIR)/vhook"
164 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
142fc6b9 165
b12f8273 166install-libs:
8b2121e3
MR
167 $(MAKE) -C libavutil install-libs
168 $(MAKE) -C libavcodec install-libs
169 $(MAKE) -C libavformat install-libs
c721d803 170 $(MAKE) -C libavdevice install-libs
1a9150b1 171ifeq ($(CONFIG_PP),yes)
6d9a2421 172 $(MAKE) -C libpostproc install-libs
1a9150b1 173endif
790c9ca7
LA
174ifeq ($(CONFIG_SWSCALER),yes)
175 $(MAKE) -C libswscale install-libs
176endif
177
8b2121e3 178ifeq ($(BUILD_SHARED),yes)
1e7ffa50 179 -$(LDCONFIG)
b12f8273 180endif
37736979 181
f29f3b5d
DB
182install-headers:
183 $(MAKE) -C libavutil install-headers
184 $(MAKE) -C libavcodec install-headers
185 $(MAKE) -C libavformat install-headers
c721d803 186 $(MAKE) -C libavdevice install-headers
1a9150b1 187ifeq ($(CONFIG_PP),yes)
6d9a2421 188 $(MAKE) -C libpostproc install-headers
1a9150b1 189endif
790c9ca7 190 $(MAKE) -C libswscale install-headers
f29f3b5d 191
f9edb717
DB
192uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
193
f9edb717 194uninstall-progs:
1c2211bd 195 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
f9edb717 196
f9edb717 197uninstall-man:
1c2211bd 198 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
f9edb717
DB
199
200uninstall-vhook:
1c2211bd 201 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
22a324da 202 -rmdir "$(SHLIBDIR)/vhook/"
f9edb717
DB
203
204uninstall-libs:
205 $(MAKE) -C libavutil uninstall-libs
206 $(MAKE) -C libavcodec uninstall-libs
207 $(MAKE) -C libavformat uninstall-libs
c721d803 208 $(MAKE) -C libavdevice uninstall-libs
6d9a2421 209 $(MAKE) -C libpostproc uninstall-libs
65f37992 210 $(MAKE) -C libswscale uninstall-libs
f9edb717
DB
211
212uninstall-headers:
213 $(MAKE) -C libavutil uninstall-headers
214 $(MAKE) -C libavcodec uninstall-headers
215 $(MAKE) -C libavformat uninstall-headers
c721d803 216 $(MAKE) -C libavdevice uninstall-headers
6d9a2421 217 $(MAKE) -C libpostproc uninstall-headers
65f37992 218 $(MAKE) -C libswscale uninstall-headers
22a324da 219 -rmdir "$(INCDIR)"
f9edb717 220
3b26ee47 221depend dep: .depend .vhookdep
ea0f0681 222 $(MAKE) -C libavutil depend
5d22ccf7 223 $(MAKE) -C libavcodec depend
c80d990f 224 $(MAKE) -C libavformat depend
c721d803 225 $(MAKE) -C libavdevice depend
691c480e
DB
226ifeq ($(CONFIG_PP),yes)
227 $(MAKE) -C libpostproc depend
228endif
eaa6d7b6
DB
229ifeq ($(CONFIG_SWSCALER),yes)
230 $(MAKE) -C libswscale depend
231endif
4b8b2edb 232
fd071c26 233.depend: $(SRCS) version.h
0032cac2 234 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
3b26ee47 235
2a4592fe 236# gcc stupidly only outputs the basename of targets with -MM
3b26ee47
MR
237.vhookdep: $(ALLHOOKS_SRCS)
238 $(CC) $(VHOOKCFLAGS) -MM $^ | sed 's,^\([a-z]\),vhook/\1,' > $@
57514323 239
da34f7ac
MR
240$(DEP_LIBS): lib
241
242.libs: $(DEP_LIBS)
243 touch $@
cf2818b0 244
98013cc1 245clean:
5d22ccf7
DB
246 $(MAKE) -C libavutil clean
247 $(MAKE) -C libavcodec clean
abac6175 248 $(MAKE) -C libavformat clean
c721d803 249 $(MAKE) -C libavdevice clean
6d9a2421 250 $(MAKE) -C libpostproc clean
790c9ca7 251 $(MAKE) -C libswscale clean
b8d40825 252 rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
3e4134f6 253 output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
e9b19db8 254 rm -f doc/*.html doc/*.pod doc/*.1
4fbd52f0
DB
255 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
256 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
ed5614eb 257 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
142fc6b9 258
85f07f22 259distclean: clean
98013cc1
DB
260 $(MAKE) -C libavutil distclean
261 $(MAKE) -C libavcodec distclean
262 $(MAKE) -C libavformat distclean
c721d803 263 $(MAKE) -C libavdevice distclean
6d9a2421 264 $(MAKE) -C libpostproc distclean
790c9ca7 265 $(MAKE) -C libswscale distclean
2c8c5021 266 rm -f .depend .vhookdep version.h config.* *.pc
85f07f22
FB
267
268TAGS:
abac6175 269 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 270
dd9ca370
FB
271# regression tests
272
4fbd52f0 273fulltest test: codectest libavtest seektest
4fbd52f0
DB
274
275FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
276FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
277LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
278ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
279SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
280
b13cdd33 281test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0
DB
282 @echo
283 @echo "Unfortunately ffserver is broken and therefore its regression"
284 @echo "test fails randomly. Treat the results accordingly."
285 @echo
286 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
287
b13cdd33 288codectest mpeg4 mpeg ac3 snow snowll: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw tests/tiny_psnr$(EXESUF)
4fbd52f0
DB
289 $(SRC_PATH)/tests/regression.sh $@ $(FFMPEG_REFFILE) tests/vsynth1
290 $(SRC_PATH)/tests/regression.sh $@ $(ROTOZOOM_REFFILE) tests/vsynth2
291
b13cdd33 292libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0 293 $(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1
a5a5984a 294
06396e11 295seektest: tests/seek_test$(EXESUF)
4fbd52f0 296 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
4fbd52f0
DB
297
298ifeq ($(CONFIG_SWSCALER),yes)
299test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error
300swscale_error:
301 @echo
302 @echo "This regression test is incompatible with --enable-swscaler."
303 @echo
304 @exit 1
305endif
306
307tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
308 mkdir -p tests/vsynth1
309 $(BUILD_ROOT)/$< 'tests/vsynth1/'
310
311tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
312 mkdir -p tests/vsynth2
313 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
314
315tests/asynth1.sw: tests/audiogen$(EXESUF)
316 $(BUILD_ROOT)/$< $@
317
318%$(EXESUF): %.c
319 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
320
06396e11 321tests/seek_test$(EXESUF): tests/seek_test.c .libs
ff21c1b0 322 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(EXTRALIBS)
4fbd52f0 323
dd9ca370 324
3263626f 325.PHONY: all lib videohook documentation install* wininstaller uninstall*
bedb3550 326.PHONY: dep depend clean distclean TAGS
5e2dfd39 327.PHONY: codectest libavtest seektest test-server fulltest test
4fbd52f0 328.PHONY: mpeg4 mpeg ac3 snow snowll swscale-error
cf2818b0 329
6ca0c110 330-include .depend
3b26ee47 331-include .vhookdep