Make show-version exit 0.
[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
951bf3e6 84ffserver$(EXESUF): ffserver.o .libs
6de9e506 85 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.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
DB
126documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
127 ffplay-doc.html hooks.html $(ALLMANPAGES))
128
129doc/%.html: doc/%.texi
130 texi2html -monolithic -number $<
131 mv $(@F) $@
132
133doc/%.pod: doc/%-doc.texi
134 doc/texi2pod.pl $< $@
135
136doc/%.1: doc/%.pod
137 pod2man --section=1 --center=" " --release=" " $< > $@
146ea952 138
7d6ac9a3 139install: install-progs install-libs install-headers $(INSTALL_TARGETS-yes)
81dcdc53 140
a4848db6 141ifeq ($(BUILD_SHARED),yes)
7d2f4546 142install-progs: $(PROGS) install-libs
a4848db6 143else
7d2f4546 144install-progs: $(PROGS)
a4848db6 145endif
22a324da
DB
146 install -d "$(BINDIR)"
147 install -c -m 755 $(PROGS) "$(BINDIR)"
85f07f22 148
7a7be126 149# Create the Windows installer.
d35ff76b
FB
150wininstaller: all install
151 makensis ffinstall.nsi
152
23a65308 153install-man:
22a324da
DB
154 install -d "$(MANDIR)/man1"
155 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
23a65308 156
ed5614eb 157install-vhook: videohook
22a324da
DB
158 install -d "$(SHLIBDIR)/vhook"
159 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
142fc6b9 160
b12f8273 161install-libs:
8b2121e3
MR
162 $(MAKE) -C libavutil install-libs
163 $(MAKE) -C libavcodec install-libs
164 $(MAKE) -C libavformat install-libs
1a9150b1 165ifeq ($(CONFIG_PP),yes)
6d9a2421 166 $(MAKE) -C libpostproc install-libs
1a9150b1 167endif
790c9ca7
LA
168ifeq ($(CONFIG_SWSCALER),yes)
169 $(MAKE) -C libswscale install-libs
170endif
171
8b2121e3 172ifeq ($(BUILD_SHARED),yes)
1e7ffa50 173 -$(LDCONFIG)
b12f8273 174endif
37736979 175
f29f3b5d
DB
176install-headers:
177 $(MAKE) -C libavutil install-headers
178 $(MAKE) -C libavcodec install-headers
179 $(MAKE) -C libavformat install-headers
1a9150b1 180ifeq ($(CONFIG_PP),yes)
6d9a2421 181 $(MAKE) -C libpostproc install-headers
1a9150b1 182endif
790c9ca7 183 $(MAKE) -C libswscale install-headers
f29f3b5d 184
f9edb717
DB
185uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
186
f9edb717 187uninstall-progs:
22a324da 188 rm -f $(addprefix $(BINDIR)/, $(ALLPROGS))
f9edb717 189
f9edb717 190uninstall-man:
22a324da 191 rm -f $(addprefix $(MANDIR)/man1/,$(ALLMANPAGES))
f9edb717
DB
192
193uninstall-vhook:
22a324da
DB
194 rm -f $(addprefix $(SHLIBDIR)/vhook/,$(ALLHOOKS))
195 -rmdir "$(SHLIBDIR)/vhook/"
f9edb717
DB
196
197uninstall-libs:
198 $(MAKE) -C libavutil uninstall-libs
199 $(MAKE) -C libavcodec uninstall-libs
200 $(MAKE) -C libavformat uninstall-libs
6d9a2421 201 $(MAKE) -C libpostproc uninstall-libs
f9edb717
DB
202
203uninstall-headers:
204 $(MAKE) -C libavutil uninstall-headers
205 $(MAKE) -C libavcodec uninstall-headers
206 $(MAKE) -C libavformat uninstall-headers
6d9a2421 207 $(MAKE) -C libpostproc uninstall-headers
22a324da 208 -rmdir "$(INCDIR)"
f9edb717 209
3b26ee47 210depend dep: .depend .vhookdep
ea0f0681 211 $(MAKE) -C libavutil depend
5d22ccf7 212 $(MAKE) -C libavcodec depend
c80d990f 213 $(MAKE) -C libavformat depend
691c480e
DB
214ifeq ($(CONFIG_PP),yes)
215 $(MAKE) -C libpostproc depend
216endif
eaa6d7b6
DB
217ifeq ($(CONFIG_SWSCALER),yes)
218 $(MAKE) -C libswscale depend
219endif
4b8b2edb 220
fd071c26 221.depend: $(SRCS) version.h
0032cac2 222 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
3b26ee47
MR
223
224# gcc stupidly only outputs the basename of targets
225.vhookdep: $(ALLHOOKS_SRCS)
226 $(CC) $(VHOOKCFLAGS) -MM $^ | sed 's,^\([a-z]\),vhook/\1,' > $@
57514323 227
da34f7ac
MR
228$(DEP_LIBS): lib
229
230.libs: $(DEP_LIBS)
231 touch $@
cf2818b0 232
98013cc1 233clean:
5d22ccf7
DB
234 $(MAKE) -C libavutil clean
235 $(MAKE) -C libavcodec clean
abac6175 236 $(MAKE) -C libavformat clean
6d9a2421 237 $(MAKE) -C libpostproc clean
790c9ca7 238 $(MAKE) -C libswscale clean
b8d40825 239 rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
3e4134f6 240 output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
e9b19db8 241 rm -f doc/*.html doc/*.pod doc/*.1
4fbd52f0
DB
242 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
243 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
ed5614eb 244 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
142fc6b9 245
85f07f22 246distclean: clean
98013cc1
DB
247 $(MAKE) -C libavutil distclean
248 $(MAKE) -C libavcodec distclean
249 $(MAKE) -C libavformat distclean
6d9a2421 250 $(MAKE) -C libpostproc distclean
790c9ca7 251 $(MAKE) -C libswscale distclean
5c6a5d58 252 rm -f .depend version.h config.* *.pc
85f07f22
FB
253
254TAGS:
abac6175 255 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 256
dd9ca370
FB
257# regression tests
258
4fbd52f0 259fulltest test: codectest libavtest seektest
4fbd52f0
DB
260
261FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
262FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
263LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
264ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
265SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
266
b13cdd33 267test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0
DB
268 @echo
269 @echo "Unfortunately ffserver is broken and therefore its regression"
270 @echo "test fails randomly. Treat the results accordingly."
271 @echo
272 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
273
b13cdd33 274codectest mpeg4 mpeg ac3 snow snowll: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw tests/tiny_psnr$(EXESUF)
4fbd52f0
DB
275 $(SRC_PATH)/tests/regression.sh $@ $(FFMPEG_REFFILE) tests/vsynth1
276 $(SRC_PATH)/tests/regression.sh $@ $(ROTOZOOM_REFFILE) tests/vsynth2
277
b13cdd33 278libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0
DB
279 $(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1
280seektest: tests/seek_test$(EXESUF)
281 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
4fbd52f0
DB
282
283ifeq ($(CONFIG_SWSCALER),yes)
284test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error
285swscale_error:
286 @echo
287 @echo "This regression test is incompatible with --enable-swscaler."
288 @echo
289 @exit 1
290endif
291
292tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
293 mkdir -p tests/vsynth1
294 $(BUILD_ROOT)/$< 'tests/vsynth1/'
295
296tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
297 mkdir -p tests/vsynth2
298 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
299
300tests/asynth1.sw: tests/audiogen$(EXESUF)
301 $(BUILD_ROOT)/$< $@
302
303%$(EXESUF): %.c
304 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
305
306tests/seek_test$(EXESUF): tests/seek_test.c
307 $(CC) $(LDFLAGS) $(CFLAGS) -DHAVE_AV_CONFIG_H -o $@ $< $(EXTRALIBS)
308
dd9ca370 309
3263626f 310.PHONY: all lib videohook documentation install* wininstaller uninstall*
bedb3550 311.PHONY: dep depend clean distclean TAGS
5e2dfd39 312.PHONY: codectest libavtest seektest test-server fulltest test
4fbd52f0 313.PHONY: mpeg4 mpeg ac3 snow snowll swscale-error
cf2818b0 314
6ca0c110 315-include .depend
3b26ee47 316-include .vhookdep