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