replace MULL with asm too, no significnat speedup but its probably better to not...
[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
dd9ca370
FB
7VPATH=$(SRC_PATH)
8
f130fd46
DB
9CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
10 -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat \
4b65d88f 11 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE
115329f1 12LDFLAGS+= -g
37736979 13
790c9ca7
LA
14ifeq ($(CONFIG_SWSCALER),yes)
15CFLAGS := -I$(SRC_PATH)/libswscale $(CFLAGS)
16endif
17
7d2f4546
DB
18MANPAGES=doc/ffmpeg.1
19PROGS_G+=ffmpeg_g$(EXESUF)
20PROGS+=ffmpeg$(EXESUF)
951bf3e6 21PROGTEST=output_example$(EXESUF)
38100e8c 22QTFASTSTART=qt-faststart$(EXESUF)
01310af2
FB
23
24ifeq ($(CONFIG_FFSERVER),yes)
7d2f4546
DB
25MANPAGES+=doc/ffserver.1
26PROGS+=ffserver$(EXESUF)
01310af2
FB
27endif
28
29ifeq ($(CONFIG_FFPLAY),yes)
7d2f4546
DB
30MANPAGES+=doc/ffplay.1
31PROGS_G+=ffplay_g$(EXESUF)
32PROGS+=ffplay$(EXESUF)
426c31a1 33FFPLAY_O=ffplay.o
f3ec2d46 34endif
85f07f22 35
6b991cb2
DB
36BASENAMES=ffmpeg ffplay ffserver
37ALLPROGS=$(addsuffix $(EXESUF), $(BASENAMES))
38ALLPROGS_G=$(addsuffix _g$(EXESUF), $(BASENAMES))
39ALLMANPAGES=$(addsuffix .1, $(BASENAMES))
40
dfdfa47c
FR
41ifeq ($(CONFIG_AUDIO_BEOS),yes)
42EXTRALIBS+=-lmedia -lbe
43endif
a1b63811 44
0fd94442 45ifeq ($(BUILD_SHARED),yes)
6bc114b2 46DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
0fd94442 47else
f3ec2d46 48DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
f02be79d
RS
49endif
50
142fc6b9
PG
51ifeq ($(BUILD_VHOOK),yes)
52VHOOK=videohook
53INSTALLVHOOK=install-vhook
47930f09 54endif
142fc6b9 55
146ea952
NB
56ifeq ($(BUILD_DOC),yes)
57DOC=documentation
58endif
59
426c31a1 60OBJS = ffmpeg.o ffserver.o cmdutils.o $(FFPLAY_O)
57514323 61SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
5d38ba33
MR
62FFLIBDIRS = -L./libavformat -L./libavcodec -L./libavutil
63FFLIBS = -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF)
57514323 64
790c9ca7
LA
65ifeq ($(CONFIG_SWSCALER),yes)
66FFLIBDIRS+=-L./libswscale
67FFLIBS+=-lswscale$(BUILDSUF)
68endif
69
f1cc88a5 70all: version.h lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
85f07f22 71
951bf3e6 72lib:
5d22ccf7
DB
73 $(MAKE) -C libavutil all
74 $(MAKE) -C libavcodec all
abac6175 75 $(MAKE) -C libavformat all
1a9150b1 76ifeq ($(CONFIG_PP),yes)
6d9a2421 77 $(MAKE) -C libpostproc all
1a9150b1 78endif
790c9ca7
LA
79ifeq ($(CONFIG_SWSCALER),yes)
80 $(MAKE) -C libswscale all
81endif
85f07f22 82
951bf3e6 83ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
5d38ba33 84 $(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
85f07f22 85
951bf3e6 86ffserver$(EXESUF): ffserver.o .libs
c536cb09 87 $(CC) $(FFLIBDIRS) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
85f07f22 88
951bf3e6 89ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
5d38ba33 90 $(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
01310af2 91
0cfd96cc 92%$(EXESUF): %_g$(EXESUF)
01310af2
FB
93 cp -p $< $@
94 $(STRIP) $@
95
f1cc88a5
DB
96.PHONY: version.h
97version.h:
54003e1a 98 $(SRC_PATH)/version.sh "$(SRC_PATH)"
f1cc88a5 99
951bf3e6 100output_example$(EXESUF): output_example.o .libs
5d38ba33 101 $(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
8de65d4f 102
38100e8c 103qt-faststart$(EXESUF): qt-faststart.c
95ca7c94 104 $(CC) $(CFLAGS) $(SRC_PATH)/qt-faststart.c -o qt-faststart$(EXESUF)
38100e8c 105
f7599d5f
AB
106cws2fws$(EXESUF): cws2fws.c
107 $(CC) $(SRC_PATH)/cws2fws.c -o cws2fws$(EXESUF) -lz
108
01310af2 109ffplay.o: ffplay.c
115329f1 110 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
2744a37f 111
85f07f22 112%.o: %.c
115329f1 113 $(CC) $(CFLAGS) -c -o $@ $<
85f07f22 114
be12b2a4 115videohook: .libs
142fc6b9
PG
116 $(MAKE) -C vhook all
117
146ea952
NB
118documentation:
119 $(MAKE) -C doc all
120
d35ff76b
FB
121.PHONY: install
122
b12f8273 123install: install-progs install-libs install-headers install-man $(INSTALLVHOOK)
81dcdc53 124
a4848db6 125ifeq ($(BUILD_SHARED),yes)
7d2f4546 126install-progs: $(PROGS) install-libs
a4848db6 127else
7d2f4546 128install-progs: $(PROGS)
a4848db6 129endif
951bf3e6 130 install -d "$(bindir)"
7d2f4546 131 install -c $(INSTALLSTRIP) -m 755 $(PROGS) "$(bindir)"
85f07f22 132
d35ff76b
FB
133# create the window installer
134wininstaller: all install
135 makensis ffinstall.nsi
136
23a65308
FB
137# install man from source dir if available
138install-man:
2f30a81d 139ifneq ($(CONFIG_MINGW),yes)
8b8e1c55 140 if [ -f doc/ffmpeg.1 ] ; then \
aa99b8ff 141 install -d "$(mandir)/man1" ; \
7d2f4546 142 install -m 644 $(MANPAGES) "$(mandir)/man1" ; \
23a65308 143 fi
951bf3e6 144endif
23a65308 145
aa99b8ff
MN
146install-vhook:
147 $(MAKE) -C vhook install
142fc6b9 148
b12f8273 149install-libs:
8b2121e3
MR
150 $(MAKE) -C libavutil install-libs
151 $(MAKE) -C libavcodec install-libs
152 $(MAKE) -C libavformat install-libs
1a9150b1 153ifeq ($(CONFIG_PP),yes)
6d9a2421 154 $(MAKE) -C libpostproc install-libs
1a9150b1 155endif
790c9ca7
LA
156ifeq ($(CONFIG_SWSCALER),yes)
157 $(MAKE) -C libswscale install-libs
158endif
159
8b2121e3 160ifeq ($(BUILD_SHARED),yes)
1e7ffa50 161 -$(LDCONFIG)
b12f8273 162endif
37736979 163
f29f3b5d
DB
164install-headers:
165 $(MAKE) -C libavutil install-headers
166 $(MAKE) -C libavcodec install-headers
167 $(MAKE) -C libavformat install-headers
1a9150b1 168ifeq ($(CONFIG_PP),yes)
6d9a2421 169 $(MAKE) -C libpostproc install-headers
1a9150b1 170endif
790c9ca7
LA
171ifeq ($(CONFIG_SWSCALER),yes)
172 $(MAKE) -C libswscale install-headers
173endif
f29f3b5d 174
f9edb717
DB
175uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
176
f9edb717
DB
177uninstall-progs:
178 rm -f $(addprefix $(bindir)/, $(ALLPROGS))
179
f9edb717 180uninstall-man:
2f30a81d 181ifneq ($(CONFIG_MINGW),yes)
f9edb717
DB
182 rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))
183endif
184
185uninstall-vhook:
186 $(MAKE) -C vhook uninstall
187
188uninstall-libs:
189 $(MAKE) -C libavutil uninstall-libs
190 $(MAKE) -C libavcodec uninstall-libs
191 $(MAKE) -C libavformat uninstall-libs
6d9a2421 192 $(MAKE) -C libpostproc uninstall-libs
f9edb717
DB
193
194uninstall-headers:
195 $(MAKE) -C libavutil uninstall-headers
196 $(MAKE) -C libavcodec uninstall-headers
197 $(MAKE) -C libavformat uninstall-headers
6d9a2421 198 $(MAKE) -C libpostproc uninstall-headers
f9edb717
DB
199 -rmdir "$(incdir)"
200 -rmdir "$(prefix)/include/postproc"
201
57514323
ZK
202dep: depend
203
4b8b2edb 204depend: .depend
ea0f0681 205 $(MAKE) -C libavutil depend
5d22ccf7 206 $(MAKE) -C libavcodec depend
c80d990f 207 $(MAKE) -C libavformat depend
811b32ed 208ifeq ($(BUILD_VHOOK),yes)
5d22ccf7 209 $(MAKE) -C vhook depend
811b32ed 210endif
4b8b2edb 211
fd071c26 212.depend: $(SRCS) version.h
148beec7 213 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
57514323 214
cf2818b0 215.libs: lib
127d5c8d 216 @test -f .libs || touch .libs
dea4953d 217 @for i in $(DEP_LIBS) ; do if test $$i -nt .libs ; then touch .libs; fi ; done
cf2818b0 218
98013cc1 219clean:
5d22ccf7
DB
220 $(MAKE) -C libavutil clean
221 $(MAKE) -C libavcodec clean
abac6175 222 $(MAKE) -C libavformat clean
6d9a2421 223 $(MAKE) -C libpostproc clean
790c9ca7 224 $(MAKE) -C libswscale clean
5d22ccf7
DB
225 $(MAKE) -C tests clean
226 $(MAKE) -C vhook clean
bf840994 227 $(MAKE) -C doc clean
98013cc1 228 rm -f *.o *.d *~ .libs gmon.out TAGS \
6b991cb2 229 $(ALLPROGS) $(ALLPROGS_G) $(PROGTEST) $(QTFASTSTART)
142fc6b9 230
f255e0ab 231# Note well: config.log is NOT removed.
85f07f22 232distclean: clean
98013cc1
DB
233 $(MAKE) -C libavutil distclean
234 $(MAKE) -C libavcodec distclean
235 $(MAKE) -C libavformat distclean
6d9a2421 236 $(MAKE) -C libpostproc distclean
790c9ca7 237 $(MAKE) -C libswscale distclean
98013cc1
DB
238 $(MAKE) -C tests distclean
239 $(MAKE) -C vhook distclean
5c6a5d58 240 rm -f .depend version.h config.* *.pc
85f07f22
FB
241
242TAGS:
abac6175 243 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 244
dd9ca370
FB
245# regression tests
246
7d2f4546 247libavtest test mpeg4 mpeg test-server fulltest: $(PROGS)
ec9fca31 248 $(MAKE) -C tests $@
dd9ca370 249
ac977341 250# tar release (use 'make -k tar' on a checkouted tree)
951bf3e6
FB
251FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
252 cut -d "\"" -f 2 )
ac977341
FB
253
254tar:
255 rm -rf /tmp/$(FILE)
256 cp -r . /tmp/$(FILE)
36b1b0bc 257 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude .svn )
ac977341
FB
258 rm -rf /tmp/$(FILE)
259
cf2818b0
ZK
260.PHONY: lib
261
57514323
ZK
262ifneq ($(wildcard .depend),)
263include .depend
264endif