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