Make the install-man target depend on $(MANPAGES).
[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
a426bbfc
MR
7SRC_DIR = $(SRC_PATH_BARE)
8
de2f77d8 9vpath %.texi $(SRC_PATH_BARE)
dd9ca370 10
0cb8579a
MR
11PROGS-$(CONFIG_FFMPEG) += ffmpeg
12PROGS-$(CONFIG_FFPLAY) += ffplay
13PROGS-$(CONFIG_FFSERVER) += ffserver
01310af2 14
bb8fe69a
DB
15PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
16PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
916dafd5 17PROGS_SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
bb8fe69a 18MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
85f07f22 19
bb8fe69a
DB
20BASENAMES = ffmpeg ffplay ffserver
21ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
22ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
23ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
6b991cb2 24
b8fcb619
MR
25FFLIBS-$(CONFIG_AVFILTER) += avfilter
26FFLIBS-$(CONFIG_POSTPROC) += postproc
27FFLIBS-$(CONFIG_SWSCALE) += swscale
43527e3e 28
b8fcb619 29FFLIBS := avdevice avformat avcodec avutil
f02be79d 30
71c61f62
MR
31include common.mak
32
33FF_LDFLAGS := $(FFLDFLAGS)
34FF_EXTRALIBS := $(FFEXTRALIBS)
35
36S := $(BUILD_SHARED:yes=S)
37DEP_LIBS := $(foreach L,$(FFLIBS),lib$(L)/$($(S)LIBPREF)$(L)$($(S)LIBSUF))
38
7d6ac9a3
MR
39ALL_TARGETS-$(CONFIG_VHOOK) += videohook
40ALL_TARGETS-$(BUILD_DOC) += documentation
41
42INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
1217916b
DB
43ifneq ($(PROGS),)
44INSTALL_TARGETS-yes += install-progs
282db5fd 45INSTALL_TARGETS-$(BUILD_DOC) += install-man
1217916b 46endif
dfd10838 47INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
dd9f3d97 48
71c61f62 49all: $(DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
27217159 50
473a88ca 51$(PROGS): %$(EXESUF): %_g$(EXESUF)
27217159
DB
52 cp -p $< $@
53 $(STRIP) $@
54
7716f7ff
DB
55.depend: version.h $(PROGS_SRCS)
56
71c61f62 57SUBDIR_VARS := OBJS ASM_OBJS CPP_OBJS FFLIBS CLEANFILES
9bcc2883 58
71c61f62
MR
59define RESET
60$(1) :=
61$(1)-yes :=
62endef
7716f7ff 63
71c61f62
MR
64define DOSUBDIR
65$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
66SUBDIR := $(1)/
67include $(1)/Makefile
68endef
69
70$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
b8fcb619 71
3b26ee47 72VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
dd9f3d97
MR
73
74BASEHOOKS = fish null watermark
75ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
76ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
77
78HOOKS-$(HAVE_FORK) += ppm
79HOOKS-$(HAVE_IMLIB2) += imlib2
80HOOKS-$(HAVE_FREETYPE2) += drawtext
81
82HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
83
84VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
cbefadbd 85LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
dd9f3d97
MR
86
87VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
cbefadbd 88LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
dd9f3d97
MR
89
90VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
142fc6b9 91
82e8566a
MR
92vhook/%.o: CFLAGS:=$(VHOOKCFLAGS)
93
71c61f62
MR
94ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
95ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
85f07f22 96
71c61f62
MR
97%_g$(EXESUF): %.o cmdutils.o $(DEP_LIBS)
98 $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
01310af2 99
a4da50e1
MR
100SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
101ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
102version.h: $(SVN_ENTRIES)
103endif
104
f1cc88a5 105version.h:
997baf01 106 $(SRC_PATH)/version.sh $(SRC_PATH)
f1cc88a5 107
71c61f62
MR
108output_example$(EXESUF): output_example.o $(DEP_LIBS)
109 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
8de65d4f 110
1521c500 111tools/%$(EXESUF): tools/%.c
71c61f62 112 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
6da7cc81 113
3c889b5c 114ffplay.o .depend: CFLAGS += $(SDL_CFLAGS)
2744a37f 115
496cfa3c
MR
116ffmpeg.o ffplay.o ffserver.o: version.h
117
bab785a5 118# vhooks compile fine without libav*, but need them nonetheless.
71c61f62 119videohook: $(DEP_LIBS) $(HOOKS)
ed5614eb
DB
120
121vhook/%$(SLIBSUF): vhook/%.o
3b26ee47 122 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
ed5614eb 123
e9b19db8 124documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
d0e1cd3d
DB
125 ffplay-doc.html general.html hooks.html \
126 $(ALLMANPAGES))
e9b19db8
DB
127
128doc/%.html: doc/%.texi
129 texi2html -monolithic -number $<
130 mv $(@F) $@
131
132doc/%.pod: doc/%-doc.texi
133 doc/texi2pod.pl $< $@
134
135doc/%.1: doc/%.pod
136 pod2man --section=1 --center=" " --release=" " $< > $@
146ea952 137
a7319cc2
DB
138install: $(INSTALL_TARGETS-yes)
139
c1ac39b3 140install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
22a324da
DB
141 install -d "$(BINDIR)"
142 install -c -m 755 $(PROGS) "$(BINDIR)"
85f07f22 143
d05e360c 144install-man: $(MANPAGES)
22a324da
DB
145 install -d "$(MANDIR)/man1"
146 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
23a65308 147
ed5614eb 148install-vhook: videohook
22a324da
DB
149 install -d "$(SHLIBDIR)/vhook"
150 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
142fc6b9 151
7716f7ff 152uninstall: uninstall-progs uninstall-man uninstall-vhook
f9edb717 153
f9edb717 154uninstall-progs:
1c2211bd 155 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
f9edb717 156
f9edb717 157uninstall-man:
1c2211bd 158 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
f9edb717
DB
159
160uninstall-vhook:
1c2211bd 161 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
22a324da 162 -rmdir "$(SHLIBDIR)/vhook/"
f9edb717 163
7716f7ff 164depend dep: .vhookdep
4b8b2edb 165
fc900b7b 166.vhookdep: $(ALLHOOKS_SRCS) version.h
315c741d 167 $(VHOOK_DEPEND_CMD) > $@
57514323 168
7716f7ff 169clean::
71c61f62 170 rm -f gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
2b258bba 171 output_example$(EXESUF)
e9b19db8 172 rm -f doc/*.html doc/*.pod doc/*.1
4fbd52f0
DB
173 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
174 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
2b258bba 175 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
ed5614eb 176 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
142fc6b9 177
7716f7ff 178distclean::
7716f7ff 179 rm -f .vhookdep version.h config.* *.pc
85f07f22 180
dd9ca370
FB
181# regression tests
182
4fbd52f0 183fulltest test: codectest libavtest seektest
4fbd52f0
DB
184
185FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
186FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
187LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
188ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
189SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
190
4383ed5c
MR
191CODEC_TESTS = $(addprefix regtest-, \
192 mpeg \
193 mpeg2 \
194 mpeg2thread \
195 msmpeg4v2 \
196 msmpeg4 \
197 wmv1 \
198 wmv2 \
199 h261 \
200 h263 \
201 h263p \
202 mpeg4 \
203 huffyuv \
204 rc \
205 mpeg4adv \
206 mpeg4thread \
4383ed5c
MR
207 error \
208 mpeg4nr \
209 mpeg1b \
210 mjpeg \
211 ljpeg \
212 jpegls \
213 rv10 \
214 rv20 \
215 asv1 \
216 asv2 \
217 flv \
218 ffv1 \
219 snow \
220 snowll \
221 dv \
222 dv50 \
223 svq1 \
224 flashsv \
225 mp2 \
226 ac3 \
227 g726 \
228 adpcm_ima_wav \
9dc92a38 229 adpcm_ima_qt \
4383ed5c
MR
230 adpcm_ms \
231 adpcm_yam \
232 adpcm_swf \
233 flac \
234 wma \
235 )
236
2009721d
MR
237LAVF_TESTS = $(addprefix regtest-, \
238 avi \
239 asf \
240 rm \
241 mpg \
242 ts \
243 swf \
244 ffm \
245 flv_fmt \
246 mov \
247 dv_fmt \
248 gxf \
249 nut \
250 mkv \
251 pbmpipe \
252 pgmpipe \
253 ppmpipe \
254 gif \
255 yuv4mpeg \
256 pgm \
257 ppm \
258 bmp \
259 tga \
260 tiff \
261 sgi \
262 jpg \
263 wav \
264 alaw \
265 mulaw \
266 au \
267 mmf \
268 aiff \
269 voc \
270 ogg \
271 pixfmt \
272 )
4383ed5c
MR
273
274REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
275
276CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
277CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
278
279LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
280
281LAVF_REG = tests/data/lavf.regression
282ROTOZOOM_REG = tests/data/rotozoom.regression
283VSYNTH_REG = tests/data/vsynth.regression
284
285codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
4411cb11
MR
286 diff -u -w $(FFMPEG_REFFILE) $(VSYNTH_REG)
287 diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
4383ed5c
MR
288
289libavtest: $(LAVF_REG)
290 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
291
292$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
293 cat $^ > $@
294
295$(LAVF_REG): $(LAVF_REGFILES)
296$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
297$(VSYNTH_REG): $(CODEC_VSYNTH)
298
299$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
300
301$(LAVF_REGFILES): $(LAVF_TESTS)
302
303$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
304
305regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
306
307$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
2009721d
MR
308 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a
309 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a
4383ed5c
MR
310
311$(LAVF_TESTS):
2009721d 312 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b
4383ed5c
MR
313
314seektest: codectest libavtest tests/seek_test$(EXESUF)
315 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
316
b13cdd33 317test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0
DB
318 @echo
319 @echo "Unfortunately ffserver is broken and therefore its regression"
320 @echo "test fails randomly. Treat the results accordingly."
321 @echo
322 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
323
13ca50f3 324ifeq ($(CONFIG_SWSCALE),yes)
4383ed5c 325test-server codectest $(CODEC_TESTS) libavtest: swscale_error
4fbd52f0
DB
326swscale_error:
327 @echo
13ca50f3 328 @echo "This regression test is incompatible with --enable-swscale."
4fbd52f0
DB
329 @echo
330 @exit 1
331endif
332
333tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
334 mkdir -p tests/vsynth1
335 $(BUILD_ROOT)/$< 'tests/vsynth1/'
336
337tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
338 mkdir -p tests/vsynth2
339 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
340
341tests/asynth1.sw: tests/audiogen$(EXESUF)
342 $(BUILD_ROOT)/$< $@
343
344%$(EXESUF): %.c
71c61f62 345 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $<
4fbd52f0 346
71c61f62
MR
347tests/seek_test$(EXESUF): tests/seek_test.c $(DEP_LIBS)
348 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
4fbd52f0 349
dd9ca370 350
7716f7ff 351.PHONY: lib videohook documentation TAGS
5e2dfd39 352.PHONY: codectest libavtest seektest test-server fulltest test
4383ed5c 353.PHONY: $(CODEC_TESTS) $(LAVF_TESTS) regtest-ref swscale-error
cf2818b0 354
3b26ee47 355-include .vhookdep