amrnb: use correct size when copying lsf_r array
[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) $<
bde51e6a 94
3123823c 95ffplay.o: CFLAGS += $(SDL_CFLAGS)
bde51e6a 96
6a53fffd 97VERSION_SH = $(SRC_PATH_BARE)/version.sh
f82bf850 98GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD
6a53fffd
MR
99SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
100
f82bf850 101.version: $(wildcard $(GIT_LOG) $(SVN_ENTRIES)) $(VERSION_SH) config.mak
6a53fffd
MR
102.version: M=@
103
104version.h .version:
0853a2b4 105 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
6a53fffd
MR
106 $(Q)touch .version
107
108# force version.sh to run whenever version might have changed
109-include .version
36798f1b 110
13b1c80b 111alltools: $(TOOLS)
9bce82fa 112
7f939f55 113DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
dd46b538 114
a0f9c8ce 115documentation: $(DOCS)
bde51e6a 116
a0f9c8ce
MR
117-include $(wildcard $(DOCS:%=%.d))
118
119TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
3275ac6a 120
7732f641 121doc/%.html: TAG = HTML
a8f0814a 122doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init
a0f9c8ce 123 $(Q)$(TEXIDEP)
a8f0814a 124 $(M)cd doc && texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init $(<:doc/%=%)
bde51e6a 125
7732f641 126doc/%.pod: TAG = POD
82ccbe6b 127doc/%.pod: doc/%.texi
a0f9c8ce 128 $(Q)$(TEXIDEP)
86be2bc3 129 $(M)doc/texi2pod.pl $< $@
bde51e6a 130
7732f641 131doc/%.1: TAG = MAN
bde51e6a 132doc/%.1: doc/%.pod
86be2bc3 133 $(M)pod2man --section=1 --center=" " --release=" " $< > $@
bde51e6a
JR
134
135install: $(INSTALL_TARGETS-yes)
136
137install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
63611f31 138 $(Q)mkdir -p "$(BINDIR)"
fd676deb 139 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
bde51e6a 140
a1a84f69 141install-data: $(DATA_FILES)
63611f31 142 $(Q)mkdir -p "$(DATADIR)"
fd676deb 143 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 144
bde51e6a 145install-man: $(MANPAGES)
63611f31 146 $(Q)mkdir -p "$(MANDIR)/man1"
fd676deb 147 $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
bde51e6a 148
d3cb93b3
RP
149uninstall: uninstall-progs uninstall-data uninstall-man
150
151uninstall-progs:
50e10cbd 152 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
d3cb93b3
RP
153
154uninstall-data:
50e10cbd 155 $(RM) -r "$(DATADIR)"
d3cb93b3
RP
156
157uninstall-man:
50e10cbd 158 $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
bde51e6a 159
250dd6f0 160testclean:
50e10cbd
MR
161 $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
162 $(RM) $(addprefix tests/,$(CLEANSUFFIXES))
163 $(RM) tests/seek_test$(EXESUF) tests/seek_test.o
3d157bf3 164 $(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF))
250dd6f0
FC
165
166clean:: testclean
50e10cbd
MR
167 $(RM) $(ALLPROGS) $(ALLPROGS_G)
168 $(RM) $(CLEANSUFFIXES)
169 $(RM) doc/*.html doc/*.pod doc/*.1
170 $(RM) $(TOOLS)
40321376 171 $(RM) $(CLEANSUFFIXES:%=tools/%)
bde51e6a
JR
172
173distclean::
50e10cbd
MR
174 $(RM) $(DISTCLEANSUFFIXES)
175 $(RM) version.h config.* libavutil/avconfig.h
bde51e6a 176
9d0b3042 177config:
0c3b2d65
MR
178 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
179
bde51e6a
JR
180# regression tests
181
5bab8536
DB
182check: test checkheaders
183
b3dce4b9 184fulltest test: codectest lavftest lavfitest seektest
bde51e6a 185
bde51e6a 186FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
bde51e6a
JR
187SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
188
57f09630
MR
189codectest: fate-codec
190lavftest: fate-lavf
191lavfitest: fate-lavfi
192seektest: fate-seek
40e02409 193
9770a7ad
MR
194AREF = tests/data/acodec.ref.wav
195VREF = tests/data/vsynth1.ref.yuv
196REFS = $(AREF) $(VREF)
197
57f09630 198$(REFS): TAG = GEN
bde51e6a 199
9be24c60 200$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
57f09630
MR
201 $(M)$(SRC_PATH)/tests/codec-regression.sh vref vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
202 $(Q)$(SRC_PATH)/tests/codec-regression.sh vref vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 203
9be24c60 204$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
57f09630 205 $(M)$(SRC_PATH)/tests/codec-regression.sh aref acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 206
d7167f05 207ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
bde51e6a
JR
208 @echo
209 @echo "Unfortunately ffserver is broken and therefore its regression"
210 @echo "test fails randomly. Treat the results accordingly."
211 @echo
767e14c3 212 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
bde51e6a 213
82bb3329 214tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
4ab20de6
MR
215 @mkdir -p tests/vsynth1
216 $(M)$(BUILD_ROOT)/$< 'tests/vsynth1/'
bde51e6a 217
82bb3329 218tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
4ab20de6
MR
219 @mkdir -p tests/vsynth2
220 $(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
bde51e6a 221
d7167f05 222tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
4ab20de6
MR
223 @mkdir -p tests/data
224 $(M)$(BUILD_ROOT)/$< $@
225
226tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
bde51e6a 227
684b28e0
MR
228tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
229 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
bde51e6a 230
43d2c6a5
SS
231tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS)
232 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
233
2fad0977 234include $(SRC_PATH_BARE)/tests/fate.mak
7e264ca1
MR
235include $(SRC_PATH_BARE)/tests/fate2.mak
236
4c3fbd4f
MR
237include $(SRC_PATH_BARE)/tests/fate/aac.mak
238include $(SRC_PATH_BARE)/tests/fate/als.mak
239include $(SRC_PATH_BARE)/tests/fate/fft.mak
240include $(SRC_PATH_BARE)/tests/fate/h264.mak
680aefa2 241include $(SRC_PATH_BARE)/tests/fate/mp3.mak
4c3fbd4f
MR
242include $(SRC_PATH_BARE)/tests/fate/vorbis.mak
243include $(SRC_PATH_BARE)/tests/fate/vp8.mak
244
57f09630
MR
245FATE_ACODEC = $(ACODEC_TESTS:%=fate-acodec-%)
246FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%)
247FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%)
9a3f31ef 248FATE_VCODEC = $(FATE_VSYNTH1) $(FATE_VSYNTH2)
57f09630
MR
249FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%)
250FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%)
9a3f31ef
MR
251FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%)
252
253FATE = $(FATE_ACODEC) \
254 $(FATE_VCODEC) \
255 $(FATE_LAVF) \
256 $(FATE_LAVFI) \
257 $(FATE_SEEK) \
258
259$(FATE_ACODEC): $(AREF)
260$(FATE_VCODEC): $(VREF)
261$(FATE_LAVF): $(REFS)
43d2c6a5 262$(FATE_LAVFI): $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
9a3f31ef
MR
263$(FATE_SEEK): fate-codec fate-lavf tests/seek_test$(EXESUF)
264
265$(FATE_ACODEC): CMD = codectest acodec
266$(FATE_VSYNTH1): CMD = codectest vsynth1
267$(FATE_VSYNTH2): CMD = codectest vsynth2
268$(FATE_LAVF): CMD = lavftest
269$(FATE_LAVFI): CMD = lavfitest
270$(FATE_SEEK): CMD = seektest
271
272fate-codec: fate-acodec fate-vcodec
273fate-acodec: $(FATE_ACODEC)
274fate-vcodec: $(FATE_VCODEC)
275fate-lavf: $(FATE_LAVF)
276fate-lavfi: $(FATE_LAVFI)
277fate-seek: $(FATE_SEEK)
278
666d7d18 279ifdef SAMPLES
9a3f31ef 280FATE += $(FATE_TESTS)
2fad0977 281else
715e9be2 282$(FATE_TESTS):
2fad0977
MR
283 @echo "SAMPLES not specified, cannot run FATE"
284endif
bde51e6a 285
b82be636
MR
286FATE_UTILS = base64 tiny_psnr
287
9a3f31ef 288fate: $(FATE)
9a3f31ef 289
b82be636 290$(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
f6ae77d4 291 @echo "TEST $(@:fate-%=%)"
9a3f31ef
MR
292 $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)'
293
d29d9ccc
MR
294fate-list:
295 @printf '%s\n' $(sort $(FATE))
296
34ae2d90 297.PHONY: documentation *test regtest-* alltools check config