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