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