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