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)
30 FF_LDFLAGS := $(FFLDFLAGS)
31 FF_EXTRALIBS := $(FFEXTRALIBS)
32 FF_DEP_LIBS := $(DEP_LIBS)
34 ALL_TARGETS-$(BUILD_DOC) += documentation
37 INSTALL_TARGETS-yes += install-progs install-data
38 INSTALL_TARGETS-$(BUILD_DOC) += install-man
40 INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
42 all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
44 $(PROGS): %$(EXESUF): %_g$(EXESUF)
48 SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTS
56 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
61 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
63 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
64 ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
66 %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
67 $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
69 output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
70 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
72 tools/%$(EXESUF): tools/%.c
73 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
75 ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
77 cmdutils.o cmdutils.d: version.h
79 alltools: $(addsuffix $(EXESUF),$(addprefix tools/, cws2fws pktdumper qt-faststart trasher))
81 documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
82 ffplay-doc.html general.html $(ALLMANPAGES))
84 doc/%.html: doc/%.texi
85 texi2html -monolithic -number $<
88 doc/%.pod: doc/%-doc.texi
92 pod2man --section=1 --center=" " --release=" " $< > $@
94 install: $(INSTALL_TARGETS-yes)
96 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
97 install -d "$(BINDIR)"
98 install -c -m 755 $(PROGS) "$(BINDIR)"
100 install-data: $(DATA_FILES)
101 install -d "$(DATADIR)"
102 install -m 644 $(DATA_FILES) "$(DATADIR)"
104 install-man: $(MANPAGES)
105 install -d "$(MANDIR)/man1"
106 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
108 uninstall: uninstall-progs uninstall-data uninstall-man
111 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
117 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
120 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
123 rm -f $(ALLPROGS) $(ALLPROGS_G) output_example$(EXESUF)
124 rm -f doc/*.html doc/*.pod doc/*.1
125 rm -f tests/seek_test$(EXESUF)
126 rm -f $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
127 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
130 rm -f version.h config.*
134 check: test checkheaders
136 fulltest test: codectest libavtest seektest
138 FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
139 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
140 LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
141 ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
142 SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
144 CODEC_TESTS = $(addprefix regtest-, \
191 LAVF_TESTS = $(addprefix regtest-, \
229 REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
231 CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
232 CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
234 LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
236 LAVF_REG = tests/data/lavf.regression
237 ROTOZOOM_REG = tests/data/rotozoom.regression
238 VSYNTH_REG = tests/data/vsynth.regression
240 ifneq ($(CONFIG_ZLIB),yes)
241 regtest-flashsv codectest: zlib-error
245 @echo "This regression test requires zlib."
249 codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
250 diff -u -w $(FFMPEG_REFFILE) $(VSYNTH_REG)
251 diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
253 libavtest: $(LAVF_REG)
254 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
256 $(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
259 $(LAVF_REG): $(LAVF_REGFILES)
260 $(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
261 $(VSYNTH_REG): $(CODEC_VSYNTH)
263 $(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
265 $(LAVF_REGFILES): $(LAVF_TESTS)
267 $(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
269 regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
271 $(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(HOSTEXESUF)
272 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
273 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
276 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
278 seektest: codectest libavtest tests/seek_test$(EXESUF)
279 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
281 servertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
283 @echo "Unfortunately ffserver is broken and therefore its regression"
284 @echo "test fails randomly. Treat the results accordingly."
286 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
288 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
289 mkdir -p tests/vsynth1
290 $(BUILD_ROOT)/$< 'tests/vsynth1/'
292 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
293 mkdir -p tests/vsynth2
294 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
296 tests/asynth1.sw: tests/audiogen$(HOSTEXESUF)
299 tests/%$(HOSTEXESUF): tests/%.c
300 $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
302 tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
303 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
306 .PHONY: lib documentation *test regtest-* swscale-error zlib-error alltools check