CVS --> Subversion
[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
c11c2bc2 9CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavutil -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
115329f1 10LDFLAGS+= -g
37736979 11
980fc7b8 12ifeq ($(TARGET_GPROF),yes)
85f07f22
FB
13CFLAGS+=-p
14LDFLAGS+=-p
15endif
16
7d2f4546
DB
17MANPAGES=doc/ffmpeg.1
18PROGS_G+=ffmpeg_g$(EXESUF)
19PROGS+=ffmpeg$(EXESUF)
951bf3e6 20PROGTEST=output_example$(EXESUF)
38100e8c 21QTFASTSTART=qt-faststart$(EXESUF)
01310af2
FB
22
23ifeq ($(CONFIG_FFSERVER),yes)
7d2f4546
DB
24MANPAGES+=doc/ffserver.1
25PROGS+=ffserver$(EXESUF)
01310af2
FB
26endif
27
28ifeq ($(CONFIG_FFPLAY),yes)
7d2f4546
DB
29MANPAGES+=doc/ffplay.1
30PROGS_G+=ffplay_g$(EXESUF)
31PROGS+=ffplay$(EXESUF)
426c31a1 32FFPLAY_O=ffplay.o
f3ec2d46 33endif
85f07f22 34
6b991cb2
DB
35BASENAMES=ffmpeg ffplay ffserver
36ALLPROGS=$(addsuffix $(EXESUF), $(BASENAMES))
37ALLPROGS_G=$(addsuffix _g$(EXESUF), $(BASENAMES))
38ALLMANPAGES=$(addsuffix .1, $(BASENAMES))
39
dfdfa47c
FR
40ifeq ($(CONFIG_AUDIO_BEOS),yes)
41EXTRALIBS+=-lmedia -lbe
42endif
a1b63811 43
0fd94442 44ifeq ($(BUILD_SHARED),yes)
6bc114b2 45DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
0fd94442 46else
f3ec2d46 47DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
f02be79d
RS
48endif
49
142fc6b9
PG
50ifeq ($(BUILD_VHOOK),yes)
51VHOOK=videohook
52INSTALLVHOOK=install-vhook
47930f09 53endif
142fc6b9 54
6e023978
RS
55ifeq ($(TARGET_OS), SunOS)
56TEST=/usr/bin/test
57else
58TEST=test
59endif
60
146ea952
NB
61ifeq ($(BUILD_DOC),yes)
62DOC=documentation
63endif
64
426c31a1 65OBJS = ffmpeg.o ffserver.o cmdutils.o $(FFPLAY_O)
57514323 66SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
c11c2bc2 67FFLIBS = -L./libavformat -lavformat$(BUILDSUF) -L./libavcodec -lavcodec$(BUILDSUF) -L./libavutil -lavutil$(BUILDSUF)
57514323 68
7d2f4546 69all: lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
85f07f22 70
951bf3e6 71lib:
5d22ccf7
DB
72 $(MAKE) -C libavutil all
73 $(MAKE) -C libavcodec all
abac6175 74 $(MAKE) -C libavformat all
1a9150b1 75ifeq ($(CONFIG_PP),yes)
6d9a2421 76 $(MAKE) -C libpostproc all
1a9150b1 77endif
85f07f22 78
951bf3e6 79ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
01310af2 80 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
85f07f22 81
951bf3e6 82ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
f3ec2d46
SG
83 cp -p $< $@
84 $(STRIP) $@
37736979 85
951bf3e6 86ffserver$(EXESUF): ffserver.o .libs
115329f1 87 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
85f07f22 88
951bf3e6 89ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
01310af2
FB
90 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
91
951bf3e6 92ffplay$(EXESUF): ffplay_g$(EXESUF)
01310af2
FB
93 cp -p $< $@
94 $(STRIP) $@
95
951bf3e6 96output_example$(EXESUF): output_example.o .libs
8de65d4f
FB
97 $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
98
38100e8c 99qt-faststart$(EXESUF): qt-faststart.c
95ca7c94 100 $(CC) $(CFLAGS) $(SRC_PATH)/qt-faststart.c -o qt-faststart$(EXESUF)
38100e8c 101
f7599d5f
AB
102cws2fws$(EXESUF): cws2fws.c
103 $(CC) $(SRC_PATH)/cws2fws.c -o cws2fws$(EXESUF) -lz
104
01310af2 105ffplay.o: ffplay.c
115329f1 106 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
2744a37f 107
85f07f22 108%.o: %.c
115329f1 109 $(CC) $(CFLAGS) -c -o $@ $<
85f07f22 110
be12b2a4 111videohook: .libs
142fc6b9
PG
112 $(MAKE) -C vhook all
113
146ea952
NB
114documentation:
115 $(MAKE) -C doc all
116
d35ff76b
FB
117.PHONY: install
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:
951bf3e6 135ifneq ($(CONFIG_WIN32),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
8b2121e3 152ifeq ($(BUILD_SHARED),yes)
1e7ffa50 153 -$(LDCONFIG)
b12f8273 154endif
37736979 155
f29f3b5d
DB
156install-headers:
157 $(MAKE) -C libavutil install-headers
158 $(MAKE) -C libavcodec install-headers
159 $(MAKE) -C libavformat install-headers
1a9150b1 160ifeq ($(CONFIG_PP),yes)
6d9a2421 161 $(MAKE) -C libpostproc install-headers
1a9150b1 162endif
f29f3b5d 163
f9edb717
DB
164uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
165
f9edb717
DB
166uninstall-progs:
167 rm -f $(addprefix $(bindir)/, $(ALLPROGS))
168
f9edb717
DB
169uninstall-man:
170ifneq ($(CONFIG_WIN32),yes)
171 rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))
172endif
173
174uninstall-vhook:
175 $(MAKE) -C vhook uninstall
176
177uninstall-libs:
178 $(MAKE) -C libavutil uninstall-libs
179 $(MAKE) -C libavcodec uninstall-libs
180 $(MAKE) -C libavformat uninstall-libs
6d9a2421 181 $(MAKE) -C libpostproc uninstall-libs
f9edb717
DB
182
183uninstall-headers:
184 $(MAKE) -C libavutil uninstall-headers
185 $(MAKE) -C libavcodec uninstall-headers
186 $(MAKE) -C libavformat uninstall-headers
6d9a2421 187 $(MAKE) -C libpostproc uninstall-headers
f9edb717
DB
188 -rmdir "$(incdir)"
189 -rmdir "$(prefix)/include/postproc"
190
57514323
ZK
191dep: depend
192
4b8b2edb 193depend: .depend
ea0f0681 194 $(MAKE) -C libavutil depend
5d22ccf7 195 $(MAKE) -C libavcodec depend
c80d990f 196 $(MAKE) -C libavformat depend
811b32ed 197ifeq ($(BUILD_VHOOK),yes)
5d22ccf7 198 $(MAKE) -C vhook depend
811b32ed 199endif
4b8b2edb
FB
200
201.depend: $(SRCS)
148beec7 202 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
57514323 203
cf2818b0 204.libs: lib
127d5c8d 205 @test -f .libs || touch .libs
6e023978 206 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
cf2818b0 207
98013cc1 208clean:
5d22ccf7
DB
209 $(MAKE) -C libavutil clean
210 $(MAKE) -C libavcodec clean
abac6175 211 $(MAKE) -C libavformat clean
6d9a2421 212 $(MAKE) -C libpostproc clean
5d22ccf7
DB
213 $(MAKE) -C tests clean
214 $(MAKE) -C vhook clean
98013cc1 215 rm -f *.o *.d *~ .libs gmon.out TAGS \
6b991cb2 216 $(ALLPROGS) $(ALLPROGS_G) $(PROGTEST) $(QTFASTSTART)
142fc6b9 217
f255e0ab 218# Note well: config.log is NOT removed.
85f07f22 219distclean: clean
98013cc1
DB
220 $(MAKE) -C libavutil distclean
221 $(MAKE) -C libavcodec distclean
222 $(MAKE) -C libavformat distclean
6d9a2421 223 $(MAKE) -C libpostproc distclean
98013cc1
DB
224 $(MAKE) -C tests distclean
225 $(MAKE) -C vhook distclean
04c07634 226 rm -f .depend config.mak config.h *.pc
85f07f22
FB
227
228TAGS:
abac6175 229 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 230
dd9ca370
FB
231# regression tests
232
7d2f4546 233libavtest test mpeg4 mpeg test-server fulltest: $(PROGS)
ec9fca31 234 $(MAKE) -C tests $@
dd9ca370 235
ac977341 236# tar release (use 'make -k tar' on a checkouted tree)
951bf3e6
FB
237FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
238 cut -d "\"" -f 2 )
ac977341
FB
239
240tar:
241 rm -rf /tmp/$(FILE)
242 cp -r . /tmp/$(FILE)
36b1b0bc 243 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude .svn )
ac977341
FB
244 rm -rf /tmp/$(FILE)
245
cf2818b0
ZK
246.PHONY: lib
247
57514323
ZK
248ifneq ($(wildcard .depend),)
249include .depend
250endif