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_FFSERVER) += ffserver
11 PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
12 PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
13 OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
14 MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
16 BASENAMES = ffmpeg ffplay ffserver
17 ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
18 ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
19 ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
21 FFLIBS-$(CONFIG_AVFILTER) += avfilter
22 FFLIBS-$(CONFIG_POSTPROC) += postproc
24 FFLIBS := avdevice avformat avcodec avutil swscale
26 DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
28 EXAMPLES = output_example$(EXESUF)
32 FF_LDFLAGS := $(FFLDFLAGS)
33 FF_EXTRALIBS := $(FFEXTRALIBS)
34 FF_DEP_LIBS := $(DEP_LIBS)
36 ALL_TARGETS-$(BUILD_DOC) += documentation
39 INSTALL_TARGETS-yes += install-progs install-data
40 INSTALL_TARGETS-$(BUILD_DOC) += install-man
42 INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
44 all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
46 $(PROGS): %$(EXESUF): %_g$(EXESUF)
50 SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES \
51 ALTIVEC-OBJS MMX-OBJS YASM-OBJS-FFT YASM-OBJS
59 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
64 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
66 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
67 ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
69 %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
70 $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
72 output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
73 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
75 tools/%$(EXESUF): tools/%.c
76 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
78 ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
80 cmdutils.o cmdutils.d: version.h
82 alltools: $(addsuffix $(EXESUF),$(addprefix tools/, cws2fws pktdumper qt-faststart trasher))
84 documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
85 ffplay-doc.html general.html $(ALLMANPAGES))
87 doc/%.html: doc/%.texi
88 texi2html -monolithic -number $<
91 doc/%.pod: doc/%-doc.texi
95 pod2man --section=1 --center=" " --release=" " $< > $@
97 install: $(INSTALL_TARGETS-yes)
99 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
100 install -d "$(BINDIR)"
101 install -c -m 755 $(PROGS) "$(BINDIR)"
103 install-data: $(DATA_FILES)
104 install -d "$(DATADIR)"
105 install -m 644 $(DATA_FILES) "$(DATADIR)"
107 install-man: $(MANPAGES)
108 install -d "$(MANDIR)/man1"
109 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
111 uninstall: uninstall-progs uninstall-data uninstall-man
114 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
120 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
123 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
126 rm -f $(ALLPROGS) $(ALLPROGS_G) output_example$(EXESUF)
127 rm -f doc/*.html doc/*.pod doc/*.1
128 rm -f tests/seek_test$(EXESUF)
129 rm -f $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
130 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
133 rm -f version.h config.*
137 check: test checkheaders
139 fulltest test: codectest libavtest seektest
141 FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
142 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
143 LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
144 ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
145 SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
147 CODEC_TESTS = $(addprefix regtest-, \
194 LAVF_TESTS = $(addprefix regtest-, \
233 REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
235 CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
236 CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
238 LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
240 LAVF_REG = tests/data/lavf.regression
241 ROTOZOOM_REG = tests/data/rotozoom.regression
242 VSYNTH_REG = tests/data/vsynth.regression
244 ifneq ($(CONFIG_ZLIB),yes)
245 regtest-flashsv codectest: zlib-error
249 @echo "This regression test requires zlib."
253 codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
254 diff -u -w $(FFMPEG_REFFILE) $(VSYNTH_REG)
255 diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
257 libavtest: $(LAVF_REG)
258 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
260 $(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
263 $(LAVF_REG): $(LAVF_REGFILES)
264 $(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
265 $(VSYNTH_REG): $(CODEC_VSYNTH)
267 $(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
269 $(LAVF_REGFILES): $(LAVF_TESTS)
271 $(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
273 regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
275 $(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(HOSTEXESUF)
276 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
277 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
280 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
282 seektest: codectest libavtest tests/seek_test$(EXESUF)
283 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
285 servertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
287 @echo "Unfortunately ffserver is broken and therefore its regression"
288 @echo "test fails randomly. Treat the results accordingly."
290 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
292 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
293 mkdir -p tests/vsynth1
294 $(BUILD_ROOT)/$< 'tests/vsynth1/'
296 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
297 mkdir -p tests/vsynth2
298 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
300 tests/asynth1.sw: tests/audiogen$(HOSTEXESUF)
303 tests/%$(HOSTEXESUF): tests/%.c
304 $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
306 tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
307 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
310 .PHONY: documentation *test regtest-* zlib-error alltools check