Avoid binary stripping rule code duplication.
[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
7d2f4546
DB
17MANPAGES=doc/ffmpeg.1
18PROGS_G+=ffmpeg_g$(EXESUF)
19PROGS+=ffmpeg$(EXESUF)
951bf3e6 20PROGTEST=output_example$(EXESUF)
38100e8c 21QTFASTSTART=qt-faststart$(EXESUF)
01310af2
FB
22
23ifeq ($(CONFIG_FFSERVER),yes)
7d2f4546
DB
24MANPAGES+=doc/ffserver.1
25PROGS+=ffserver$(EXESUF)
01310af2
FB
26endif
27
28ifeq ($(CONFIG_FFPLAY),yes)
7d2f4546
DB
29MANPAGES+=doc/ffplay.1
30PROGS_G+=ffplay_g$(EXESUF)
31PROGS+=ffplay$(EXESUF)
426c31a1 32FFPLAY_O=ffplay.o
f3ec2d46 33endif
85f07f22 34
6b991cb2
DB
35BASENAMES=ffmpeg ffplay ffserver
36ALLPROGS=$(addsuffix $(EXESUF), $(BASENAMES))
37ALLPROGS_G=$(addsuffix _g$(EXESUF), $(BASENAMES))
38ALLMANPAGES=$(addsuffix .1, $(BASENAMES))
39
dfdfa47c
FR
40ifeq ($(CONFIG_AUDIO_BEOS),yes)
41EXTRALIBS+=-lmedia -lbe
42endif
a1b63811 43
0fd94442 44ifeq ($(BUILD_SHARED),yes)
6bc114b2 45DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
0fd94442 46else
f3ec2d46 47DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
f02be79d
RS
48endif
49
142fc6b9
PG
50ifeq ($(BUILD_VHOOK),yes)
51VHOOK=videohook
52INSTALLVHOOK=install-vhook
47930f09 53endif
142fc6b9 54
6e023978
RS
55ifeq ($(TARGET_OS), SunOS)
56TEST=/usr/bin/test
57else
58TEST=test
59endif
60
146ea952
NB
61ifeq ($(BUILD_DOC),yes)
62DOC=documentation
63endif
64
426c31a1 65OBJS = ffmpeg.o ffserver.o cmdutils.o $(FFPLAY_O)
57514323 66SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
5d38ba33
MR
67FFLIBDIRS = -L./libavformat -L./libavcodec -L./libavutil
68FFLIBS = -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF)
57514323 69
7d2f4546 70all: lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
85f07f22 71
951bf3e6 72lib:
5d22ccf7
DB
73 $(MAKE) -C libavutil all
74 $(MAKE) -C libavcodec all
abac6175 75 $(MAKE) -C libavformat all
1a9150b1 76ifeq ($(CONFIG_PP),yes)
6d9a2421 77 $(MAKE) -C libpostproc all
1a9150b1 78endif
85f07f22 79
951bf3e6 80ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
5d38ba33 81 $(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
85f07f22 82
951bf3e6 83ffserver$(EXESUF): ffserver.o .libs
5d38ba33 84 $(CC) $(FFLIBDIRS) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
85f07f22 85
951bf3e6 86ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
5d38ba33 87 $(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
01310af2 88
0cfd96cc 89%$(EXESUF): %_g$(EXESUF)
01310af2
FB
90 cp -p $< $@
91 $(STRIP) $@
92
951bf3e6 93output_example$(EXESUF): output_example.o .libs
5d38ba33 94 $(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
8de65d4f 95
38100e8c 96qt-faststart$(EXESUF): qt-faststart.c
95ca7c94 97 $(CC) $(CFLAGS) $(SRC_PATH)/qt-faststart.c -o qt-faststart$(EXESUF)
38100e8c 98
f7599d5f
AB
99cws2fws$(EXESUF): cws2fws.c
100 $(CC) $(SRC_PATH)/cws2fws.c -o cws2fws$(EXESUF) -lz
101
01310af2 102ffplay.o: ffplay.c
115329f1 103 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
2744a37f 104
85f07f22 105%.o: %.c
115329f1 106 $(CC) $(CFLAGS) -c -o $@ $<
85f07f22 107
be12b2a4 108videohook: .libs
142fc6b9
PG
109 $(MAKE) -C vhook all
110
146ea952
NB
111documentation:
112 $(MAKE) -C doc all
113
d35ff76b
FB
114.PHONY: install
115
b12f8273 116install: install-progs install-libs install-headers install-man $(INSTALLVHOOK)
81dcdc53 117
a4848db6 118ifeq ($(BUILD_SHARED),yes)
7d2f4546 119install-progs: $(PROGS) install-libs
a4848db6 120else
7d2f4546 121install-progs: $(PROGS)
a4848db6 122endif
951bf3e6 123 install -d "$(bindir)"
7d2f4546 124 install -c $(INSTALLSTRIP) -m 755 $(PROGS) "$(bindir)"
85f07f22 125
d35ff76b
FB
126# create the window installer
127wininstaller: all install
128 makensis ffinstall.nsi
129
23a65308
FB
130# install man from source dir if available
131install-man:
951bf3e6 132ifneq ($(CONFIG_WIN32),yes)
8b8e1c55 133 if [ -f doc/ffmpeg.1 ] ; then \
aa99b8ff 134 install -d "$(mandir)/man1" ; \
7d2f4546 135 install -m 644 $(MANPAGES) "$(mandir)/man1" ; \
23a65308 136 fi
951bf3e6 137endif
23a65308 138
aa99b8ff
MN
139install-vhook:
140 $(MAKE) -C vhook install
142fc6b9 141
b12f8273 142install-libs:
8b2121e3
MR
143 $(MAKE) -C libavutil install-libs
144 $(MAKE) -C libavcodec install-libs
145 $(MAKE) -C libavformat install-libs
1a9150b1 146ifeq ($(CONFIG_PP),yes)
6d9a2421 147 $(MAKE) -C libpostproc install-libs
1a9150b1 148endif
8b2121e3 149ifeq ($(BUILD_SHARED),yes)
1e7ffa50 150 -$(LDCONFIG)
b12f8273 151endif
37736979 152
f29f3b5d
DB
153install-headers:
154 $(MAKE) -C libavutil install-headers
155 $(MAKE) -C libavcodec install-headers
156 $(MAKE) -C libavformat install-headers
1a9150b1 157ifeq ($(CONFIG_PP),yes)
6d9a2421 158 $(MAKE) -C libpostproc install-headers
1a9150b1 159endif
f29f3b5d 160
f9edb717
DB
161uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
162
f9edb717
DB
163uninstall-progs:
164 rm -f $(addprefix $(bindir)/, $(ALLPROGS))
165
f9edb717
DB
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
6d9a2421 178 $(MAKE) -C libpostproc uninstall-libs
f9edb717
DB
179
180uninstall-headers:
181 $(MAKE) -C libavutil uninstall-headers
182 $(MAKE) -C libavcodec uninstall-headers
183 $(MAKE) -C libavformat uninstall-headers
6d9a2421 184 $(MAKE) -C libpostproc uninstall-headers
f9edb717
DB
185 -rmdir "$(incdir)"
186 -rmdir "$(prefix)/include/postproc"
187
57514323
ZK
188dep: depend
189
4b8b2edb 190depend: .depend
ea0f0681 191 $(MAKE) -C libavutil depend
5d22ccf7 192 $(MAKE) -C libavcodec depend
c80d990f 193 $(MAKE) -C libavformat depend
811b32ed 194ifeq ($(BUILD_VHOOK),yes)
5d22ccf7 195 $(MAKE) -C vhook depend
811b32ed 196endif
4b8b2edb
FB
197
198.depend: $(SRCS)
148beec7 199 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
57514323 200
cf2818b0 201.libs: lib
127d5c8d 202 @test -f .libs || touch .libs
6e023978 203 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
cf2818b0 204
98013cc1 205clean:
5d22ccf7
DB
206 $(MAKE) -C libavutil clean
207 $(MAKE) -C libavcodec clean
abac6175 208 $(MAKE) -C libavformat clean
6d9a2421 209 $(MAKE) -C libpostproc clean
5d22ccf7
DB
210 $(MAKE) -C tests clean
211 $(MAKE) -C vhook clean
98013cc1 212 rm -f *.o *.d *~ .libs gmon.out TAGS \
6b991cb2 213 $(ALLPROGS) $(ALLPROGS_G) $(PROGTEST) $(QTFASTSTART)
142fc6b9 214
f255e0ab 215# Note well: config.log is NOT removed.
85f07f22 216distclean: clean
98013cc1
DB
217 $(MAKE) -C libavutil distclean
218 $(MAKE) -C libavcodec distclean
219 $(MAKE) -C libavformat distclean
6d9a2421 220 $(MAKE) -C libpostproc distclean
98013cc1
DB
221 $(MAKE) -C tests distclean
222 $(MAKE) -C vhook distclean
04c07634 223 rm -f .depend config.mak config.h *.pc
85f07f22
FB
224
225TAGS:
abac6175 226 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 227
dd9ca370
FB
228# regression tests
229
7d2f4546 230libavtest test mpeg4 mpeg test-server fulltest: $(PROGS)
ec9fca31 231 $(MAKE) -C tests $@
dd9ca370 232
ac977341 233# tar release (use 'make -k tar' on a checkouted tree)
951bf3e6
FB
234FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
235 cut -d "\"" -f 2 )
ac977341
FB
236
237tar:
238 rm -rf /tmp/$(FILE)
239 cp -r . /tmp/$(FILE)
36b1b0bc 240 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude .svn )
ac977341
FB
241 rm -rf /tmp/$(FILE)
242
cf2818b0
ZK
243.PHONY: lib
244
57514323
ZK
245ifneq ($(wildcard .depend),)
246include .depend
247endif