3 SRC_DIR = $(SRC_PATH_BARE)
5 vpath %.texi $(SRC_PATH_BARE)
7 PROGS-$(CONFIG_FFMPEG) += ffmpeg
8 PROGS-$(CONFIG_FFPLAY) += ffplay
9 PROGS-$(CONFIG_FFPROBE) += ffprobe
10 PROGS-$(CONFIG_FFSERVER) += ffserver
12 PROGS := $(PROGS-yes:%=%$(EXESUF))
13 PROGS_G = $(PROGS-yes:%=%_g$(EXESUF))
14 OBJS = $(PROGS-yes:%=%.o) cmdutils.o
15 MANPAGES = $(PROGS-yes:%=doc/%.1)
16 PODPAGES = $(PROGS-yes:%=doc/%.pod)
17 HTMLPAGES = $(PROGS-yes:%=doc/%.html)
18 TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
19 TESTPROGS = audiogen videogen rotozoom tiny_psnr base64
20 HOSTPROGS := $(TESTPROGS:%=tests/%)
22 BASENAMES = ffmpeg ffplay ffprobe ffserver
23 ALLPROGS = $(BASENAMES:%=%$(EXESUF))
24 ALLPROGS_G = $(BASENAMES:%=_g$(EXESUF))
25 ALLMANPAGES = $(BASENAMES:%=%.1)
26 ALLHTMLPAGES= $(BASENAMES:%=%.html)
28 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
29 FFLIBS-$(CONFIG_AVFILTER) += avfilter
30 FFLIBS-$(CONFIG_AVFORMAT) += avformat
31 FFLIBS-$(CONFIG_AVCODEC) += avcodec
32 FFLIBS-$(CONFIG_POSTPROC) += postproc
33 FFLIBS-$(CONFIG_SWSCALE) += swscale
34 FFLIBS-$(CONFIG_AVCORE) += avcore
38 DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
40 SKIPHEADERS = cmdutils_common_opts.h
44 FF_LDFLAGS := $(FFLDFLAGS)
45 FF_EXTRALIBS := $(FFEXTRALIBS)
46 FF_DEP_LIBS := $(DEP_LIBS)
48 ALL_TARGETS-$(CONFIG_DOC) += documentation
51 INSTALL_TARGETS-yes += install-progs install-data
52 INSTALL_TARGETS-$(CONFIG_DOC) += install-man
54 INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
56 all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
58 $(PROGS): %$(EXESUF): %_g$(EXESUF)
63 .config: $(wildcard $(FFLIBS:%=$(SRC_DIR)/lib%/all*.c))
64 @-tput bold 2>/dev/null
65 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
66 @-tput sgr0 2>/dev/null
68 SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
69 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
70 HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS
78 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
83 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
85 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
86 ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
88 %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
89 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
91 tools/%$(EXESUF): tools/%.o
92 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
95 $(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
97 ffplay.o: CFLAGS += $(SDL_CFLAGS)
99 VERSION_SH = $(SRC_PATH_BARE)/version.sh
100 GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD
101 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
103 .version: $(wildcard $(GIT_LOG) $(SVN_ENTRIES)) $(VERSION_SH) config.mak
107 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
110 # force version.sh to run whenever version might have changed
115 documentation: $(addprefix doc/, developer.html faq.html general.html libavfilter.html \
116 $(ALLHTMLPAGES) $(ALLMANPAGES))
118 $(HTMLPAGES) $(PODPAGES): doc/fftools-common-opts.texi
120 doc/ffmpeg.pod doc/ffmpeg.html: doc/demuxers.texi doc/bitstream_filters.texi doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi doc/metadata.texi
121 doc/ffplay.pod doc/ffplay.html: doc/demuxers.texi doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi
122 doc/ffprobe.pod doc/ffprobe.html: doc/demuxers.texi doc/indevs.texi doc/protocols.texi
123 doc/libavfilter.html: doc/filters.texi
125 doc/%.html: TAG = HTML
126 doc/%.html: doc/%.texi
127 $(M)cd doc && texi2html -monolithic -number $(<:doc/%=%)
130 doc/%.pod: doc/%.texi
131 $(M)doc/texi2pod.pl $< $@
135 $(M)pod2man --section=1 --center=" " --release=" " $< > $@
137 install: $(INSTALL_TARGETS-yes)
139 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
140 $(Q)mkdir -p "$(BINDIR)"
141 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
143 install-data: $(DATA_FILES)
144 $(Q)mkdir -p "$(DATADIR)"
145 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
147 install-man: $(MANPAGES)
148 $(Q)mkdir -p "$(MANDIR)/man1"
149 $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
151 uninstall: uninstall-progs uninstall-data uninstall-man
154 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
157 $(RM) -r "$(DATADIR)"
160 $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
163 $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
164 $(RM) $(addprefix tests/,$(CLEANSUFFIXES))
165 $(RM) tests/seek_test$(EXESUF) tests/seek_test.o
166 $(RM) $(TESTPROGS:%=tests/%$(HOSTEXESUF))
169 $(RM) $(ALLPROGS) $(ALLPROGS_G)
170 $(RM) $(CLEANSUFFIXES)
171 $(RM) doc/*.html doc/*.pod doc/*.1
175 $(RM) $(DISTCLEANSUFFIXES)
176 $(RM) version.h config.* libavutil/avconfig.h
179 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
183 check: test checkheaders
185 fulltest test: codectest lavftest lavfitest seektest
187 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
188 SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
190 codectest: fate-codec
192 lavfitest: fate-lavfi
195 AREF = tests/data/acodec.ref.wav
196 VREF = tests/data/vsynth1.ref.yuv
197 REFS = $(AREF) $(VREF)
201 $(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
202 $(M)$(SRC_PATH)/tests/codec-regression.sh vref vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
203 $(Q)$(SRC_PATH)/tests/codec-regression.sh vref vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
205 $(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
206 $(M)$(SRC_PATH)/tests/codec-regression.sh aref acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
208 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
210 @echo "Unfortunately ffserver is broken and therefore its regression"
211 @echo "test fails randomly. Treat the results accordingly."
213 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
215 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
216 @mkdir -p tests/vsynth1
217 $(M)$(BUILD_ROOT)/$< 'tests/vsynth1/'
219 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
220 @mkdir -p tests/vsynth2
221 $(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
223 tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
225 $(M)$(BUILD_ROOT)/$< $@
227 tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
229 tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
230 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
232 tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS)
233 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
235 include $(SRC_PATH_BARE)/tests/fate.mak
236 include $(SRC_PATH_BARE)/tests/fate2.mak
238 include $(SRC_PATH_BARE)/tests/fate/aac.mak
239 include $(SRC_PATH_BARE)/tests/fate/als.mak
240 include $(SRC_PATH_BARE)/tests/fate/fft.mak
241 include $(SRC_PATH_BARE)/tests/fate/h264.mak
242 include $(SRC_PATH_BARE)/tests/fate/mp3.mak
243 include $(SRC_PATH_BARE)/tests/fate/vorbis.mak
244 include $(SRC_PATH_BARE)/tests/fate/vp8.mak
246 FATE_ACODEC = $(ACODEC_TESTS:%=fate-acodec-%)
247 FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%)
248 FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%)
249 FATE_VCODEC = $(FATE_VSYNTH1) $(FATE_VSYNTH2)
250 FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%)
251 FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%)
252 FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%)
254 FATE = $(FATE_ACODEC) \
260 $(FATE_ACODEC): $(AREF)
261 $(FATE_VCODEC): $(VREF)
262 $(FATE_LAVF): $(REFS)
263 $(FATE_LAVFI): $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
264 $(FATE_SEEK): fate-codec fate-lavf tests/seek_test$(EXESUF)
266 $(FATE_ACODEC): CMD = codectest acodec
267 $(FATE_VSYNTH1): CMD = codectest vsynth1
268 $(FATE_VSYNTH2): CMD = codectest vsynth2
269 $(FATE_LAVF): CMD = lavftest
270 $(FATE_LAVFI): CMD = lavfitest
271 $(FATE_SEEK): CMD = seektest
273 fate-codec: fate-acodec fate-vcodec
274 fate-acodec: $(FATE_ACODEC)
275 fate-vcodec: $(FATE_VCODEC)
276 fate-lavf: $(FATE_LAVF)
277 fate-lavfi: $(FATE_LAVFI)
278 fate-seek: $(FATE_SEEK)
281 FATE += $(FATE_TESTS)
284 @echo "SAMPLES not specified, cannot run FATE"
287 FATE_UTILS = base64 tiny_psnr
291 $(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
292 @echo "TEST $(@:fate-%=%)"
293 $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)'
296 @printf '%s\n' $(sort $(FATE))
298 .PHONY: documentation *test regtest-* alltools check config