uninstallation support
[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:
5d22ccf7
DB
67 $(MAKE) -C libavutil all
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
95ca7c94 95 $(CC) $(CFLAGS) $(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:
8b2121e3
MR
141 $(MAKE) -C libavutil install-libs
142 $(MAKE) -C libavcodec install-libs
143 $(MAKE) -C libavformat install-libs
1a9150b1 144ifeq ($(CONFIG_PP),yes)
8b2121e3 145 $(MAKE) -C libavcodec/libpostproc install-libs
1a9150b1 146endif
8b2121e3 147ifeq ($(BUILD_SHARED),yes)
1e7ffa50 148 -$(LDCONFIG)
b12f8273 149endif
37736979 150
f29f3b5d
DB
151install-headers:
152 $(MAKE) -C libavutil install-headers
153 $(MAKE) -C libavcodec install-headers
154 $(MAKE) -C libavformat install-headers
1a9150b1
DB
155ifeq ($(CONFIG_PP),yes)
156 $(MAKE) -C libavcodec/libpostproc install-headers
157endif
f29f3b5d 158
f9edb717
DB
159uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
160
161ALLPROGS=ffmpeg ffplay ffserver
162uninstall-progs:
163 rm -f $(addprefix $(bindir)/, $(ALLPROGS))
164
165ALLMANPAGES=$(addsuffix .1, $(ALLPROGS))
166uninstall-man:
167ifneq ($(CONFIG_WIN32),yes)
168 rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))
169endif
170
171uninstall-vhook:
172 $(MAKE) -C vhook uninstall
173
174uninstall-libs:
175 $(MAKE) -C libavutil uninstall-libs
176 $(MAKE) -C libavcodec uninstall-libs
177 $(MAKE) -C libavformat uninstall-libs
178 $(MAKE) -C libavcodec/libpostproc uninstall-libs
179
180uninstall-headers:
181 $(MAKE) -C libavutil uninstall-headers
182 $(MAKE) -C libavcodec uninstall-headers
183 $(MAKE) -C libavformat uninstall-headers
184 $(MAKE) -C libavcodec/libpostproc uninstall-headers
185 -rmdir "$(incdir)"
186 -rmdir "$(prefix)/include/postproc"
187
57514323
ZK
188dep: depend
189
4b8b2edb 190depend: .depend
5d22ccf7 191 $(MAKE) -C libavcodec depend
c80d990f 192 $(MAKE) -C libavformat depend
811b32ed 193ifeq ($(BUILD_VHOOK),yes)
5d22ccf7 194 $(MAKE) -C vhook depend
811b32ed 195endif
4b8b2edb
FB
196
197.depend: $(SRCS)
148beec7 198 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
57514323 199
cf2818b0 200.libs: lib
127d5c8d 201 @test -f .libs || touch .libs
6e023978 202 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
cf2818b0 203
98013cc1 204clean:
5d22ccf7
DB
205 $(MAKE) -C libavutil clean
206 $(MAKE) -C libavcodec clean
abac6175 207 $(MAKE) -C libavformat clean
1a9150b1 208 $(MAKE) -C libavcodec/libpostproc clean
5d22ccf7
DB
209 $(MAKE) -C tests clean
210 $(MAKE) -C vhook clean
98013cc1 211 rm -f *.o *.d *~ .libs gmon.out TAGS \
767b49a5 212 $(PROG) $(PROG_G) $(PROGTEST) $(QTFASTSTART)
142fc6b9 213
f255e0ab 214# Note well: config.log is NOT removed.
85f07f22 215distclean: clean
98013cc1
DB
216 $(MAKE) -C libavutil distclean
217 $(MAKE) -C libavcodec distclean
218 $(MAKE) -C libavformat distclean
1a9150b1 219 $(MAKE) -C libavcodec/libpostproc distclean
98013cc1
DB
220 $(MAKE) -C tests distclean
221 $(MAKE) -C vhook distclean
04c07634 222 rm -f .depend config.mak config.h *.pc
85f07f22
FB
223
224TAGS:
abac6175 225 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 226
dd9ca370
FB
227# regression tests
228
46ff904f 229libavtest test mpeg4 mpeg test-server fulltest: $(PROG)
ec9fca31 230 $(MAKE) -C tests $@
dd9ca370 231
ac977341 232# tar release (use 'make -k tar' on a checkouted tree)
951bf3e6
FB
233FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
234 cut -d "\"" -f 2 )
ac977341
FB
235
236tar:
237 rm -rf /tmp/$(FILE)
238 cp -r . /tmp/$(FILE)
239 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
240 rm -rf /tmp/$(FILE)
241
cf2818b0
ZK
242.PHONY: lib
243
57514323
ZK
244ifneq ($(wildcard .depend),)
245include .depend
246endif