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