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