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