Statistics
| Branch: | Revision:

ffmpeg / Makefile @ 8f58a4c9

History | View | Annotate | Download (8.97 KB)

1 a1b63811 Fabrice Bellard
#
2 85f07f22 Fabrice Bellard
# Main ffmpeg Makefile
3 38100e8c Mike Melanson
# (c) 2000-2004 Fabrice Bellard
4 85f07f22 Fabrice Bellard
#
5 980fc7b8 Fabrice Bellard
include config.mak
6 85f07f22 Fabrice Bellard
7 997baf01 Måns Rullgård
VPATH=$(SRC_PATH_BARE)
8 dd9ca370 Fabrice Bellard
9 cbeee4d8 Diego Biurrun
CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
10 a163ed1a Luca Abeni
       -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
11 364a9607 Diego Biurrun
       -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H
12 115329f1 Diego Biurrun
LDFLAGS+= -g
13 37736979 Fabrice Bellard
14 0cb8579a Måns Rullgård
PROGS-$(CONFIG_FFMPEG)   += ffmpeg
15
PROGS-$(CONFIG_FFPLAY)   += ffplay
16
PROGS-$(CONFIG_FFSERVER) += ffserver
17 01310af2 Fabrice Bellard
18 bb8fe69a Diego Biurrun
PROGS       = $(addsuffix   $(EXESUF), $(PROGS-yes))
19
PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
20
MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
21 85f07f22 Fabrice Bellard
22 bb8fe69a Diego Biurrun
BASENAMES   = ffmpeg ffplay ffserver
23
ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
24
ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
25
ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
26 6b991cb2 Diego Biurrun
27 0fd94442 Nick Kurshev
ifeq ($(BUILD_SHARED),yes)
28 6bc114b2 Tim Allen
DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
29 0fd94442 Nick Kurshev
else
30 f3ec2d46 Slavik Gnatenko
DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
31 f02be79d Roman Shaposhnik
endif
32
33 7d6ac9a3 Måns Rullgård
ALL_TARGETS-$(CONFIG_VHOOK) += videohook
34
ALL_TARGETS-$(BUILD_DOC)    += documentation
35
36
INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
37
INSTALL_TARGETS-$(BUILD_DOC)    += install-man
38 dd9f3d97 Måns Rullgård
39 3b26ee47 Måns Rullgård
VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
40 dd9f3d97 Måns Rullgård
41
BASEHOOKS = fish null watermark
42
ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
43
ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
44
45
HOOKS-$(HAVE_FORK)      += ppm
46
HOOKS-$(HAVE_IMLIB2)    += imlib2
47
HOOKS-$(HAVE_FREETYPE2) += drawtext
48
49
HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
50
51
VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
52 cbefadbd Måns Rullgård
LIBS_imlib2$(SLIBSUF)       = `imlib2-config --libs`
53 dd9f3d97 Måns Rullgård
54
VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
55 cbefadbd Måns Rullgård
LIBS_drawtext$(SLIBSUF)        = `freetype-config --libs`
56 dd9f3d97 Måns Rullgård
57
VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
58 142fc6b9 Philip Gladstone
59 7f0f6e13 Måns Rullgård
SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
60 84471efd Diego Biurrun
LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
61 8dc6f118 Panagiotis Issaris
EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
62 57514323 Zdenek Kabelac
63 790c9ca7 Luca Abeni
ifeq ($(CONFIG_SWSCALER),yes)
64 06694949 Diego Biurrun
LDFLAGS+=-L$(BUILD_ROOT)/libswscale
65 6de9e506 Diego Biurrun
EXTRALIBS+=-lswscale$(BUILDSUF)
66 790c9ca7 Luca Abeni
endif
67
68 7d6ac9a3 Måns Rullgård
all: lib $(PROGS) $(ALL_TARGETS-yes)
69 85f07f22 Fabrice Bellard
70 951bf3e6 Fabrice Bellard
lib:
71 5d22ccf7 Diego Biurrun
	$(MAKE) -C libavutil   all
72
	$(MAKE) -C libavcodec  all
73 abac6175 Fabrice Bellard
	$(MAKE) -C libavformat all
74 1a9150b1 Diego Biurrun
ifeq ($(CONFIG_PP),yes)
75 6d9a2421 Diego Biurrun
	$(MAKE) -C libpostproc all
76 1a9150b1 Diego Biurrun
endif
77 790c9ca7 Luca Abeni
ifeq ($(CONFIG_SWSCALER),yes)
78
	$(MAKE) -C libswscale  all
