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