malloc padding to avoid reading past the malloc()ed area.
[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
4baca069 10LDFLAGS+= -g
37736979 11
980fc7b8 12ifeq ($(TARGET_GPROF),yes)
85f07f22
FB
13CFLAGS+=-p
14LDFLAGS+=-p
15endif
16
8b8e1c55 17MANPAGE=doc/ffmpeg.1
951bf3e6
FB
18PROG=ffmpeg$(EXESUF)
19PROGTEST=output_example$(EXESUF)
38100e8c 20QTFASTSTART=qt-faststart$(EXESUF)
01310af2
FB
21
22ifeq ($(CONFIG_FFSERVER),yes)
8b8e1c55 23MANPAGE+=doc/ffserver.1
951bf3e6 24PROG+=ffserver$(EXESUF)
01310af2
FB
25endif
26
27ifeq ($(CONFIG_FFPLAY),yes)
8b8e1c55 28MANPAGE+=doc/ffplay.1
951bf3e6 29PROG+=ffplay$(EXESUF)
426c31a1 30FFPLAY_O=ffplay.o
f3ec2d46 31endif
85f07f22 32
dfdfa47c
FR
33ifeq ($(CONFIG_AUDIO_BEOS),yes)
34EXTRALIBS+=-lmedia -lbe
35endif
a1b63811 36
0fd94442 37ifeq ($(BUILD_SHARED),yes)
6bc114b2 38DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
0fd94442 39else
f3ec2d46 40DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
f02be79d
RS
41endif
42
142fc6b9
PG
43ifeq ($(BUILD_VHOOK),yes)
44VHOOK=videohook
45INSTALLVHOOK=install-vhook
46CLEANVHOOK=clean-vhook
47930f09 47endif
142fc6b9 48
6e023978
RS
49ifeq ($(TARGET_OS), SunOS)
50TEST=/usr/bin/test
51else
52TEST=test
53endif
54
146ea952
NB
55ifeq ($(BUILD_DOC),yes)
56DOC=documentation
57endif
58
426c31a1 59OBJS = ffmpeg.o ffserver.o cmdutils.o $(FFPLAY_O)
57514323 60SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
c11c2bc2 61FFLIBS = -L./libavformat -lavformat$(BUILDSUF) -L./libavcodec -lavcodec$(BUILDSUF) -L./libavutil -lavutil$(BUILDSUF)
57514323 62
146ea952 63all: lib $(PROG) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
85f07f22 64
951bf3e6 65lib:
c11c2bc2 66 $(MAKE) -C libavutil all
2cc8ae96 67 $(MAKE) -C libavcodec all
abac6175 68 $(MAKE) -C libavformat all
85f07f22 69
951bf3e6 70ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
01310af2 71 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
85f07f22 72
951bf3e6 73ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
f3ec2d46
SG
74 cp -p $< $@
75 $(STRIP) $@
37736979 76
951bf3e6 77ffserver$(EXESUF): ffserver.o .libs
cf2818b0 78 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
85f07f22 79
951bf3e6 80ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
01310af2
FB
81 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
82
951bf3e6 83ffplay$(EXESUF): ffplay_g$(EXESUF)
01310af2
FB
84 cp -p $< $@
85 $(STRIP) $@
86
951bf3e6 87output_example$(EXESUF): output_example.o .libs
8de65d4f
FB
88 $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
89
38100e8c 90qt-faststart$(EXESUF): qt-faststart.c
426c31a1 91 $(CC) $(SRC_PATH)/qt-faststart.c -o qt-faststart$(EXESUF)
38100e8c 92
f7599d5f
AB
93cws2fws$(EXESUF): cws2fws.c
94 $(CC) $(SRC_PATH)/cws2fws.c -o cws2fws$(EXESUF) -lz
95
01310af2
FB
96ffplay.o: ffplay.c
97 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
2744a37f 98
85f07f22 99%.o: %.c
daf8e955 100 $(CC) $(CFLAGS) -c -o $@ $<
85f07f22 101
be12b2a4 102videohook: .libs
142fc6b9
PG
103 $(MAKE) -C vhook all
104
146ea952
NB
105documentation:
106 $(MAKE) -C doc all
107
d35ff76b
FB
108.PHONY: install
109
23a65308 110install: all install-man $(INSTALLVHOOK)
c11c2bc2 111 $(MAKE) -C libavutil install
0fd94442 112 $(MAKE) -C libavcodec install
6bc114b2 113 $(MAKE) -C libavformat install
951bf3e6 114 install -d "$(bindir)"
65d1bea2 115 install -c $(INSTALLSTRIP) -m 755 $(PROG) "$(bindir)"
85f07f22 116
d35ff76b
FB
117# create the window installer
118wininstaller: all install
119 makensis ffinstall.nsi
120
23a65308
FB
121# install man from source dir if available
122install-man:
951bf3e6 123ifneq ($(CONFIG_WIN32),yes)
8b8e1c55 124 if [ -f doc/ffmpeg.1 ] ; then \
aa99b8ff
MN
125 install -d "$(mandir)/man1" ; \
126 install -m 644 $(MANPAGE) "$(mandir)/man1" ; \
23a65308 127 fi
951bf3e6 128endif
23a65308 129
aa99b8ff
MN
130install-vhook:
131 $(MAKE) -C vhook install
142fc6b9 132
37736979 133installlib:
c11c2bc2 134 $(MAKE) -C libavutil installlib
37736979 135 $(MAKE) -C libavcodec installlib
abac6175 136 $(MAKE) -C libavformat installlib
37736979 137
57514323
ZK
138dep: depend
139
4b8b2edb 140depend: .depend
c80d990f
SS
141 $(MAKE) -C libavcodec depend
142 $(MAKE) -C libavformat depend
811b32ed 143ifeq ($(BUILD_VHOOK),yes)
c80d990f 144 $(MAKE) -C vhook depend
811b32ed 145endif
4b8b2edb
FB
146
147.depend: $(SRCS)
148beec7 148 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
57514323 149
cf2818b0 150.libs: lib
127d5c8d 151 @test -f .libs || touch .libs
6e023978 152 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
cf2818b0 153
bc634f6f 154clean: $(CLEANVHOOK)
c11c2bc2 155 $(MAKE) -C libavutil clean
2cc8ae96 156 $(MAKE) -C libavcodec clean
abac6175 157 $(MAKE) -C libavformat clean
dd9ca370 158 $(MAKE) -C tests clean
2c735779
ZK
159 rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXESUF) \
160 ffplay_g$(EXESUF) $(PROG) $(PROGTEST) $(QTFASTSTART)
85f07f22 161
142fc6b9
PG
162clean-vhook:
163 $(MAKE) -C vhook clean
164
f255e0ab 165# Note well: config.log is NOT removed.
85f07f22 166distclean: clean
c72c6d2d 167 $(MAKE) -C libavcodec distclean
ea7e68b1 168 rm -f config.mak config.h *.pc
85f07f22
FB
169
170TAGS:
abac6175 171 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 172
dd9ca370
FB
173# regression tests
174
951bf3e6 175libavtest test mpeg4 mpeg test-server fulltest: ffmpeg$(EXESUF)
ec9fca31 176 $(MAKE) -C tests $@
dd9ca370 177
ac977341 178# tar release (use 'make -k tar' on a checkouted tree)
951bf3e6
FB
179FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
180 cut -d "\"" -f 2 )
ac977341
FB
181
182tar:
183 rm -rf /tmp/$(FILE)
184 cp -r . /tmp/$(FILE)
185 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
186 rm -rf /tmp/$(FILE)
187
cf2818b0
ZK
188.PHONY: lib
189
57514323
ZK
190ifneq ($(wildcard .depend),)
191include .depend
192endif