Remove unneded headers
[libav.git] / Makefile
1 #
2 # Main ffmpeg Makefile
3 # (c) 2000-2004 Fabrice Bellard
4 #
5 include config.mak
6
7 VPATH=$(SRC_PATH_BARE)
8
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
14
15 PROGS-$(CONFIG_FFMPEG) += ffmpeg
16 PROGS-$(CONFIG_FFPLAY) += ffplay
17 PROGS-$(CONFIG_FFSERVER) += ffserver
18
19 PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
20 PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
21 MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
22
23 BASENAMES = ffmpeg ffplay ffserver
24 ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
25 ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
26 ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
27
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
33
34 ALL_TARGETS-$(CONFIG_VHOOK) += videohook
35 ALL_TARGETS-$(BUILD_DOC) += documentation
36
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
42
43 VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
44
45 BASEHOOKS = fish null watermark
46 ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
47 ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
48
49 HOOKS-$(HAVE_FORK) += ppm
50 HOOKS-$(HAVE_IMLIB2) += imlib2
51 HOOKS-$(HAVE_FREETYPE2) += drawtext
52
53 HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
54
55 VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
56 LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
57
58 VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
59 LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
60
61 VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
62
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)
66
67 ifeq ($(CONFIG_SWSCALER),yes)
68 LDFLAGS+=-L$(BUILD_ROOT)/libswscale
69 EXTRALIBS+=-lswscale$(BUILDSUF)
70 endif
71
72 MAKE-yes = $(MAKE)
73 MAKE- = : $(MAKE)
74
75 all: lib $(PROGS) $(ALL_TARGETS-yes)
76
77 lib:
78 $(MAKE) -C libavutil all
79 $(MAKE) -C libavcodec all
80 $(MAKE) -C libavformat all
81 $(MAKE) -C libavdevice all
82 $(MAKE-$(CONFIG_PP)) -C libpostproc all
83 $(MAKE-$(CONFIG_SWSCALER)) -C libswscale all
84
85 ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
86 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
87
88 ffserver$(EXESUF): ffserver.o cmdutils.o .libs
89 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o cmdutils.o $(EXTRALIBS)
90
91 ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
92 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
93
94 %$(EXESUF): %_g$(EXESUF)
95 cp -p $< $@
96 $(STRIP) $@
97
98 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
99 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
100 version.h: $(SVN_ENTRIES)
101 endif
102
103 version.h:
104 $(SRC_PATH)/version.sh $(SRC_PATH)
105
106 output_example$(EXESUF): output_example.o .libs
107 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
108
109 tools/%$(EXESUF): tools/%.c
110 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
111
112 ffplay.o: CFLAGS += $(SDL_CFLAGS)
113
114 ffmpeg.o ffplay.o ffserver.o: version.h
115
116 videohook: .libs $(HOOKS)
117
118 vhook/%$(SLIBSUF): vhook/%.o
119 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
120
121 vhook/%.o: vhook/%.c
122 $(CC) $(VHOOKCFLAGS) -c -o $@ $<
123
124 %.o: %.c
125 $(CC) $(CFLAGS) -c -o $@ $<
126
127 documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
128 ffplay-doc.html general.html hooks.html \
129 $(ALLMANPAGES))
130
131 doc/%.html: doc/%.texi
132 texi2html -monolithic -number $<
133 mv $(@F) $@
134
135 doc/%.pod: doc/%-doc.texi
136 doc/texi2pod.pl $< $@
137
138 doc/%.1: doc/%.pod
139 pod2man --section=1 --center=" " --release=" " $< > $@
140
141 install: install-libs install-headers $(INSTALL_TARGETS-yes)
142
143 ifeq ($(BUILD_SHARED),yes)
144 install-progs: install-libs
145 endif
146 install-progs: $(PROGS)
147 install -d "$(BINDIR)"
148 install -c -m 755 $(PROGS) "$(BINDIR)"
149
150 # Create the Windows installer.
151 wininstaller: all install
152 makensis ffinstall.nsi
153
154 install-man:
155 install -d "$(MANDIR)/man1"
156 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
157
158 install-vhook: videohook
159 install -d "$(SHLIBDIR)/vhook"
160 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
161
162 install-libs:
163 $(MAKE) -C libavutil install-libs
164 $(MAKE) -C libavcodec install-libs
165 $(MAKE) -C libavformat install-libs
166 $(MAKE) -C libavdevice install-libs
167 $(MAKE-$(CONFIG_PP)) -C libpostproc install-libs
168 $(MAKE-$(CONFIG_SWSCALER)) -C libswscale install-libs
169 ifeq ($(BUILD_SHARED),yes)
170 -$(LDCONFIG)
171 endif
172
173 install-headers:
174 $(MAKE) -C libavutil install-headers
175 $(MAKE) -C libavcodec install-headers
176 $(MAKE) -C libavformat install-headers
177 $(MAKE) -C libavdevice install-headers
178 $(MAKE-$(CONFIG_PP)) -C libpostproc install-headers
179 $(MAKE) -C libswscale install-headers
180
181 uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
182
183 uninstall-progs:
184 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
185
186 uninstall-man:
187 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
188
189 uninstall-vhook:
190 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
191 -rmdir "$(SHLIBDIR)/vhook/"
192
193 uninstall-libs:
194 $(MAKE) -C libavutil uninstall-libs
195 $(MAKE) -C libavcodec uninstall-libs
196 $(MAKE) -C libavformat uninstall-libs
197 $(MAKE) -C libavdevice uninstall-libs
198 $(MAKE) -C libpostproc uninstall-libs
199 $(MAKE) -C libswscale uninstall-libs
200
201 uninstall-headers:
202 $(MAKE) -C libavutil uninstall-headers
203 $(MAKE) -C libavcodec uninstall-headers
204 $(MAKE) -C libavformat uninstall-headers
205 $(MAKE) -C libavdevice uninstall-headers
206 $(MAKE) -C libpostproc uninstall-headers
207 $(MAKE) -C libswscale uninstall-headers
208 -rmdir "$(INCDIR)"
209
210 depend dep: .depend .vhookdep
211 $(MAKE) -C libavutil depend
212 $(MAKE) -C libavcodec depend
213 $(MAKE) -C libavformat depend
214 $(MAKE) -C libavdevice depend
215 $(MAKE-$(CONFIG_PP)) -C libpostproc depend
216 $(MAKE-$(CONFIG_SWSCALER)) -C libswscale depend
217
218 .depend: $(SRCS) version.h
219 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
220
221 # gcc stupidly only outputs the basename of targets with -MM
222 .vhookdep: $(ALLHOOKS_SRCS) version.h
223 $(CC) $(VHOOKCFLAGS) -MM $^ | sed 's,^\([a-z]\),vhook/\1,' > $@
224
225 $(DEP_LIBS): lib
226
227 .libs: $(DEP_LIBS)
228 touch $@
229
230 clean:
231 $(MAKE) -C libavutil clean
232 $(MAKE) -C libavcodec clean
233 $(MAKE) -C libavformat clean
234 $(MAKE) -C libavdevice clean
235 $(MAKE) -C libpostproc clean
236 $(MAKE) -C libswscale clean
237 rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
238 output_example$(EXESUF)
239 rm -f doc/*.html doc/*.pod doc/*.1
240 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
241 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
242 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
243 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
244
245 distclean: clean
246 $(MAKE) -C libavutil distclean
247 $(MAKE) -C libavcodec distclean
248 $(MAKE) -C libavformat distclean
249 $(MAKE) -C libavdevice distclean
250 $(MAKE) -C libpostproc distclean
251 $(MAKE) -C libswscale distclean
252 rm -f .depend .vhookdep version.h config.* *.pc
253
254 TAGS:
255 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
256
257 # regression tests
258
259 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 CODEC_TESTS = $(addprefix regtest-, \
268 mpeg \
269 mpeg2 \
270 mpeg2thread \
271 msmpeg4v2 \
272 msmpeg4 \
273 wmv1 \
274 wmv2 \
275 h261 \
276 h263 \
277 h263p \
278 mpeg4 \
279 huffyuv \
280 rc \
281 mpeg4adv \
282 mpeg4thread \
283 mp4psp \
284 error \
285 mpeg4nr \
286 mpeg1b \
287 mjpeg \
288 ljpeg \
289 jpegls \
290 rv10 \
291 rv20 \
292 asv1 \
293 asv2 \
294 flv \
295 ffv1 \
296 snow \
297 snowll \
298 dv \
299 dv50 \
300 svq1 \
301 flashsv \
302 mp2 \
303 ac3 \
304 g726 \
305 adpcm_ima_wav \
306 adpcm_ms \
307 adpcm_yam \
308 adpcm_swf \
309 flac \
310 wma \
311 )
312
313 LAVF_TESTS = $(addprefix regtest-, \
314 avi \
315 asf \
316 rm \
317 mpg \
318 ts \
319 swf \
320 ffm \
321 flv_fmt \
322 mov \
323 dv_fmt \
324 gxf \
325 nut \
326 mkv \
327 pbmpipe \
328 pgmpipe \
329 ppmpipe \
330 gif \
331 yuv4mpeg \
332 pgm \
333 ppm \
334 bmp \
335 tga \
336 tiff \
337 sgi \
338 jpg \
339 wav \
340 alaw \
341 mulaw \
342 au \
343 mmf \
344 aiff \
345 voc \
346 ogg \
347 pixfmt \
348 )
349
350 REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
351
352 CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
353 CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
354
355 LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
356
357 LAVF_REG = tests/data/lavf.regression
358 ROTOZOOM_REG = tests/data/rotozoom.regression
359 VSYNTH_REG = tests/data/vsynth.regression
360
361 codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
362 diff -u $(FFMPEG_REFFILE) $(VSYNTH_REG)
363 diff -u $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
364
365 libavtest: $(LAVF_REG)
366 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
367
368 $(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
369 cat $^ > $@
370
371 $(LAVF_REG): $(LAVF_REGFILES)
372 $(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
373 $(VSYNTH_REG): $(CODEC_VSYNTH)
374
375 $(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
376
377 $(LAVF_REGFILES): $(LAVF_TESTS)
378
379 $(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
380
381 regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
382
383 $(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
384 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a
385 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a
386
387 $(LAVF_TESTS):
388 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b
389
390 seektest: codectest libavtest tests/seek_test$(EXESUF)
391 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
392
393 test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
394 @echo
395 @echo "Unfortunately ffserver is broken and therefore its regression"
396 @echo "test fails randomly. Treat the results accordingly."
397 @echo
398 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
399
400 ifeq ($(CONFIG_SWSCALER),yes)
401 test-server codectest $(CODEC_TESTS) libavtest: swscale_error
402 swscale_error:
403 @echo
404 @echo "This regression test is incompatible with --enable-swscaler."
405 @echo
406 @exit 1
407 endif
408
409 tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
410 mkdir -p tests/vsynth1
411 $(BUILD_ROOT)/$< 'tests/vsynth1/'
412
413 tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
414 mkdir -p tests/vsynth2
415 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
416
417 tests/asynth1.sw: tests/audiogen$(EXESUF)
418 $(BUILD_ROOT)/$< $@
419
420 %$(EXESUF): %.c
421 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
422
423 tests/seek_test$(EXESUF): tests/seek_test.c .libs
424 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(EXTRALIBS)
425
426
427 .PHONY: all lib videohook documentation install* wininstaller uninstall*
428 .PHONY: dep depend clean distclean TAGS
429 .PHONY: codectest libavtest seektest test-server fulltest test
430 .PHONY: $(CODEC_TESTS) $(LAVF_TESTS) regtest-ref swscale-error
431
432 -include .depend
433 -include .vhookdep