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
23 FFLIBS-
$(CONFIG_SWSCALE
) += swscale
25 FFLIBS
:= avdevice avformat avcodec avutil
27 DATA_FILES
:= $(wildcard $(SRC_DIR
)/ffpresets
/*.ffpreset
)
31 FF_LDFLAGS
:= $(FFLDFLAGS
)
32 FF_EXTRALIBS
:= $(FFEXTRALIBS
)
33 FF_DEP_LIBS
:= $(DEP_LIBS
)
35 ALL_TARGETS-
$(CONFIG_VHOOK
) += videohook
36 ALL_TARGETS-
$(BUILD_DOC
) += documentation
38 INSTALL_TARGETS-
$(CONFIG_VHOOK
) += install-vhook
40 INSTALL_TARGETS-yes
+= install-progs install-data
41 INSTALL_TARGETS-
$(BUILD_DOC
) += install-man
43 INSTALL_PROGS_TARGETS-
$(BUILD_SHARED
) = install-libs
45 all: $(FF_DEP_LIBS
) $(PROGS
) $(ALL_TARGETS-yes
)
47 $(PROGS
): %$(EXESUF
): %_g
$(EXESUF
)
51 SUBDIR_VARS
:= OBJS FFLIBS CLEANFILES DIRS TESTS
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 alltools
: $(addsuffix $(EXESUF
),$(addprefix tools
/, cws2fws pktdumper qt-faststart trasher
))
82 VHOOKCFLAGS
+= $(filter-out -mdynamic-no-pic
,$(CFLAGS
))
84 BASEHOOKS
= fish null watermark
85 ALLHOOKS
= $(BASEHOOKS
) drawtext imlib2 ppm
86 ALLHOOKS_SRCS
= $(addprefix vhook
/, $(addsuffix .c
, $(ALLHOOKS
)))
88 HOOKS-
$(HAVE_FORK
) += ppm
89 HOOKS-
$(HAVE_IMLIB2
) += imlib2
90 HOOKS-
$(HAVE_FREETYPE2
) += drawtext
92 HOOKS
= $(addprefix vhook
/, $(addsuffix $(SLIBSUF
), $(BASEHOOKS
) $(HOOKS-yes
)))
94 VHOOKCFLAGS-
$(HAVE_IMLIB2
) += `imlib2-config --cflags`
95 LIBS_imlib2
$(SLIBSUF
) = `imlib2-config --libs`
97 VHOOKCFLAGS-
$(HAVE_FREETYPE2
) += `freetype-config --cflags`
98 LIBS_drawtext
$(SLIBSUF
) = `freetype-config --libs`
100 VHOOKCFLAGS
+= $(VHOOKCFLAGS-yes
)
102 vhook
/%.o vhook
/%.d
: CFLAGS
:=$(VHOOKCFLAGS
)
104 # vhooks compile fine without libav*, but need them nonetheless.
105 videohook
: $(FF_DEP_LIBS
) $(HOOKS
)
107 $(eval VHOOKSHFLAGS
=$(VHOOKSHFLAGS
))
108 vhook
/%$(SLIBSUF
): vhook
/%.o
109 $(CC
) $(LDFLAGS
) -o
$@
$(VHOOKSHFLAGS
) $< $(VHOOKLIBS
) $(LIBS_
$(@F
))
111 VHOOK_DEPS
= $(HOOKS
:$(SLIBSUF
)=.d
)
112 depend dep
: $(VHOOK_DEPS
)
114 documentation
: $(addprefix doc
/, ffmpeg-doc.html faq.html ffserver-doc.html \
115 ffplay-doc.html general.html hooks.html \
118 doc
/%.html
: doc
/%.texi
119 texi2html
-monolithic
-number
$<
122 doc
/%.pod
: doc
/%-doc.texi
123 doc
/texi2pod.pl
$< $@
126 pod2man
--section
=1 --center
=" " --release
=" " $< > $@
128 install: $(INSTALL_TARGETS-yes
)
130 install-progs
: $(PROGS
) $(INSTALL_PROGS_TARGETS-yes
)
131 install -d
"$(BINDIR)"
132 install -c
-m
755 $(PROGS
) "$(BINDIR)"
134 install-data
: $(DATA_FILES
)
135 install -d
"$(DATADIR)"
136 install -m
644 $(DATA_FILES
) "$(DATADIR)"
138 install-man
: $(MANPAGES
)
139 install -d
"$(MANDIR)/man1"
140 install -m
644 $(MANPAGES
) "$(MANDIR)/man1"
142 install-vhook
: videohook
143 install -d
"$(SHLIBDIR)/vhook"
144 install -m
755 $(HOOKS
) "$(SHLIBDIR)/vhook"
146 uninstall: uninstall-progs uninstall-data uninstall-man uninstall-vhook
149 rm -f
$(addprefix "$(BINDIR)/", $(ALLPROGS
))
155 rm -f
$(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES
))
158 rm -f
$(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS
:.c
=$(SLIBSUF
)))
159 -rmdir
"$(SHLIBDIR)/vhook/"
162 rm -rf tests
/vsynth1 tests
/vsynth2 tests
/data tests
/asynth1.sw tests
/*~
165 rm -f
$(ALLPROGS
) $(ALLPROGS_G
) output_example
$(EXESUF
)
166 rm -f doc
/*.html doc
/*.pod doc
/*.1
167 rm -f
$(addprefix tests
/,$(addsuffix $(EXESUF
),audiogen videogen rotozoom seek_test tiny_psnr
))
168 rm -f
$(addprefix tools
/,$(addsuffix $(EXESUF
),cws2fws pktdumper qt-faststart trasher
))
169 rm -f vhook
/*.o vhook
/*~ vhook
/*.so vhook
/*.dylib vhook
/*.dll
172 rm -f version.h config.
* vhook
/*.d
176 check: test checkheaders
178 fulltest
test: codectest libavtest seektest
180 FFMPEG_REFFILE
= $(SRC_PATH
)/tests
/ffmpeg.regression.ref
181 FFSERVER_REFFILE
= $(SRC_PATH
)/tests
/ffserver.regression.ref
182 LIBAV_REFFILE
= $(SRC_PATH
)/tests
/libav.regression.ref
183 ROTOZOOM_REFFILE
= $(SRC_PATH
)/tests
/rotozoom.regression.ref
184 SEEK_REFFILE
= $(SRC_PATH
)/tests
/seek.regression.ref
186 CODEC_TESTS
= $(addprefix regtest-
, \
233 LAVF_TESTS
= $(addprefix regtest-
, \
270 REGFILES
= $(addprefix tests
/data
/,$(addsuffix .
$(1),$(2:regtest-
%=%)))
272 CODEC_ROTOZOOM
= $(call REGFILES
,rotozoom.regression
,$(CODEC_TESTS
))
273 CODEC_VSYNTH
= $(call REGFILES
,vsynth.regression
,$(CODEC_TESTS
))
275 LAVF_REGFILES
= $(call REGFILES
,lavf.regression
,$(LAVF_TESTS
))
277 LAVF_REG
= tests
/data
/lavf.regression
278 ROTOZOOM_REG
= tests
/data
/rotozoom.regression
279 VSYNTH_REG
= tests
/data
/vsynth.regression
281 ifneq ($(CONFIG_SWSCALE
),yes
)
282 servertest codectest
$(CODEC_TESTS
) libavtest
: swscale_error
285 @echo
"This regression test requires --enable-swscale."
290 codectest
: $(VSYNTH_REG
) $(ROTOZOOM_REG
)
291 diff
-u
-w
$(FFMPEG_REFFILE
) $(VSYNTH_REG
)
292 diff
-u
-w
$(ROTOZOOM_REFFILE
) $(ROTOZOOM_REG
)
294 libavtest
: $(LAVF_REG
)
295 diff
-u
-w
$(LIBAV_REFFILE
) $(LAVF_REG
)
297 $(VSYNTH_REG
) $(ROTOZOOM_REG
) $(LAVF_REG
):
300 $(LAVF_REG
): $(LAVF_REGFILES
)
301 $(ROTOZOOM_REG
): $(CODEC_ROTOZOOM
)
302 $(VSYNTH_REG
): $(CODEC_VSYNTH
)
304 $(CODEC_VSYNTH
) $(CODEC_ROTOZOOM
): $(CODEC_TESTS
)
306 $(LAVF_REGFILES
): $(LAVF_TESTS
)
308 $(CODEC_TESTS
) $(LAVF_TESTS
): regtest-ref
310 regtest-ref
: ffmpeg
$(EXESUF
) tests
/vsynth1
/00.pgm tests
/vsynth2
/00.pgm tests
/asynth1.sw
312 $(CODEC_TESTS
) regtest-ref
: tests
/tiny_psnr
$(EXESUF
)
313 $(SRC_PATH
)/tests
/regression.sh
$@ vsynth tests
/vsynth1 a
"$(TARGET_EXEC)" "$(TARGET_PATH)"
314 $(SRC_PATH
)/tests
/regression.sh
$@ rotozoom tests
/vsynth2 a
"$(TARGET_EXEC)" "$(TARGET_PATH)"
317 $(SRC_PATH
)/tests
/regression.sh
$@ lavf tests
/vsynth1 b
"$(TARGET_EXEC)" "$(TARGET_PATH)"
319 seektest
: codectest libavtest tests
/seek_test
$(EXESUF
)
320 $(SRC_PATH
)/tests
/seek_test.sh
$(SEEK_REFFILE
) "$(TARGET_EXEC)" "$(TARGET_PATH)"
322 servertest
: ffserver
$(EXESUF
) tests
/vsynth1
/00.pgm tests
/asynth1.sw
324 @echo
"Unfortunately ffserver is broken and therefore its regression"
325 @echo
"test fails randomly. Treat the results accordingly."
327 $(SRC_PATH
)/tests
/server-regression.sh
$(FFSERVER_REFFILE
) $(SRC_PATH
)/tests
/test.conf
329 tests
/vsynth1
/00.pgm
: tests
/videogen
$(EXESUF
)
330 mkdir
-p tests
/vsynth1
331 $(BUILD_ROOT
)/$< 'tests/vsynth1/'
333 tests
/vsynth2
/00.pgm
: tests
/rotozoom
$(EXESUF
)
334 mkdir
-p tests
/vsynth2
335 $(BUILD_ROOT
)/$< 'tests/vsynth2/' $(SRC_PATH
)/tests
/lena.pnm
337 tests
/asynth1.sw
: tests
/audiogen
$(EXESUF
)
340 tests
/%$(EXESUF
): tests
/%.c
341 $(HOSTCC
) $(HOSTCFLAGS
) $(HOSTLDFLAGS
) -o
$@
$< $(HOSTLIBS
)
343 tests
/seek_test
$(EXESUF
): tests
/seek_test.c
$(FF_DEP_LIBS
)
344 $(CC
) $(FF_LDFLAGS
) $(CFLAGS
) -o
$@
$< $(FF_EXTRALIBS
)
347 .PHONY
: lib videohook documentation
*test regtest-
* swscale-error alltools
check
349 -include $(VHOOK_DEPS
)