Introduce libavdevice
[ffmpeg-lucabe.git] / Makefile
blob73c564244d7ecf7b0b0986bde35e5a3c89b1390f
2 # Main ffmpeg Makefile
3 # (c) 2000-2004 Fabrice Bellard
5 include config.mak
7 VPATH=$(SRC_PATH_BARE)
9 CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
10 -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
11 -I$(SRC_PATH)/libavdevice \
12 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H
13 LDFLAGS+= -g
15 PROGS-$(CONFIG_FFMPEG) += ffmpeg
16 PROGS-$(CONFIG_FFPLAY) += ffplay
17 PROGS-$(CONFIG_FFSERVER) += ffserver
19 PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
20 PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
21 MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
23 BASENAMES = ffmpeg ffplay ffserver
24 ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
25 ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
26 ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
28 ifeq ($(BUILD_SHARED),yes)
29 DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavdevice/$(SLIBPREF)avdevice$(SLIBSUF)
30 else
31 DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavdevice/$(LIBPREF)avdevice$(LIBSUF)
32 endif
34 ALL_TARGETS-$(CONFIG_VHOOK) += videohook
35 ALL_TARGETS-$(BUILD_DOC) += documentation
37 INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
38 ifneq ($(PROGS),)
39 INSTALL_TARGETS-yes += install-progs
40 INSTALL_TARGETS-$(BUILD_DOC) += install-man
41 endif
43 VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
45 BASEHOOKS = fish null watermark
46 ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
47 ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
49 HOOKS-$(HAVE_FORK) += ppm
50 HOOKS-$(HAVE_IMLIB2) += imlib2
51 HOOKS-$(HAVE_FREETYPE2) += drawtext
53 HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
55 VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
56 LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
58 VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
59 LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
61 VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
63 SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
64 LDFLAGS := -L$(BUILD_ROOT)/libavdevice -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
65 EXTRALIBS := -lavdevice$(BUILDSUF) -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
67 ifeq ($(CONFIG_SWSCALER),yes)
68 LDFLAGS+=-L$(BUILD_ROOT)/libswscale
69 EXTRALIBS+=-lswscale$(BUILDSUF)
70 endif
72 all: lib $(PROGS) $(ALL_TARGETS-yes)
74 lib:
75 $(MAKE) -C libavutil all
76 $(MAKE) -C libavcodec all
77 $(MAKE) -C libavformat all
78 $(MAKE) -C libavdevice all
79 ifeq ($(CONFIG_PP),yes)
80 $(MAKE) -C libpostproc all
81 endif
82 ifeq ($(CONFIG_SWSCALER),yes)
83 $(MAKE) -C libswscale all
84 endif
86 ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
87 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
89 ffserver$(EXESUF): ffserver.o cmdutils.o .libs
90 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o cmdutils.o $(EXTRALIBS)
92 ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
93 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
95 %$(EXESUF): %_g$(EXESUF)
96 cp -p $< $@
97 $(STRIP) $@
99 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
100 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
101 version.h: $(SVN_ENTRIES)
102 endif
104 version.h:
105 $(SRC_PATH)/version.sh $(SRC_PATH)
107 output_example$(EXESUF): output_example.o .libs
108 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
110 tools/qt-faststart$(EXESUF): tools/qt-faststart.c
111 $(CC) $(CFLAGS) $< -o $@
113 tools/cws2fws$(EXESUF): tools/cws2fws.c
114 $(CC) $(CFLAGS) $< -o $@ -lz
116 ffplay.o: CFLAGS += $(SDL_CFLAGS)
118 ffmpeg.o ffplay.o ffserver.o: version.h
120 videohook: .libs $(HOOKS)
122 vhook/%$(SLIBSUF): vhook/%.o
123 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
125 vhook/%.o: vhook/%.c
126 $(CC) $(VHOOKCFLAGS) -c -o $@ $<
128 %.o: %.c
129 $(CC) $(CFLAGS) -c -o $@ $<
131 documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
132 ffplay-doc.html general.html hooks.html \
133 $(ALLMANPAGES))
135 doc/%.html: doc/%.texi
136 texi2html -monolithic -number $<
137 mv $(@F) $@
139 doc/%.pod: doc/%-doc.texi
140 doc/texi2pod.pl $< $@
142 doc/%.1: doc/%.pod
143 pod2man --section=1 --center=" " --release=" " $< > $@
145 install: install-libs install-headers $(INSTALL_TARGETS-yes)
147 ifeq ($(BUILD_SHARED),yes)
148 install-progs: install-libs
149 endif
150 install-progs: $(PROGS)
151 install -d "$(BINDIR)"
152 install -c -m 755 $(PROGS) "$(BINDIR)"
154 # Create the Windows installer.
155 wininstaller: all install
156 makensis ffinstall.nsi
158 install-man:
159 install -d "$(MANDIR)/man1"
160 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
162 install-vhook: videohook
163 install -d "$(SHLIBDIR)/vhook"
164 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
166 install-libs:
167 $(MAKE) -C libavutil install-libs
168 $(MAKE) -C libavcodec install-libs
169 $(MAKE) -C libavformat install-libs
170 $(MAKE) -C libavdevice install-libs
171 ifeq ($(CONFIG_PP),yes)
172 $(MAKE) -C libpostproc install-libs
173 endif
174 ifeq ($(CONFIG_SWSCALER),yes)
175 $(MAKE) -C libswscale install-libs
176 endif
178 ifeq ($(BUILD_SHARED),yes)
179 -$(LDCONFIG)
180 endif
182 install-headers:
183 $(MAKE) -C libavutil install-headers
184 $(MAKE) -C libavcodec install-headers
185 $(MAKE) -C libavformat install-headers
186 $(MAKE) -C libavdevice install-headers
187 ifeq ($(CONFIG_PP),yes)
188 $(MAKE) -C libpostproc install-headers
189 endif
190 $(MAKE) -C libswscale install-headers
192 uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
194 uninstall-progs:
195 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
197 uninstall-man:
198 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
200 uninstall-vhook:
201 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
202 -rmdir "$(SHLIBDIR)/vhook/"
204 uninstall-libs:
205 $(MAKE) -C libavutil uninstall-libs
206 $(MAKE) -C libavcodec uninstall-libs
207 $(MAKE) -C libavformat uninstall-libs
208 $(MAKE) -C libavdevice uninstall-libs
209 $(MAKE) -C libpostproc uninstall-libs
210 $(MAKE) -C libswscale uninstall-libs
212 uninstall-headers:
213 $(MAKE) -C libavutil uninstall-headers
214 $(MAKE) -C libavcodec uninstall-headers
215 $(MAKE) -C libavformat uninstall-headers
216 $(MAKE) -C libavdevice uninstall-headers
217 $(MAKE) -C libpostproc uninstall-headers
218 $(MAKE) -C libswscale uninstall-headers
219 -rmdir "$(INCDIR)"
221 depend dep: .depend .vhookdep
222 $(MAKE) -C libavutil depend
223 $(MAKE) -C libavcodec depend
224 $(MAKE) -C libavformat depend
225 $(MAKE) -C libavdevice depend
226 ifeq ($(CONFIG_PP),yes)
227 $(MAKE) -C libpostproc depend
228 endif
229 ifeq ($(CONFIG_SWSCALER),yes)
230 $(MAKE) -C libswscale depend
231 endif
233 .depend: $(SRCS) version.h
234 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
236 # gcc stupidly only outputs the basename of targets with -MM
237 .vhookdep: $(ALLHOOKS_SRCS)
238 $(CC) $(VHOOKCFLAGS) -MM $^ | sed 's,^\([a-z]\),vhook/\1,' > $@
240 $(DEP_LIBS): lib
242 .libs: $(DEP_LIBS)
243 touch $@
245 clean:
246 $(MAKE) -C libavutil clean
247 $(MAKE) -C libavcodec clean
248 $(MAKE) -C libavformat clean
249 $(MAKE) -C libavdevice clean
250 $(MAKE) -C libpostproc clean
251 $(MAKE) -C libswscale clean
252 rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
253 output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
254 rm -f doc/*.html doc/*.pod doc/*.1
255 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
256 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
257 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
259 distclean: clean
260 $(MAKE) -C libavutil distclean
261 $(MAKE) -C libavcodec distclean
262 $(MAKE) -C libavformat distclean
263 $(MAKE) -C libavdevice distclean
264 $(MAKE) -C libpostproc distclean
265 $(MAKE) -C libswscale distclean
266 rm -f .depend .vhookdep version.h config.* *.pc
268 TAGS:
269 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
271 # regression tests
273 fulltest test: codectest libavtest seektest
275 FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
276 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
277 LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
278 ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
279 SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
281 test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
282 @echo
283 @echo "Unfortunately ffserver is broken and therefore its regression"
284 @echo "test fails randomly. Treat the results accordingly."
285 @echo
286 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
288 codectest mpeg4 mpeg ac3 snow snowll: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw tests/tiny_psnr$(EXESUF)
289 $(SRC_PATH)/tests/regression.sh $@ $(FFMPEG_REFFILE) tests/vsynth1
290 $(SRC_PATH)/tests/regression.sh $@ $(ROTOZOOM_REFFILE) tests/vsynth2
292 libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
293 $(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1
295 seektest: tests/seek_test$(EXESUF)
296 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
298 ifeq ($(CONFIG_SWSCALER),yes)
299 test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error
300 swscale_error:
301 @echo
302 @echo "This regression test is incompatible with --enable-swscaler."
303 @echo
304 @exit 1
305 endif
307 tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
308 mkdir -p tests/vsynth1
309 $(BUILD_ROOT)/$< 'tests/vsynth1/'
311 tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
312 mkdir -p tests/vsynth2
313 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
315 tests/asynth1.sw: tests/audiogen$(EXESUF)
316 $(BUILD_ROOT)/$< $@
318 %$(EXESUF): %.c
319 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
321 tests/seek_test$(EXESUF): tests/seek_test.c .libs
322 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(EXTRALIBS)
325 .PHONY: all lib videohook documentation install* wininstaller uninstall*
326 .PHONY: dep depend clean distclean TAGS
327 .PHONY: codectest libavtest seektest test-server fulltest test
328 .PHONY: mpeg4 mpeg ac3 snow snowll swscale-error
330 -include .depend
331 -include .vhookdep