3 # (c) 2000-2004 Fabrice Bellard
7 SRC_DIR
= $(SRC_PATH_BARE
)
9 vpath
%.texi
$(SRC_PATH_BARE
)
11 PROGS-
$(CONFIG_FFMPEG
) += ffmpeg
12 PROGS-
$(CONFIG_FFPLAY
) += ffplay
13 PROGS-
$(CONFIG_FFSERVER
) += ffserver
15 PROGS
= $(addsuffix $(EXESUF
), $(PROGS-yes
))
16 PROGS_G
= $(addsuffix _g
$(EXESUF
), $(PROGS-yes
))
17 OBJS
= $(addsuffix .o
, $(PROGS-yes
)) cmdutils.o
18 MANPAGES
= $(addprefix doc
/, $(addsuffix .1, $(PROGS-yes
)))
20 BASENAMES
= ffmpeg ffplay ffserver
21 ALLPROGS
= $(addsuffix $(EXESUF
), $(BASENAMES
))
22 ALLPROGS_G
= $(addsuffix _g
$(EXESUF
), $(BASENAMES
))
23 ALLMANPAGES
= $(addsuffix .1, $(BASENAMES
))
25 FFLIBS-
$(CONFIG_AVFILTER
) += avfilter
26 FFLIBS-
$(CONFIG_POSTPROC
) += postproc
27 FFLIBS-
$(CONFIG_SWSCALE
) += swscale
29 FFLIBS
:= avdevice avformat avcodec avutil
33 FF_LDFLAGS
:= $(FFLDFLAGS
)
34 FF_EXTRALIBS
:= $(FFEXTRALIBS
)
35 FF_DEP_LIBS
:= $(DEP_LIBS
)
37 ALL_TARGETS-
$(CONFIG_VHOOK
) += videohook
38 ALL_TARGETS-
$(BUILD_DOC
) += documentation
40 INSTALL_TARGETS-
$(CONFIG_VHOOK
) += install-vhook
42 INSTALL_TARGETS-yes
+= install-progs
43 INSTALL_TARGETS-
$(BUILD_DOC
) += install-man
45 INSTALL_PROGS_TARGETS-
$(BUILD_SHARED
) = install-libs
47 all: $(FF_DEP_LIBS
) $(PROGS
) $(ALL_TARGETS-yes
)
49 $(PROGS
): %$(EXESUF
): %_g
$(EXESUF
)
53 SUBDIR_VARS
:= OBJS ASM_OBJS CPP_OBJS FFLIBS CLEANFILES DIRS TESTS
61 $(foreach V
,$(SUBDIR_VARS
),$(eval
$(call RESET
,$(V
))))
66 $(foreach D
,$(FFLIBS
),$(eval
$(call DOSUBDIR
,lib
$(D
))))
68 ffplay_g
$(EXESUF
): FF_EXTRALIBS
+= $(SDL_LIBS
)
69 ffserver_g
$(EXESUF
): FF_LDFLAGS
+= $(FFSERVERLDFLAGS
)
71 %_g
$(EXESUF
): %.o cmdutils.o
$(FF_DEP_LIBS
)
72 $(CC
) $(FF_LDFLAGS
) -o
$@
$< cmdutils.o
$(FF_EXTRALIBS
)
74 SVN_ENTRIES
= $(SRC_PATH_BARE
)/.svn
/entries
75 ifeq ($(wildcard $(SVN_ENTRIES
)),$(SVN_ENTRIES
))
76 version.h
: $(SVN_ENTRIES
)
80 $(SRC_PATH
)/version.sh
$(SRC_PATH
)
82 output_example
$(EXESUF
): output_example.o
$(FF_DEP_LIBS
)
83 $(CC
) $(CFLAGS
) $(FF_LDFLAGS
) -o
$@
$< $(FF_EXTRALIBS
)
85 tools
/%$(EXESUF
): tools
/%.c
86 $(CC
) $(CFLAGS
) $(FF_LDFLAGS
) -o
$@
$< $(FF_EXTRALIBS
)
88 ffplay.o ffplay.d
: CFLAGS
+= $(SDL_CFLAGS
)
90 VHOOKCFLAGS
+= $(filter-out -mdynamic-no-pic
,$(CFLAGS
))
92 BASEHOOKS
= fish null watermark
93 ALLHOOKS
= $(BASEHOOKS
) drawtext imlib2 ppm
94 ALLHOOKS_SRCS
= $(addprefix vhook
/, $(addsuffix .c
, $(ALLHOOKS
)))
96 HOOKS-
$(HAVE_FORK
) += ppm
97 HOOKS-
$(HAVE_IMLIB2
) += imlib2
98 HOOKS-
$(HAVE_FREETYPE2
) += drawtext
100 HOOKS
= $(addprefix vhook
/, $(addsuffix $(SLIBSUF
), $(BASEHOOKS
) $(HOOKS-yes
)))
102 VHOOKCFLAGS-
$(HAVE_IMLIB2
) += `imlib2-config --cflags`
103 LIBS_imlib2
$(SLIBSUF
) = `imlib2-config --libs`
105 VHOOKCFLAGS-
$(HAVE_FREETYPE2
) += `freetype-config --cflags`
106 LIBS_drawtext
$(SLIBSUF
) = `freetype-config --libs`
108 VHOOKCFLAGS
+= $(VHOOKCFLAGS-yes
)
110 vhook
/%.o vhook
/%.d
: CFLAGS
:=$(VHOOKCFLAGS
)
112 # vhooks compile fine without libav*, but need them nonetheless.
113 videohook
: $(FF_DEP_LIBS
) $(HOOKS
)
115 $(eval VHOOKSHFLAGS
=$(VHOOKSHFLAGS
))
116 vhook
/%$(SLIBSUF
): vhook
/%.o
117 $(CC
) $(LDFLAGS
) -o
$@
$(VHOOKSHFLAGS
) $< $(VHOOKLIBS
) $(LIBS_
$(@F
))
119 VHOOK_DEPS
= $(HOOKS
:$(SLIBSUF
)=.d
)
120 depend dep
: $(VHOOK_DEPS
)
122 documentation
: $(addprefix doc
/, ffmpeg-doc.html faq.html ffserver-doc.html \
123 ffplay-doc.html general.html hooks.html \
126 doc
/%.html
: doc
/%.texi
127 texi2html
-monolithic
-number
$<
130 doc
/%.pod
: doc
/%-doc.texi
131 doc
/texi2pod.pl
$< $@
134 pod2man
--section
=1 --center
=" " --release
=" " $< > $@
136 install: $(INSTALL_TARGETS-yes
)
138 install-progs
: $(PROGS
) $(INSTALL_PROGS_TARGETS-yes
)
139 install -d
"$(BINDIR)"
140 install -c
-m
755 $(PROGS
) "$(BINDIR)"
142 install-man
: $(MANPAGES
)
143 install -d
"$(MANDIR)/man1"
144 install -m
644 $(MANPAGES
) "$(MANDIR)/man1"
146 install-vhook
: videohook
147 install -d
"$(SHLIBDIR)/vhook"
148 install -m
755 $(HOOKS
) "$(SHLIBDIR)/vhook"
150 uninstall: uninstall-progs uninstall-man uninstall-vhook
153 rm -f
$(addprefix "$(BINDIR)/", $(ALLPROGS
))
156 rm -f
$(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES
))
159 rm -f
$(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS
:.c
=$(SLIBSUF
)))
160 -rmdir
"$(SHLIBDIR)/vhook/"
163 rm -f gmon.out TAGS
$(ALLPROGS
) $(ALLPROGS_G
) \
164 output_example
$(EXESUF
)
165 rm -f doc
/*.html doc
/*.pod doc
/*.1
166 rm -rf tests
/vsynth1 tests
/vsynth2 tests
/data tests
/asynth1.sw tests
/*~
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.
* *.
pc vhook
/*.d
176 fulltest
test: codectest libavtest seektest
178 FFMPEG_REFFILE
= $(SRC_PATH
)/tests
/ffmpeg.regression.ref
179 FFSERVER_REFFILE
= $(SRC_PATH
)/tests
/ffserver.regression.ref
180 LIBAV_REFFILE
= $(SRC_PATH
)/tests
/libav.regression.ref
181 ROTOZOOM_REFFILE
= $(SRC_PATH
)/tests
/rotozoom.regression.ref
182 SEEK_REFFILE
= $(SRC_PATH
)/tests
/seek.regression.ref
184 CODEC_TESTS
= $(addprefix regtest-
, \
230 LAVF_TESTS
= $(addprefix regtest-
, \
267 REGFILES
= $(addprefix tests
/data
/,$(addsuffix .
$(1),$(2:regtest-
%=%)))
269 CODEC_ROTOZOOM
= $(call REGFILES
,rotozoom.regression
,$(CODEC_TESTS
))
270 CODEC_VSYNTH
= $(call REGFILES
,vsynth.regression
,$(CODEC_TESTS
))
272 LAVF_REGFILES
= $(call REGFILES
,lavf.regression
,$(LAVF_TESTS
))
274 LAVF_REG
= tests
/data
/lavf.regression
275 ROTOZOOM_REG
= tests
/data
/rotozoom.regression
276 VSYNTH_REG
= tests
/data
/vsynth.regression
278 codectest
: $(VSYNTH_REG
) $(ROTOZOOM_REG
)
279 diff
-u
-w
$(FFMPEG_REFFILE
) $(VSYNTH_REG
)
280 diff
-u
-w
$(ROTOZOOM_REFFILE
) $(ROTOZOOM_REG
)
282 libavtest
: $(LAVF_REG
)
283 diff
-u
-w
$(LIBAV_REFFILE
) $(LAVF_REG
)
285 $(VSYNTH_REG
) $(ROTOZOOM_REG
) $(LAVF_REG
):
288 $(LAVF_REG
): $(LAVF_REGFILES
)
289 $(ROTOZOOM_REG
): $(CODEC_ROTOZOOM
)
290 $(VSYNTH_REG
): $(CODEC_VSYNTH
)
292 $(CODEC_VSYNTH
) $(CODEC_ROTOZOOM
): $(CODEC_TESTS
)
294 $(LAVF_REGFILES
): $(LAVF_TESTS
)
296 $(CODEC_TESTS
) $(LAVF_TESTS
): regtest-ref
298 regtest-ref
: ffmpeg
$(EXESUF
) tests
/vsynth1
/00.pgm tests
/vsynth2
/00.pgm tests
/asynth1.sw
300 $(CODEC_TESTS
) regtest-ref
: tests
/tiny_psnr
$(EXESUF
)
301 $(SRC_PATH
)/tests
/regression.sh
$@ vsynth tests
/vsynth1 a
302 $(SRC_PATH
)/tests
/regression.sh
$@ rotozoom tests
/vsynth2 a
305 $(SRC_PATH
)/tests
/regression.sh
$@ lavf tests
/vsynth1 b
307 seektest
: codectest libavtest tests
/seek_test
$(EXESUF
)
308 $(SRC_PATH
)/tests
/seek_test.sh
$(SEEK_REFFILE
)
310 test-server
: ffserver
$(EXESUF
) tests
/vsynth1
/00.pgm tests
/asynth1.sw
312 @echo
"Unfortunately ffserver is broken and therefore its regression"
313 @echo
"test fails randomly. Treat the results accordingly."
315 $(SRC_PATH
)/tests
/server-regression.sh
$(FFSERVER_REFFILE
) $(SRC_PATH
)/tests
/test.conf
317 ifeq ($(CONFIG_SWSCALE
),yes
)
318 test-server codectest
$(CODEC_TESTS
) libavtest
: swscale_error
321 @echo
"This regression test is incompatible with --enable-swscale."
326 tests
/vsynth1
/00.pgm
: tests
/videogen
$(EXESUF
)
327 mkdir
-p tests
/vsynth1
328 $(BUILD_ROOT
)/$< 'tests/vsynth1/'
330 tests
/vsynth2
/00.pgm
: tests
/rotozoom
$(EXESUF
)
331 mkdir
-p tests
/vsynth2
332 $(BUILD_ROOT
)/$< 'tests/vsynth2/' $(SRC_PATH
)/tests
/lena.pnm
334 tests
/asynth1.sw
: tests
/audiogen
$(EXESUF
)
338 $(CC
) $(FF_LDFLAGS
) $(CFLAGS
) -o
$@
$<
340 tests
/seek_test
$(EXESUF
): tests
/seek_test.c
$(FF_DEP_LIBS
)
341 $(CC
) $(FF_LDFLAGS
) $(CFLAGS
) -o
$@
$< $(FF_EXTRALIBS
)
344 .PHONY
: lib videohook documentation TAGS
345 .PHONY
: codectest libavtest seektest test-server fulltest
test
346 .PHONY
: $(CODEC_TESTS
) $(LAVF_TESTS
) regtest-ref swscale-error
348 -include $(VHOOK_DEPS
)