add quotes around $(libdir)
[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
1a9150b1
DB
70ifeq ($(CONFIG_PP),yes)
71 $(MAKE) -C libavcodec/libpostproc all
72endif
85f07f22 73
951bf3e6 74ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
01310af2 75 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
85f07f22 76
951bf3e6 77ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
f3ec2d46
SG
78 cp -p $< $@
79 $(STRIP) $@
37736979 80
951bf3e6 81ffserver$(EXESUF): ffserver.o .libs
115329f1 82 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
85f07f22 83
951bf3e6 84ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
01310af2
FB
85 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
86
951bf3e6 87ffplay$(EXESUF): ffplay_g$(EXESUF)
01310af2
FB
88 cp -p $< $@
89 $(STRIP) $@
90
951bf3e6 91output_example$(EXESUF): output_example.o .libs
8de65d4f
FB
92 $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
93
38100e8c 94qt-faststart$(EXESUF): qt-faststart.c
426c31a1 95 $(CC) $(SRC_PATH)/qt-faststart.c -o qt-faststart$(EXESUF)
38100e8c 96
f7599d5f
AB
97cws2fws$(EXESUF): cws2fws.c
98 $(CC) $(SRC_PATH)/cws2fws.c -o cws2fws$(EXESUF) -lz
99
01310af2 100ffplay.o: ffplay.c
115329f1 101 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
2744a37f 102
85f07f22 103%.o: %.c
115329f1 104 $(CC) $(CFLAGS) -c -o $@ $<
85f07f22 105
be12b2a4 106videohook: .libs
142fc6b9
PG
107 $(MAKE) -C vhook all
108
146ea952
NB
109documentation:
110 $(MAKE) -C doc all
111
d35ff76b
FB
112.PHONY: install
113
b12f8273 114install: install-progs install-libs install-headers install-man $(INSTALLVHOOK)
81dcdc53 115
a4848db6
DB
116ifeq ($(BUILD_SHARED),yes)
117install-progs: $(PROG) install-libs
118else
1eb17b3c 119install-progs: $(PROG)
a4848db6 120endif
951bf3e6 121 install -d "$(bindir)"
65d1bea2 122 install -c $(INSTALLSTRIP) -m 755 $(PROG) "$(bindir)"
85f07f22 123
d35ff76b
FB
124# create the window installer
125wininstaller: all install
126 makensis ffinstall.nsi
127
23a65308
FB
128# install man from source dir if available
129install-man:
951bf3e6 130ifneq ($(CONFIG_WIN32),yes)
8b8e1c55 131 if [ -f doc/ffmpeg.1 ] ; then \
aa99b8ff
MN
132 install -d "$(mandir)/man1" ; \
133 install -m 644 $(MANPAGE) "$(mandir)/man1" ; \
23a65308 134 fi
951bf3e6 135endif
23a65308 136
aa99b8ff
MN
137install-vhook:
138 $(MAKE) -C vhook install
142fc6b9 139
b12f8273 140install-libs:
2fdd5a68 141 install -d "$(libdir)"
8b2121e3
MR
142 $(MAKE) -C libavutil install-libs
143 $(MAKE) -C libavcodec install-libs
144 $(MAKE) -C libavformat install-libs
1a9150b1 145ifeq ($(CONFIG_PP),yes)
8b2121e3 146 $(MAKE) -C libavcodec/libpostproc install-libs
1a9150b1 147endif
8b2121e3 148ifeq ($(BUILD_SHARED),yes)
b12f8273
DB
149 $(LDCONFIG) || true
150endif
37736979 151
f29f3b5d 152install-headers:
dc2a1ce5
DB
153 install -d "$(incdir)"
154 install -d "$(libdir)/pkgconfig"
f29f3b5d
DB
155 $(MAKE) -C libavutil install-headers
156 $(MAKE) -C libavcodec install-headers
157 $(MAKE) -C libavformat install-headers
1a9150b1
DB
158ifeq ($(CONFIG_PP),yes)
159 $(MAKE) -C libavcodec/libpostproc install-headers
160endif
f29f3b5d 161
57514323
ZK
162dep: depend
163
4b8b2edb 164depend: .depend
c80d990f
SS
165 $(MAKE) -C libavcodec depend
166 $(MAKE) -C libavformat depend
811b32ed 167ifeq ($(BUILD_VHOOK),yes)
c80d990f 168 $(MAKE) -C vhook depend
811b32ed 169endif
4b8b2edb
FB
170
171.depend: $(SRCS)
148beec7 172 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
57514323 173
cf2818b0 174.libs: lib
127d5c8d 175 @test -f .libs || touch .libs
6e023978 176 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
cf2818b0 177
98013cc1 178clean:
c11c2bc2 179 $(MAKE) -C libavutil clean
2cc8ae96 180 $(MAKE) -C libavcodec clean
abac6175 181 $(MAKE) -C libavformat clean
1a9150b1 182 $(MAKE) -C libavcodec/libpostproc clean
dd9ca370 183 $(MAKE) -C tests clean
142fc6b9 184 $(MAKE) -C vhook clean
98013cc1 185 rm -f *.o *.d *~ .libs gmon.out TAGS \
767b49a5 186 $(PROG) $(PROG_G) $(PROGTEST) $(QTFASTSTART)
142fc6b9 187
f255e0ab 188# Note well: config.log is NOT removed.
85f07f22 189distclean: clean
98013cc1
DB
190 $(MAKE) -C libavutil distclean
191 $(MAKE) -C libavcodec distclean
192 $(MAKE) -C libavformat distclean
1a9150b1 193 $(MAKE) -C libavcodec/libpostproc distclean
98013cc1
DB
194 $(MAKE) -C tests distclean
195 $(MAKE) -C vhook distclean
04c07634 196 rm -f .depend config.mak config.h *.pc
85f07f22
FB
197
198TAGS:
abac6175 199 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 200
dd9ca370
FB
201# regression tests
202
46ff904f 203libavtest test mpeg4 mpeg test-server fulltest: $(PROG)
ec9fca31 204 $(MAKE) -C tests $@
dd9ca370 205
ac977341 206# tar release (use 'make -k tar' on a checkouted tree)
951bf3e6
FB
207FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
208 cut -d "\"" -f 2 )
ac977341
FB
209
210tar:
211 rm -rf /tmp/$(FILE)
212 cp -r . /tmp/$(FILE)
213 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
214 rm -rf /tmp/$(FILE)
215
cf2818b0
ZK
216.PHONY: lib
217
57514323
ZK
218ifneq ($(wildcard .depend),)
219include .depend
220endif