79
endif
80 85f07f22 Fabrice Bellard
81 951bf3e6 Fabrice Bellard
ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
82 6de9e506 Diego Biurrun
	$(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
83 85f07f22 Fabrice Bellard
84 951bf3e6 Fabrice Bellard
ffserver$(EXESUF): ffserver.o .libs
85 6de9e506 Diego Biurrun
	$(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
86 85f07f22 Fabrice Bellard
87 951bf3e6 Fabrice Bellard
ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
88 6de9e506 Diego Biurrun
	$(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
89 01310af2 Fabrice Bellard
90 0cfd96cc Diego Biurrun
%$(EXESUF): %_g$(EXESUF)
91 01310af2 Fabrice Bellard
	cp -p $< $@
92
	$(STRIP) $@
93
94 a4da50e1 Måns Rullgård
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
95
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
96
version.h: $(SVN_ENTRIES)
97
endif
98
99 f1cc88a5 Diego Biurrun
version.h:
100 997baf01 Måns Rullgård
	$(SRC_PATH)/version.sh $(SRC_PATH)
101 f1cc88a5 Diego Biurrun
102 951bf3e6 Fabrice Bellard
output_example$(EXESUF): output_example.o .libs
103 18caf192 Diego Biurrun
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
104 8de65d4f Fabrice Bellard
105 83ef1fea Benoit Fouet
tools/qt-faststart$(EXESUF): tools/qt-faststart.c
106 3acc68b4 Måns Rullgård
	$(CC) $(CFLAGS) $< -o $@
107 38100e8c Mike Melanson
108 83ef1fea Benoit Fouet
tools/cws2fws$(EXESUF): tools/cws2fws.c
109 18caf192 Diego Biurrun
	$(CC) $(CFLAGS) $< -o $@ -lz
110 f7599d5f Alex Beregszaszi
111 4566de57 Diego Biurrun
ffplay.o: CFLAGS += $(SDL_CFLAGS)
112 2744a37f Fabrice Bellard
113 496cfa3c Måns Rullgård
ffmpeg.o ffplay.o ffserver.o: version.h
114
115 ed5614eb Diego Biurrun
videohook: .libs $(HOOKS)
116
117
vhook/%$(SLIBSUF): vhook/%.o
118 3b26ee47 Måns Rullgård
	$(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
119 ed5614eb Diego Biurrun
120 3b26ee47 Måns Rullgård
vhook/%.o: vhook/%.c
121
	$(CC) $(VHOOKCFLAGS) -c -o $@ $<
122
123
%.o: %.c
124
	$(CC) $(CFLAGS) -c -o $@ $<
125 142fc6b9 Philip Gladstone
126 e9b19db8 Diego Biurrun
documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
127
                                 ffplay-doc.html hooks.html $(ALLMANPAGES))
128
129
doc/%.html: doc/%.texi
130
	texi2html -monolithic -number $<
131
	mv $(@F) $@
132
133
doc/%.pod: doc/%-doc.texi
134
	doc/texi2pod.pl $< $@
135
136
doc/%.1: doc/%.pod
137
	pod2man --section=1 --center=" " --release=" " $< > $@
138 146ea952 Nicolas Boos
139 7d6ac9a3 Måns Rullgård
install: install-progs install-libs install-headers $(INSTALL_TARGETS-yes)
140 81dcdc53 Diego Biurrun
141 a4848db6 Diego Biurrun
ifeq ($(BUILD_SHARED),yes)
142 7d2f4546 Diego Biurrun
install-progs: $(PROGS) install-libs
143 a4848db6 Diego Biurrun
else
144 7d2f4546 Diego Biurrun
install-progs: $(PROGS)
145 a4848db6 Diego Biurrun
endif
146 22a324da Diego Biurrun
	install -d "$(BINDIR)"
147
	install -c -m 755 $(PROGS) "$(BINDIR)"
148 85f07f22 Fabrice Bellard
149 7a7be126 Diego Biurrun
# Create the Windows installer.
150 d35ff76b Fabrice Bellard
wininstaller: all install
151
	makensis ffinstall.nsi
152
153 23a65308 Fabrice Bellard
install-man:
154 22a324da Diego Biurrun
	install -d "$(MANDIR)/man1"
155
	install -m 644 $(MANPAGES) "$(MANDIR)/man1"
156 23a65308 Fabrice Bellard
157 ed5614eb Diego Biurrun
install-vhook: videohook
158 22a324da Diego Biurrun
	install -d "$(SHLIBDIR)/vhook"
159
	install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
160 142fc6b9 Philip Gladstone
161 b12f8273 Diego Biurrun
install-libs:
162 8b2121e3 Måns Rullgård
	$(MAKE) -C libavutil   install-libs
163
	$(MAKE) -C libavcodec  install-libs
164
	$(MAKE) -C libavformat install-libs
165 1a9150b1 Diego Biurrun
ifeq ($(CONFIG_PP),yes)
166 6d9a2421 Diego Biurrun
	$(MAKE) -C libpostproc install-libs
167 1a9150b1 Diego Biurrun
endif
168 790c9ca7 Luca Abeni
ifeq ($(CONFIG_SWSCALER),yes)
169
	$(MAKE) -C libswscale  install-libs
170
endif
171
172 8b2121e3 Måns Rullgård
ifeq ($(BUILD_SHARED),yes)
173 1e7ffa50 Diego Biurrun
	-$(LDCONFIG)
174 b12f8273 Diego Biurrun
endif
175 37736979 Fabrice Bellard
176 f29f3b5d Diego Biurrun
install-headers:
177
	$(MAKE) -C libavutil   install-headers
178
	$(MAKE) -C libavcodec  install-headers
179
	$(MAKE) -C libavformat install-headers
180 1a9150b1 Diego Biurrun
ifeq ($(CONFIG_PP),yes)
181 6d9a2421 Diego Biurrun
	$(MAKE) -C libpostproc install-headers
182 1a9150b1 Diego Biurrun
endif
183 790c9ca7 Luca Abeni
	$(MAKE) -C libswscale  install-headers
184 f29f3b5d Diego Biurrun
185 f9edb717 Diego Biurrun
uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
186
187
uninstall-progs:
188 22a324da Diego Biurrun
	rm -f $(addprefix $(BINDIR)/, $(ALLPROGS))
189 f9edb717 Diego Biurrun
190
uninstall-man:
191 22a324da Diego Biurrun
	rm -f $(addprefix $(MANDIR)/man1/,$(ALLMANPAGES))
192 f9edb717 Diego Biurrun
193
uninstall-vhook:
194 22a324da Diego Biurrun
	rm -f $(addprefix $(SHLIBDIR)/vhook/,$(ALLHOOKS))
195
	-rmdir "$(SHLIBDIR)/vhook/"
196 f9edb717 Diego Biurrun
197
uninstall-libs:
198
	$(MAKE) -C libavutil   uninstall-libs
199
	$(MAKE) -C libavcodec  uninstall-libs
200
	$(MAKE) -C libavformat uninstall-libs
201 6d9a2421 Diego Biurrun
	$(MAKE) -C libpostproc uninstall-libs
202 f9edb717 Diego Biurrun
203
uninstall-headers:
204
	$(MAKE) -C libavutil   uninstall-headers
205
	$(MAKE) -C libavcodec  uninstall-headers
206
	$(MAKE) -C libavformat uninstall-headers
207 6d9a2421 Diego Biurrun
	$(MAKE) -C libpostproc uninstall-headers
208 22a324da Diego Biurrun
	-rmdir "$(INCDIR)"
209 f9edb717 Diego Biurrun
210 3b26ee47 Måns Rullgård
depend dep: .depend .vhookdep
211 ea0f0681 Diego Biurrun
	$(MAKE) -C libavutil   depend
212 5d22ccf7 Diego Biurrun
	$(MAKE) -C libavcodec  depend
213 c80d990f Steven M. Schultz
	$(MAKE) -C libavformat depend
214 691c480e Diego Biurrun
ifeq ($(CONFIG_PP),yes)
215
	$(MAKE) -C libpostproc depend
216
endif
217 eaa6d7b6 Diego Biurrun
ifeq ($(CONFIG_SWSCALER),yes)
218
	$(MAKE) -C libswscale  depend
219
endif
220 4b8b2edb Fabrice Bellard
221 fd071c26 Diego Biurrun
.depend: $(SRCS) version.h
222 0032cac2 Måns Rullgård
	$(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
223 3b26ee47 Måns Rullgård
224
# gcc stupidly only outputs the basename of targets
225
.vhookdep: $(ALLHOOKS_SRCS)
226
	$(CC) $(VHOOKCFLAGS) -MM $^ | sed 's,^\([a-z]\),vhook/\1,' > $@
227 57514323 Zdenek Kabelac
228 da34f7ac Måns Rullgård
$(DEP_LIBS): lib
229
230
.libs: $(DEP_LIBS)
231
	touch $@
232 cf2818b0 Zdenek Kabelac
233 98013cc1 Diego Biurrun
clean:
234 5d22ccf7 Diego Biurrun
	$(MAKE) -C libavutil   clean
235
	$(MAKE) -C libavcodec  clean
236 abac6175 Fabrice Bellard
	$(MAKE) -C libavformat clean
237 6d9a2421 Diego Biurrun
	$(MAKE) -C libpostproc clean
238 790c9ca7 Luca Abeni
	$(MAKE) -C libswscale  clean
239 b8d40825 Diego Biurrun
	rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
240 3e4134f6 Diego Biurrun
	   output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
241 e9b19db8 Diego Biurrun
	rm -f doc/*.html doc/*.pod doc/*.1
242 4fbd52f0 Diego Biurrun
	rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
243
	rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
244 ed5614eb Diego Biurrun
	rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
245 142fc6b9 Philip Gladstone
246 85f07f22 Fabrice Bellard
distclean: clean
247 98013cc1 Diego Biurrun
	$(MAKE) -C libavutil   distclean
248
	$(MAKE) -C libavcodec  distclean
249
	$(MAKE) -C libavformat distclean
250 6d9a2421 Diego Biurrun
	$(MAKE) -C libpostproc distclean
251 790c9ca7 Luca Abeni
	$(MAKE) -C libswscale  distclean
252 5c6a5d58 Diego Biurrun
	rm -f .depend version.h config.* *.pc
253 85f07f22 Fabrice Bellard
254
TAGS:
255 abac6175 Fabrice Bellard
	etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
256 57514323 Zdenek Kabelac
257 dd9ca370 Fabrice Bellard
# regression tests
258
259 4fbd52f0 Diego Biurrun
fulltest test: codectest libavtest seektest
260
261
FFMPEG_REFFILE   = $(SRC_PATH)/tests/ffmpeg.regression.ref
262
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
263
LIBAV_REFFILE    = $(SRC_PATH)/tests/libav.regression.ref
264
ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
265
SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
266
267 b13cdd33 Diego Biurrun
test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
268 4fbd52f0 Diego Biurrun
	@echo
269
	@echo "Unfortunately ffserver is broken and therefore its regression"
270
	@echo "test fails randomly. Treat the results accordingly."
271
	@echo
272
	$(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
273
274 b13cdd33 Diego Biurrun
codectest mpeg4 mpeg ac3 snow snowll: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw tests/tiny_psnr$(EXESUF)
275 4fbd52f0 Diego Biurrun
	$(SRC_PATH)/tests/regression.sh $@ $(FFMPEG_REFFILE)   tests/vsynth1
276
	$(SRC_PATH)/tests/regression.sh $@ $(ROTOZOOM_REFFILE) tests/vsynth2
277
278 b13cdd33 Diego Biurrun
libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
279 4fbd52f0 Diego Biurrun
	$(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1
280
seektest: tests/seek_test$(EXESUF)
281
	$(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
282
283
ifeq ($(CONFIG_SWSCALER),yes)
284
test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error
285
swscale_error:
286
	@echo
287
	@echo "This regression test is incompatible with --enable-swscaler."
288
	@echo
289
	@exit 1
290
endif
291
292
tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
293
	mkdir -p tests/vsynth1
294
	$(BUILD_ROOT)/$< 'tests/vsynth1/'
295
296
tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
297
	mkdir -p tests/vsynth2
298
	$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
299
300
tests/asynth1.sw: tests/audiogen$(EXESUF)
301
	$(BUILD_ROOT)/$< $@
302
303
%$(EXESUF): %.c
304
	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
305
306
tests/seek_test$(EXESUF): tests/seek_test.c
307
	$(CC) $(LDFLAGS) $(CFLAGS) -DHAVE_AV_CONFIG_H -o $@ $< $(EXTRALIBS)
308
309 dd9ca370 Fabrice Bellard
310 3263626f Diego Biurrun
.PHONY: all lib videohook documentation install* wininstaller uninstall*
311 bedb3550 Diego Biurrun
.PHONY: dep depend clean distclean TAGS
312 5e2dfd39 Diego Biurrun
.PHONY: codectest libavtest seektest test-server fulltest test
313 4fbd52f0 Diego Biurrun
.PHONY: mpeg4 mpeg ac3 snow snowll swscale-error
314 cf2818b0 Zdenek Kabelac
315 6ca0c110 Diego Biurrun
-include .depend
316 3b26ee47 Måns Rullgård
-include .vhookdep