Add option to disable ffmpeg build.
[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
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 \
4b65d88f 11 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE
115329f1 12LDFLAGS+= -g
37736979 13
786b30af 14ifeq ($(CONFIG_FFMPEG),yes)
7d2f4546
DB
15MANPAGES=doc/ffmpeg.1
16PROGS_G+=ffmpeg_g$(EXESUF)
17PROGS+=ffmpeg$(EXESUF)
951bf3e6 18PROGTEST=output_example$(EXESUF)
38100e8c 19QTFASTSTART=qt-faststart$(EXESUF)
786b30af 20endif
01310af2
FB
21
22ifeq ($(CONFIG_FFSERVER),yes)
7d2f4546
DB
23MANPAGES+=doc/ffserver.1
24PROGS+=ffserver$(EXESUF)
01310af2
FB
25endif
26
27ifeq ($(CONFIG_FFPLAY),yes)
7d2f4546
DB
28MANPAGES+=doc/ffplay.1
29PROGS_G+=ffplay_g$(EXESUF)
30PROGS+=ffplay$(EXESUF)
f3ec2d46 31endif
85f07f22 32
6b991cb2
DB
33BASENAMES=ffmpeg ffplay ffserver
34ALLPROGS=$(addsuffix $(EXESUF), $(BASENAMES))
35ALLPROGS_G=$(addsuffix _g$(EXESUF), $(BASENAMES))
36ALLMANPAGES=$(addsuffix .1, $(BASENAMES))
37
dfdfa47c
FR
38ifeq ($(CONFIG_AUDIO_BEOS),yes)
39EXTRALIBS+=-lmedia -lbe
40endif
a1b63811 41
0fd94442 42ifeq ($(BUILD_SHARED),yes)
6bc114b2 43DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
0fd94442 44else
f3ec2d46 45DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
f02be79d
RS
46endif
47
142fc6b9
PG
48ifeq ($(BUILD_VHOOK),yes)
49VHOOK=videohook
50INSTALLVHOOK=install-vhook
47930f09 51endif
142fc6b9 52
146ea952
NB
53ifeq ($(BUILD_DOC),yes)
54DOC=documentation
55endif
56
f381af7b 57OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
57514323 58SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
84471efd 59LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
8dc6f118 60EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
57514323 61
790c9ca7 62ifeq ($(CONFIG_SWSCALER),yes)
cc654dd7 63LDFLAGS+=-L./libswscale
6de9e506 64EXTRALIBS+=-lswscale$(BUILDSUF)
790c9ca7
LA
65endif
66
496cfa3c 67all: lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
85f07f22 68
951bf3e6 69lib:
5d22ccf7
DB
70 $(MAKE) -C libavutil all
71 $(MAKE) -C libavcodec all
abac6175 72 $(MAKE) -C libavformat all
1a9150b1 73ifeq ($(CONFIG_PP),yes)
6d9a2421 74 $(MAKE) -C libpostproc all
1a9150b1 75endif
790c9ca7
LA
76ifeq ($(CONFIG_SWSCALER),yes)
77 $(MAKE) -C libswscale all
78endif
85f07f22 79
951bf3e6 80ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
6de9e506 81 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
85f07f22 82
951bf3e6 83ffserver$(EXESUF): ffserver.o .libs
6de9e506 84 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
85f07f22 85
951bf3e6 86ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
6de9e506 87 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
01310af2 88
0cfd96cc 89%$(EXESUF): %_g$(EXESUF)
01310af2
FB
90 cp -p $< $@
91 $(STRIP) $@
92
f1cc88a5 93version.h:
54003e1a 94 $(SRC_PATH)/version.sh "$(SRC_PATH)"
f1cc88a5 95
951bf3e6 96output_example$(EXESUF): output_example.o .libs
6de9e506 97 $(CC) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
8de65d4f 98
38100e8c 99qt-faststart$(EXESUF): qt-faststart.c
3acc68b4 100 $(CC) $(CFLAGS) $< -o $@
38100e8c 101
f7599d5f 102cws2fws$(EXESUF): cws2fws.c
3acc68b4 103 $(CC) $< -o $@ -lz
f7599d5f 104
01310af2 105ffplay.o: ffplay.c
115329f1 106 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
2744a37f 107
496cfa3c
MR
108ffmpeg.o ffplay.o ffserver.o: version.h
109
85f07f22 110%.o: %.c
115329f1 111 $(CC) $(CFLAGS) -c -o $@ $<
85f07f22 112
be12b2a4 113videohook: .libs
142fc6b9
PG
114 $(MAKE) -C vhook all
115
146ea952
NB
116documentation:
117 $(MAKE) -C doc all
118
b12f8273 119install: install-progs install-libs install-headers install-man $(INSTALLVHOOK)
81dcdc53 120
a4848db6 121ifeq ($(BUILD_SHARED),yes)
7d2f4546 122install-progs: $(PROGS) install-libs
a4848db6 123else
7d2f4546 124install-progs: $(PROGS)
a4848db6 125endif
951bf3e6 126 install -d "$(bindir)"
7d2f4546 127 install -c $(INSTALLSTRIP) -m 755 $(PROGS) "$(bindir)"
85f07f22 128
d35ff76b
FB
129# create the window installer
130wininstaller: all install
131 makensis ffinstall.nsi
132
23a65308
FB
133# install man from source dir if available
134install-man:
2f30a81d 135ifneq ($(CONFIG_MINGW),yes)
8b8e1c55 136 if [ -f doc/ffmpeg.1 ] ; then \
aa99b8ff 137 install -d "$(mandir)/man1" ; \
7d2f4546 138 install -m 644 $(MANPAGES) "$(mandir)/man1" ; \
23a65308 139 fi
951bf3e6 140endif
23a65308 141
aa99b8ff
MN
142install-vhook:
143 $(MAKE) -C vhook install
142fc6b9 144
b12f8273 145install-libs:
8b2121e3
MR
146 $(MAKE) -C libavutil install-libs
147 $(MAKE) -C libavcodec install-libs
148 $(MAKE) -C libavformat install-libs
1a9150b1 149ifeq ($(CONFIG_PP),yes)
6d9a2421 150 $(MAKE) -C libpostproc install-libs
1a9150b1 151endif
790c9ca7
LA
152ifeq ($(CONFIG_SWSCALER),yes)
153 $(MAKE) -C libswscale install-libs
154endif
155
8b2121e3 156ifeq ($(BUILD_SHARED),yes)
1e7ffa50 157 -$(LDCONFIG)
b12f8273 158endif
37736979 159
f29f3b5d
DB
160install-headers:
161 $(MAKE) -C libavutil install-headers
162 $(MAKE) -C libavcodec install-headers
163 $(MAKE) -C libavformat install-headers
1a9150b1 164ifeq ($(CONFIG_PP),yes)
6d9a2421 165 $(MAKE) -C libpostproc install-headers
1a9150b1 166endif
790c9ca7 167 $(MAKE) -C libswscale install-headers
f29f3b5d 168
f9edb717
DB
169uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
170
f9edb717
DB
171uninstall-progs:
172 rm -f $(addprefix $(bindir)/, $(ALLPROGS))
173
f9edb717 174uninstall-man:
2f30a81d 175ifneq ($(CONFIG_MINGW),yes)
f9edb717
DB
176 rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))
177endif
178
179uninstall-vhook:
180 $(MAKE) -C vhook uninstall
181
182uninstall-libs:
183 $(MAKE) -C libavutil uninstall-libs
184 $(MAKE) -C libavcodec uninstall-libs
185 $(MAKE) -C libavformat uninstall-libs
6d9a2421 186 $(MAKE) -C libpostproc uninstall-libs
f9edb717
DB
187
188uninstall-headers:
189 $(MAKE) -C libavutil uninstall-headers
190 $(MAKE) -C libavcodec uninstall-headers
191 $(MAKE) -C libavformat uninstall-headers
6d9a2421 192 $(MAKE) -C libpostproc uninstall-headers
f9edb717
DB
193 -rmdir "$(incdir)"
194 -rmdir "$(prefix)/include/postproc"
195
57514323
ZK
196dep: depend
197
4b8b2edb 198depend: .depend
ea0f0681 199 $(MAKE) -C libavutil depend
5d22ccf7 200 $(MAKE) -C libavcodec depend
c80d990f 201 $(MAKE) -C libavformat depend
691c480e
DB
202ifeq ($(CONFIG_PP),yes)
203 $(MAKE) -C libpostproc depend
204endif
eaa6d7b6
DB
205ifeq ($(CONFIG_SWSCALER),yes)
206 $(MAKE) -C libswscale depend
207endif
811b32ed 208ifeq ($(BUILD_VHOOK),yes)
5d22ccf7 209 $(MAKE) -C vhook depend
811b32ed 210endif
4b8b2edb 211
fd071c26 212.depend: $(SRCS) version.h
91beada7 213 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(SRCS) 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
902d3c6d 247codectest libavtest test-server fulltest test mpeg4 mpeg: $(PROGS)
ec9fca31 248 $(MAKE) -C tests $@
dd9ca370 249
ac977341 250# tar release (use 'make -k tar' on a checkouted tree)
92c3ef65 251FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " version.h | \
951bf3e6 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
3263626f
DB
260.PHONY: all lib videohook documentation install* wininstaller uninstall*
261.PHONY: dep depend clean distclean TAGS tar
262.PHONY: codectest libavtest test-server fulltest test mpeg4 mpeg
cf2818b0 263
57514323
ZK
264ifneq ($(wildcard .depend),)
265include .depend
266endif