flvenc: propagate error properly
[libav.git] / Makefile
CommitLineData
bde51e6a
JR
1include config.mak
2
3SRC_DIR = $(SRC_PATH_BARE)
4
5vpath %.texi $(SRC_PATH_BARE)
6
7PROGS-$(CONFIG_FFMPEG) += ffmpeg
8PROGS-$(CONFIG_FFPLAY) += ffplay
336ce917 9PROGS-$(CONFIG_FFPROBE) += ffprobe
bde51e6a
JR
10PROGS-$(CONFIG_FFSERVER) += ffserver
11
583fcb52 12PROGS := $(PROGS-yes:%=%$(EXESUF))
583fcb52
MR
13OBJS = $(PROGS-yes:%=%.o) cmdutils.o
14MANPAGES = $(PROGS-yes:%=doc/%.1)
15PODPAGES = $(PROGS-yes:%=doc/%.pod)
16HTMLPAGES = $(PROGS-yes:%=doc/%.html)
cd6a5a57 17TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws graph2dot lavfi-showfiltfmts pktdumper probetest qt-faststart trasher))
3d157bf3
MR
18TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
19HOSTPROGS := $(TESTTOOLS:%=tests/%)
bde51e6a 20
336ce917 21BASENAMES = ffmpeg ffplay ffprobe ffserver
583fcb52 22ALLPROGS = $(BASENAMES:%=%$(EXESUF))
583fcb52 23ALLMANPAGES = $(BASENAMES:%=%.1)
bde51e6a 24
5a0f7131 25FFLIBS-$(CONFIG_AVDEVICE) += avdevice
bde51e6a 26FFLIBS-$(CONFIG_AVFILTER) += avfilter
5a0f7131 27FFLIBS-$(CONFIG_AVFORMAT) += avformat
97d5fa38 28FFLIBS-$(CONFIG_AVCODEC) += avcodec
bde51e6a 29FFLIBS-$(CONFIG_POSTPROC) += postproc
5a0f7131 30FFLIBS-$(CONFIG_SWSCALE) += swscale
bde51e6a 31
5a0f7131 32FFLIBS := avutil
bde51e6a 33
a1a84f69
RS
34DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
35
9b55e2e7
MR
36SKIPHEADERS = cmdutils_common_opts.h
37
bde51e6a
JR
38include common.mak
39
40FF_LDFLAGS := $(FFLDFLAGS)
41FF_EXTRALIBS := $(FFEXTRALIBS)
42FF_DEP_LIBS := $(DEP_LIBS)
43
c73f65d9 44ALL_TARGETS-$(CONFIG_DOC) += documentation
bde51e6a 45
a48289c7 46ifdef PROGS
a1a84f69 47INSTALL_TARGETS-yes += install-progs install-data
c73f65d9 48INSTALL_TARGETS-$(CONFIG_DOC) += install-man
bde51e6a 49endif
bea81a52 50INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
bde51e6a
JR
51
52all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
53
86601915
MR
54config.h: .config
55.config: $(wildcard $(FFLIBS:%=$(SRC_DIR)/lib%/all*.c))
9d0b3042
MR
56 @-tput bold 2>/dev/null
57 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
58 @-tput sgr0 2>/dev/null
86601915 59
95f2c769 60SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
de4070b5 61 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
a7878c9f 62 HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS
bde51e6a
JR
63
64define RESET
65$(1) :=
66$(1)-yes :=
67endef
68
69define DOSUBDIR
70$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
71SUBDIR := $(1)/
72include $(1)/Makefile
73endef
74
75$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
76
e0be794a
MR
77ffplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
78ffserver$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
bde51e6a 79
e0be794a 80%$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
684b28e0 81 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
bde51e6a 82
2dfa3054
MR
83tools/%$(EXESUF): tools/%.o
84 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
85
2205da0d 86tools/%.o: tools/%.c
4d1156cb 87 $(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
08df7f86
MR
88
89-include $(wildcard tools/*.d)
f83acb09 90-include $(wildcard tests/*.d)
bde51e6a 91
3123823c 92ffplay.o: CFLAGS += $(SDL_CFLAGS)
bde51e6a 93
6a53fffd 94VERSION_SH = $(SRC_PATH_BARE)/version.sh
f82bf850 95GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD
6a53fffd 96
faa6f1c3 97.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
6a53fffd
MR
98.version: M=@
99
100version.h .version:
0853a2b4 101 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
6a53fffd
MR
102 $(Q)touch .version
103
104# force version.sh to run whenever version might have changed
105-include .version
36798f1b 106
13b1c80b 107alltools: $(TOOLS)
9bce82fa 108
7f939f55 109DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
dd46b538 110
a0f9c8ce 111documentation: $(DOCS)
bde51e6a 112
a0f9c8ce
MR
113-include $(wildcard $(DOCS:%=%.d))
114
115TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
3275ac6a 116
7732f641 117doc/%.html: TAG = HTML
a8f0814a 118doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init
a0f9c8ce 119 $(Q)$(TEXIDEP)
a5514a84 120 $(M)texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init --output $@ $<
bde51e6a 121
7732f641 122doc/%.pod: TAG = POD
82ccbe6b 123doc/%.pod: doc/%.texi
a0f9c8ce 124 $(Q)$(TEXIDEP)
86be2bc3 125 $(M)doc/texi2pod.pl $< $@
bde51e6a 126
7732f641 127doc/%.1: TAG = MAN
bde51e6a 128doc/%.1: doc/%.pod
86be2bc3 129 $(M)pod2man --section=1 --center=" " --release=" " $< > $@
bde51e6a
JR
130
131install: $(INSTALL_TARGETS-yes)
132
133install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
63611f31 134 $(Q)mkdir -p "$(BINDIR)"
fd676deb 135 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
bde51e6a 136
a1a84f69 137install-data: $(DATA_FILES)
63611f31 138 $(Q)mkdir -p "$(DATADIR)"
fd676deb 139 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 140
bde51e6a 141install-man: $(MANPAGES)
63611f31 142 $(Q)mkdir -p "$(MANDIR)/man1"
fd676deb 143 $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
bde51e6a 144
d3cb93b3
RP
145uninstall: uninstall-progs uninstall-data uninstall-man
146
147uninstall-progs:
50e10cbd 148 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
d3cb93b3
RP
149
150uninstall-data:
50e10cbd 151 $(RM) -r "$(DATADIR)"
d3cb93b3
RP
152
153uninstall-man:
50e10cbd 154 $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
bde51e6a 155
250dd6f0 156testclean:
50e10cbd
MR
157 $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
158 $(RM) $(addprefix tests/,$(CLEANSUFFIXES))
159 $(RM) tests/seek_test$(EXESUF) tests/seek_test.o
3d157bf3 160 $(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF))
250dd6f0
FC
161
162clean:: testclean
e0be794a 163 $(RM) $(ALLPROGS)
50e10cbd
MR
164 $(RM) $(CLEANSUFFIXES)
165 $(RM) doc/*.html doc/*.pod doc/*.1
166 $(RM) $(TOOLS)
40321376 167 $(RM) $(CLEANSUFFIXES:%=tools/%)
bde51e6a
JR
168
169distclean::
50e10cbd 170 $(RM) $(DISTCLEANSUFFIXES)
59748689 171 $(RM) config.* .version version.h libavutil/avconfig.h
bde51e6a 172
9d0b3042 173config:
29ba0911 174 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
0c3b2d65 175
bde51e6a
JR
176# regression tests
177
5bab8536
DB
178check: test checkheaders
179
b3dce4b9 180fulltest test: codectest lavftest lavfitest seektest
bde51e6a 181
bde51e6a 182FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
bde51e6a 183
57f09630
MR
184codectest: fate-codec
185lavftest: fate-lavf
186lavfitest: fate-lavfi
187seektest: fate-seek
40e02409 188
70378ea1
MR
189AREF = fate-acodec-aref
190VREF = fate-vsynth1-vref fate-vsynth2-vref
9770a7ad
MR
191REFS = $(AREF) $(VREF)
192
9be24c60 193$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
9be24c60 194$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
70378ea1 195
d7167f05 196ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
bde51e6a
JR
197 @echo
198 @echo "Unfortunately ffserver is broken and therefore its regression"
199 @echo "test fails randomly. Treat the results accordingly."
200 @echo
767e14c3 201 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
bde51e6a 202
82bb3329 203tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
4ab20de6 204 @mkdir -p tests/vsynth1
798b2646 205 $(M)./$< 'tests/vsynth1/'
bde51e6a 206
82bb3329 207tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
4ab20de6 208 @mkdir -p tests/vsynth2
798b2646 209 $(M)./$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
bde51e6a 210
d7167f05 211tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
4ab20de6 212 @mkdir -p tests/data
798b2646 213 $(M)./$< $@
4ab20de6
MR
214
215tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
bde51e6a 216
684b28e0
MR
217tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
218 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
bde51e6a 219
43d2c6a5
SS
220tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS)
221 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
222
2fad0977 223include $(SRC_PATH_BARE)/tests/fate.mak
7e264ca1
MR
224include $(SRC_PATH_BARE)/tests/fate2.mak
225
4c3fbd4f
MR
226include $(SRC_PATH_BARE)/tests/fate/aac.mak
227include $(SRC_PATH_BARE)/tests/fate/als.mak
228include $(SRC_PATH_BARE)/tests/fate/fft.mak
229include $(SRC_PATH_BARE)/tests/fate/h264.mak
680aefa2 230include $(SRC_PATH_BARE)/tests/fate/mp3.mak
4c3fbd4f
MR
231include $(SRC_PATH_BARE)/tests/fate/vorbis.mak
232include $(SRC_PATH_BARE)/tests/fate/vp8.mak
233
57f09630
MR
234FATE_ACODEC = $(ACODEC_TESTS:%=fate-acodec-%)
235FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%)
236FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%)
9a3f31ef 237FATE_VCODEC = $(FATE_VSYNTH1) $(FATE_VSYNTH2)
57f09630
MR
238FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%)
239FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%)
9a3f31ef
MR
240FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%)
241
242FATE = $(FATE_ACODEC) \
243 $(FATE_VCODEC) \
244 $(FATE_LAVF) \
245 $(FATE_LAVFI) \
246 $(FATE_SEEK) \
247
164c24c8
MR
248$(filter-out %-aref,$(FATE_ACODEC)): $(AREF)
249$(filter-out %-vref,$(FATE_VCODEC)): $(VREF)
9a3f31ef 250$(FATE_LAVF): $(REFS)
43d2c6a5 251$(FATE_LAVFI): $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
9a3f31ef
MR
252$(FATE_SEEK): fate-codec fate-lavf tests/seek_test$(EXESUF)
253
254$(FATE_ACODEC): CMD = codectest acodec
255$(FATE_VSYNTH1): CMD = codectest vsynth1
256$(FATE_VSYNTH2): CMD = codectest vsynth2
257$(FATE_LAVF): CMD = lavftest
258$(FATE_LAVFI): CMD = lavfitest
259$(FATE_SEEK): CMD = seektest
260
261fate-codec: fate-acodec fate-vcodec
262fate-acodec: $(FATE_ACODEC)
263fate-vcodec: $(FATE_VCODEC)
264fate-lavf: $(FATE_LAVF)
265fate-lavfi: $(FATE_LAVFI)
266fate-seek: $(FATE_SEEK)
267
666d7d18 268ifdef SAMPLES
9a3f31ef 269FATE += $(FATE_TESTS)
8ce67bca
RT
270fate-rsync:
271 rsync -vaLW rsync://fate-suite.libav.org/fate-suite/ $(SAMPLES)
2fad0977 272else
8ce67bca
RT
273fate-rsync:
274 @echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate suite"
715e9be2 275$(FATE_TESTS):
2fad0977
MR
276 @echo "SAMPLES not specified, cannot run FATE"
277endif
bde51e6a 278
b82be636
MR
279FATE_UTILS = base64 tiny_psnr
280
9a3f31ef 281fate: $(FATE)
9a3f31ef 282
164c24c8 283$(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
f6ae77d4 284 @echo "TEST $(@:fate-%=%)"
3283f274 285 $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)'
9a3f31ef 286
d29d9ccc
MR
287fate-list:
288 @printf '%s\n' $(sort $(FATE))
289
34ae2d90 290.PHONY: documentation *test regtest-* alltools check config