correct soname for vhooks
[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 9vpath %.texi $(SRC_PATH_BARE)
dd9ca370 10
0cb8579a
MR
11PROGS-$(CONFIG_FFMPEG) += ffmpeg
12PROGS-$(CONFIG_FFPLAY) += ffplay
13PROGS-$(CONFIG_FFSERVER) += ffserver
01310af2 14
bb8fe69a
DB
15PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
16PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
caec74dd 17OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
bb8fe69a 18MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
85f07f22 19
bb8fe69a
DB
20BASENAMES = ffmpeg ffplay ffserver
21ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
22ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
23ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
6b991cb2 24
b8fcb619
MR
25FFLIBS-$(CONFIG_AVFILTER) += avfilter
26FFLIBS-$(CONFIG_POSTPROC) += postproc
27FFLIBS-$(CONFIG_SWSCALE) += swscale
43527e3e 28
b8fcb619 29FFLIBS := avdevice avformat avcodec avutil
f02be79d 30
71c61f62
MR
31include common.mak
32
33FF_LDFLAGS := $(FFLDFLAGS)
34FF_EXTRALIBS := $(FFEXTRALIBS)
791a3fc8 35FF_DEP_LIBS := $(DEP_LIBS)
71c61f62 36
7d6ac9a3
MR
37ALL_TARGETS-$(CONFIG_VHOOK) += videohook
38ALL_TARGETS-$(BUILD_DOC) += documentation
39
40INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
1217916b
DB
41ifneq ($(PROGS),)
42INSTALL_TARGETS-yes += install-progs
282db5fd 43INSTALL_TARGETS-$(BUILD_DOC) += install-man
1217916b 44endif
dfd10838 45INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
dd9f3d97 46
791a3fc8 47all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
27217159 48
473a88ca 49$(PROGS): %$(EXESUF): %_g$(EXESUF)
27217159
DB
50 cp -p $< $@
51 $(STRIP) $@
52
71c61f62 53SUBDIR_VARS := OBJS ASM_OBJS CPP_OBJS FFLIBS CLEANFILES
9bcc2883 54
71c61f62
MR
55define RESET
56$(1) :=
57$(1)-yes :=
58endef
7716f7ff 59
71c61f62
MR
60define DOSUBDIR
61$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
62SUBDIR := $(1)/
63include $(1)/Makefile
64endef
65
66$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
b8fcb619 67
71c61f62
MR
68ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
69ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
85f07f22 70
791a3fc8 71%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
71c61f62 72 $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
01310af2 73
a4da50e1
MR
74SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
75ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
76version.h: $(SVN_ENTRIES)
77endif
78
f1cc88a5 79version.h:
997baf01 80 $(SRC_PATH)/version.sh $(SRC_PATH)
f1cc88a5 81
791a3fc8 82output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
71c61f62 83 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
8de65d4f 84
1521c500 85tools/%$(EXESUF): tools/%.c
71c61f62 86 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
6da7cc81 87
caec74dd 88ffplay.o: CFLAGS += $(SDL_CFLAGS)
496cfa3c 89
465d9b1f
MR
90VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
91
92BASEHOOKS = fish null watermark
93ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
94ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
95
96HOOKS-$(HAVE_FORK) += ppm
97HOOKS-$(HAVE_IMLIB2) += imlib2
98HOOKS-$(HAVE_FREETYPE2) += drawtext
99
100HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
101
102VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
103LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
104
105VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
106LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
107
108VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
109
caec74dd 110vhook/%.o vhook/%.d: CFLAGS:=$(VHOOKCFLAGS)
465d9b1f 111
bab785a5 112# vhooks compile fine without libav*, but need them nonetheless.
791a3fc8 113videohook: $(FF_DEP_LIBS) $(HOOKS)
ed5614eb 114
9987769a 115$(eval VHOOKSHFLAGS=$(VHOOKSHFLAGS))
ed5614eb 116vhook/%$(SLIBSUF): vhook/%.o
3b26ee47 117 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
ed5614eb 118
caec74dd
MR
119VHOOK_DEPS = $(HOOKS:$(SLIBSUF)=.d)
120depend dep: $(VHOOK_DEPS)
465d9b1f 121
e9b19db8 122documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
d0e1cd3d
DB
123 ffplay-doc.html general.html hooks.html \
124 $(ALLMANPAGES))
e9b19db8
DB
125
126doc/%.html: doc/%.texi
127 texi2html -monolithic -number $<
128 mv $(@F) $@
129
130doc/%.pod: doc/%-doc.texi
131 doc/texi2pod.pl $< $@
132
133doc/%.1: doc/%.pod
134 pod2man --section=1 --center=" " --release=" " $< > $@
146ea952 135
a7319cc2
DB
136install: $(INSTALL_TARGETS-yes)
137
c1ac39b3 138install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
22a324da
DB
139 install -d "$(BINDIR)"
140 install -c -m 755 $(PROGS) "$(BINDIR)"
85f07f22 141
d05e360c 142install-man: $(MANPAGES)
22a324da
DB
143 install -d "$(MANDIR)/man1"
144 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
23a65308 145
ed5614eb 146install-vhook: videohook
22a324da
DB
147 install -d "$(SHLIBDIR)/vhook"
148 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
142fc6b9 149
7716f7ff 150uninstall: uninstall-progs uninstall-man uninstall-vhook
f9edb717 151
f9edb717 152uninstall-progs:
1c2211bd 153 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
f9edb717 154
f9edb717 155uninstall-man:
1c2211bd 156 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
f9edb717
DB
157
158uninstall-vhook:
1c2211bd 159 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
22a324da 160 -rmdir "$(SHLIBDIR)/vhook/"
f9edb717 161
7716f7ff 162clean::
71c61f62 163 rm -f gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
2b258bba 164 output_example$(EXESUF)
e9b19db8 165 rm -f doc/*.html doc/*.pod doc/*.1
4fbd52f0
DB
166 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
167 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
2b258bba 168 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
ed5614eb 169 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
142fc6b9 170
7716f7ff 171distclean::
caec74dd 172 rm -f version.h config.* *.pc vhook/*.d
85f07f22 173
dd9ca370
FB
174# regression tests
175
4fbd52f0 176fulltest test: codectest libavtest seektest
4fbd52f0
DB
177
178FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
179FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
180LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
181ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
182SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
183
4383ed5c
MR
184CODEC_TESTS = $(addprefix regtest-, \
185 mpeg \
186 mpeg2 \
187 mpeg2thread \
188 msmpeg4v2 \
189 msmpeg4 \
190 wmv1 \
191 wmv2 \
192 h261 \
193 h263 \
194 h263p \
195 mpeg4 \
196 huffyuv \
197 rc \
198 mpeg4adv \
199 mpeg4thread \
4383ed5c
MR
200 error \
201 mpeg4nr \
202 mpeg1b \
203 mjpeg \
204 ljpeg \
205 jpegls \
206 rv10 \
207 rv20 \
208 asv1 \
209 asv2 \
210 flv \
211 ffv1 \
212 snow \
213 snowll \
214 dv \
215 dv50 \
216 svq1 \
217 flashsv \
218 mp2 \
219 ac3 \
220 g726 \
221 adpcm_ima_wav \
9dc92a38 222 adpcm_ima_qt \
4383ed5c
MR
223 adpcm_ms \
224 adpcm_yam \
225 adpcm_swf \
226 flac \
227 wma \
228 )
229
2009721d
MR
230LAVF_TESTS = $(addprefix regtest-, \
231 avi \
232 asf \
233 rm \
234 mpg \
235 ts \
236 swf \
237 ffm \
238 flv_fmt \
239 mov \
240 dv_fmt \
241 gxf \
242 nut \
243 mkv \
244 pbmpipe \
245 pgmpipe \
246 ppmpipe \
247 gif \
248 yuv4mpeg \
249 pgm \
250 ppm \
251 bmp \
252 tga \
253 tiff \
254 sgi \
255 jpg \
256 wav \
257 alaw \
258 mulaw \
259 au \
260 mmf \
261 aiff \
262 voc \
263 ogg \
264 pixfmt \
265 )
4383ed5c
MR
266
267REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
268
269CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
270CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
271
272LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
273
274LAVF_REG = tests/data/lavf.regression
275ROTOZOOM_REG = tests/data/rotozoom.regression
276VSYNTH_REG = tests/data/vsynth.regression
277
278codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
4411cb11
MR
279 diff -u -w $(FFMPEG_REFFILE) $(VSYNTH_REG)
280 diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
4383ed5c
MR
281
282libavtest: $(LAVF_REG)
283 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
284
285$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
286 cat $^ > $@
287
288$(LAVF_REG): $(LAVF_REGFILES)
289$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
290$(VSYNTH_REG): $(CODEC_VSYNTH)
291
292$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
293
294$(LAVF_REGFILES): $(LAVF_TESTS)
295
296$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
297
298regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
299
300$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
2009721d
MR
301 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a
302 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a
4383ed5c
MR
303
304$(LAVF_TESTS):
2009721d 305 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b
4383ed5c
MR
306
307seektest: codectest libavtest tests/seek_test$(EXESUF)
308 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
309
b13cdd33 310test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0
DB
311 @echo
312 @echo "Unfortunately ffserver is broken and therefore its regression"
313 @echo "test fails randomly. Treat the results accordingly."
314 @echo
315 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
316
13ca50f3 317ifeq ($(CONFIG_SWSCALE),yes)
4383ed5c 318test-server codectest $(CODEC_TESTS) libavtest: swscale_error
4fbd52f0
DB
319swscale_error:
320 @echo
13ca50f3 321 @echo "This regression test is incompatible with --enable-swscale."
4fbd52f0
DB
322 @echo
323 @exit 1
324endif
325
326tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
327 mkdir -p tests/vsynth1
328 $(BUILD_ROOT)/$< 'tests/vsynth1/'
329
330tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
331 mkdir -p tests/vsynth2
332 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
333
334tests/asynth1.sw: tests/audiogen$(EXESUF)
335 $(BUILD_ROOT)/$< $@
336
337%$(EXESUF): %.c
71c61f62 338 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $<
4fbd52f0 339
791a3fc8 340tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
71c61f62 341 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
4fbd52f0 342
dd9ca370 343
7716f7ff 344.PHONY: lib videohook documentation TAGS
5e2dfd39 345.PHONY: codectest libavtest seektest test-server fulltest test
4383ed5c 346.PHONY: $(CODEC_TESTS) $(LAVF_TESTS) regtest-ref swscale-error
cf2818b0 347
caec74dd 348-include $(VHOOK_DEPS)