add fork to HAVE_LIST
[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
d226c750 33ifeq ($(CONFIG_VHOOK),yes)
4c9b0af5
MR
34all: videohook
35install: install-vhook
47930f09 36endif
3b26ee47 37VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
742c94cb
DB
38HOOKS = vhook/fish$(SLIBSUF) vhook/null$(SLIBSUF) vhook/watermark$(SLIBSUF)
39ALLHOOKS = $(HOOKS) vhook/drawtext$(SLIBSUF) vhook/imlib2$(SLIBSUF) vhook/ppm$(SLIBSUF)
ed5614eb 40ALLHOOKS_SRCS := $(ALLHOOKS:$(SLIBSUF)=.c)
742c94cb
DB
41ifeq ($(HAVE_FORK),yes)
42HOOKS += vhook/ppm(SLIBSUF)
43endif
ed5614eb
DB
44ifeq ($(HAVE_IMLIB2),yes)
45HOOKS += vhook/imlib2$(SLIBSUF)
3b26ee47 46VHOOKCFLAGS += `imlib2-config --cflags`
ed5614eb
DB
47LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
48endif
49ifeq ($(HAVE_FREETYPE2),yes)
50HOOKS += vhook/drawtext$(SLIBSUF)
3b26ee47 51VHOOKCFLAGS += `freetype-config --cflags`
ed5614eb
DB
52LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
53endif
142fc6b9 54
146ea952 55ifeq ($(BUILD_DOC),yes)
4c9b0af5
MR
56all: documentation
57install: install-man
146ea952
NB
58endif
59
7f0f6e13 60SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
84471efd 61LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
8dc6f118 62EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
57514323 63
790c9ca7 64ifeq ($(CONFIG_SWSCALER),yes)
06694949 65LDFLAGS+=-L$(BUILD_ROOT)/libswscale
6de9e506 66EXTRALIBS+=-lswscale$(BUILDSUF)
790c9ca7
LA
67endif
68
4c9b0af5 69all: lib $(PROGS)
85f07f22 70
951bf3e6 71lib:
5d22ccf7
DB
72 $(MAKE) -C libavutil all
73 $(MAKE) -C libavcodec all
abac6175 74 $(MAKE) -C libavformat all
1a9150b1 75ifeq ($(CONFIG_PP),yes)
6d9a2421 76 $(MAKE) -C libpostproc all
1a9150b1 77endif
790c9ca7
LA
78ifeq ($(CONFIG_SWSCALER),yes)
79 $(MAKE) -C libswscale all
80endif
85f07f22 81
951bf3e6 82ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
6de9e506 83 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
85f07f22 84
951bf3e6 85ffserver$(EXESUF): ffserver.o .libs
6de9e506 86 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
85f07f22 87
951bf3e6 88ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
6de9e506 89 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
01310af2 90
0cfd96cc 91%$(EXESUF): %_g$(EXESUF)
01310af2
FB
92 cp -p $< $@
93 $(STRIP) $@
94
a4da50e1
MR
95SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
96ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
97version.h: $(SVN_ENTRIES)
98endif
99
f1cc88a5 100version.h:
997baf01 101 $(SRC_PATH)/version.sh $(SRC_PATH)
f1cc88a5 102
951bf3e6 103output_example$(EXESUF): output_example.o .libs
18caf192 104 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
8de65d4f 105
38100e8c 106qt-faststart$(EXESUF): qt-faststart.c
3acc68b4 107 $(CC) $(CFLAGS) $< -o $@
38100e8c 108
f7599d5f 109cws2fws$(EXESUF): cws2fws.c
18caf192 110 $(CC) $(CFLAGS) $< -o $@ -lz
f7599d5f 111
4566de57 112ffplay.o: CFLAGS += $(SDL_CFLAGS)
2744a37f 113
496cfa3c
MR
114ffmpeg.o ffplay.o ffserver.o: version.h
115
ed5614eb
DB
116videohook: .libs $(HOOKS)
117
118vhook/%$(SLIBSUF): vhook/%.o
3b26ee47 119 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
ed5614eb 120
3b26ee47
MR
121vhook/%.o: vhook/%.c
122 $(CC) $(VHOOKCFLAGS) -c -o $@ $<
123
124%.o: %.c
125 $(CC) $(CFLAGS) -c -o $@ $<
142fc6b9 126
e9b19db8
DB
127documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
128 ffplay-doc.html hooks.html $(ALLMANPAGES))
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
4c9b0af5 140install: install-progs install-libs install-headers
81dcdc53 141
a4848db6 142ifeq ($(BUILD_SHARED),yes)
7d2f4546 143install-progs: $(PROGS) install-libs
a4848db6 144else
7d2f4546 145install-progs: $(PROGS)
a4848db6 146endif
951bf3e6 147 install -d "$(bindir)"
ca3798dc 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:
8233b750
DB
155 install -d "$(mandir)/man1"
156 install -m 644 $(MANPAGES) "$(mandir)/man1"
23a65308 157
ed5614eb
DB
158install-vhook: videohook
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
DB
188uninstall-progs:
189 rm -f $(addprefix $(bindir)/, $(ALLPROGS))
190
f9edb717 191uninstall-man:
f9edb717 192 rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))
f9edb717
DB
193
194uninstall-vhook:
ed5614eb
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
f9edb717 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
279ifeq ($(CONFIG_GPL),yes)
b13cdd33 280libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0
DB
281 $(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1
282seektest: tests/seek_test$(EXESUF)
283 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
284else
285libavtest seektest:
286 @echo
287 @echo "This test requires FFmpeg to be compiled with --enable-gpl."
288 @echo
289 @exit 1
290endif
291
292ifeq ($(CONFIG_SWSCALER),yes)
293test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error
294swscale_error:
295 @echo
296 @echo "This regression test is incompatible with --enable-swscaler."
297 @echo
298 @exit 1
299endif
300
301tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
302 mkdir -p tests/vsynth1
303 $(BUILD_ROOT)/$< 'tests/vsynth1/'
304
305tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
306 mkdir -p tests/vsynth2
307 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
308
309tests/asynth1.sw: tests/audiogen$(EXESUF)
310 $(BUILD_ROOT)/$< $@
311
312%$(EXESUF): %.c
313 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
314
315tests/seek_test$(EXESUF): tests/seek_test.c
316 $(CC) $(LDFLAGS) $(CFLAGS) -DHAVE_AV_CONFIG_H -o $@ $< $(EXTRALIBS)
317
dd9ca370 318
3263626f 319.PHONY: all lib videohook documentation install* wininstaller uninstall*
bedb3550 320.PHONY: dep depend clean distclean TAGS
5e2dfd39 321.PHONY: codectest libavtest seektest test-server fulltest test
4fbd52f0 322.PHONY: mpeg4 mpeg ac3 snow snowll swscale-error
cf2818b0 323
6ca0c110 324-include .depend
3b26ee47 325-include .vhookdep