swscale-test: allocate more memory to prevent scalers from writing out of bounds
[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
00962aba 12PROGS := $(addsuffix $(EXESUF), $(PROGS-yes))
bde51e6a
JR
13PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
14OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
15MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
dd46b538 16HTMLPAGES = $(addprefix doc/, $(addsuffix -doc.html, $(PROGS-yes)))
94f3c0e5 17TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
de4070b5 18HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
bde51e6a 19
336ce917 20BASENAMES = ffmpeg ffplay ffprobe ffserver
bde51e6a
JR
21ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
22ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
23ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
dd46b538 24ALLHTMLPAGES= $(addsuffix -doc.html, $(BASENAMES))
bde51e6a 25
5a0f7131 26FFLIBS-$(CONFIG_AVDEVICE) += avdevice
bde51e6a 27FFLIBS-$(CONFIG_AVFILTER) += avfilter
5a0f7131 28FFLIBS-$(CONFIG_AVFORMAT) += avformat
97d5fa38 29FFLIBS-$(CONFIG_AVCODEC) += avcodec
bde51e6a 30FFLIBS-$(CONFIG_POSTPROC) += postproc
5a0f7131 31FFLIBS-$(CONFIG_SWSCALE) += swscale
aac6ca69 32FFLIBS-$(CONFIG_AVCORE) += avcore
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))
62
95f2c769 63SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
de4070b5 64 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
f89c1402 65 HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS
bde51e6a
JR
66
67define RESET
68$(1) :=
69$(1)-yes :=
70endef
71
72define DOSUBDIR
73$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
74SUBDIR := $(1)/
75include $(1)/Makefile
76endef
77
78$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
79
80ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
81ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
82
83%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
684b28e0 84 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
bde51e6a 85
2dfa3054
MR
86tools/%$(EXESUF): tools/%.o
87 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
88
2205da0d 89tools/%.o: tools/%.c
2dfa3054 90 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
bde51e6a
JR
91
92ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
93
6a53fffd 94VERSION_SH = $(SRC_PATH_BARE)/version.sh
f82bf850 95GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD
6a53fffd
MR
96SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
97
f82bf850 98.version: $(wildcard $(GIT_LOG) $(SVN_ENTRIES)) $(VERSION_SH) config.mak
6a53fffd
MR
99.version: M=@
100
101version.h .version:
0853a2b4 102 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
6a53fffd
MR
103 $(Q)touch .version
104
105# force version.sh to run whenever version might have changed
106-include .version
36798f1b 107
13b1c80b 108alltools: $(TOOLS)
9bce82fa 109
dd46b538
SS
110documentation: $(addprefix doc/, developer.html faq.html general.html libavfilter.html \
111 $(ALLHTMLPAGES) $(ALLMANPAGES))
112
113$(HTMLPAGES) $(MANPAGES): doc/fftools-common-opts.texi
bde51e6a 114
3275ac6a
SS
115doc/ffmpeg.pod doc/ffmpeg-doc.html: doc/filters.texi
116doc/ffplay.pod doc/ffplay-doc.html: doc/filters.texi
117
7732f641 118doc/%.html: TAG = HTML
bde51e6a 119doc/%.html: doc/%.texi
86be2bc3 120 $(M)cd doc && texi2html -monolithic -number $(<:doc/%=%)
bde51e6a 121
7732f641 122doc/%.pod: TAG = POD
bde51e6a 123doc/%.pod: doc/%-doc.texi
86be2bc3 124 $(M)doc/texi2pod.pl $< $@
bde51e6a 125
7732f641 126doc/%.1: TAG = MAN
bde51e6a 127doc/%.1: doc/%.pod
86be2bc3 128 $(M)pod2man --section=1 --center=" " --release=" " $< > $@
bde51e6a
JR
129
130install: $(INSTALL_TARGETS-yes)
131
132install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
63611f31 133 $(Q)mkdir -p "$(BINDIR)"
fd676deb 134 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
bde51e6a 135
a1a84f69 136install-data: $(DATA_FILES)
63611f31 137 $(Q)mkdir -p "$(DATADIR)"
fd676deb 138 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 139
bde51e6a 140install-man: $(MANPAGES)
63611f31 141 $(Q)mkdir -p "$(MANDIR)/man1"
fd676deb 142 $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
bde51e6a 143
d3cb93b3
RP
144uninstall: uninstall-progs uninstall-data uninstall-man
145
146uninstall-progs:
50e10cbd 147 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
d3cb93b3
RP
148
149uninstall-data:
50e10cbd 150 $(RM) -r "$(DATADIR)"
d3cb93b3
RP
151
152uninstall-man:
50e10cbd 153 $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
bde51e6a 154
250dd6f0 155testclean:
50e10cbd
MR
156 $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
157 $(RM) $(addprefix tests/,$(CLEANSUFFIXES))
158 $(RM) tests/seek_test$(EXESUF) tests/seek_test.o
159 $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
250dd6f0
FC
160
161clean:: testclean
50e10cbd
MR
162 $(RM) $(ALLPROGS) $(ALLPROGS_G)
163 $(RM) $(CLEANSUFFIXES)
164 $(RM) doc/*.html doc/*.pod doc/*.1
165 $(RM) $(TOOLS)
bde51e6a
JR
166
167distclean::
50e10cbd
MR
168 $(RM) $(DISTCLEANSUFFIXES)
169 $(RM) version.h config.* libavutil/avconfig.h
bde51e6a 170
86601915 171config .config:
0c3b2d65 172 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
86601915 173 @touch .config
0c3b2d65 174
bde51e6a
JR
175# regression tests
176
5bab8536
DB
177check: test checkheaders
178
b3dce4b9 179fulltest test: codectest lavftest lavfitest seektest
bde51e6a 180
bde51e6a 181FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
bde51e6a
JR
182SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
183
57f09630
MR
184codectest: fate-codec
185lavftest: fate-lavf
186lavfitest: fate-lavfi
187seektest: fate-seek
40e02409 188
9770a7ad
MR
189AREF = tests/data/acodec.ref.wav
190VREF = tests/data/vsynth1.ref.yuv
191REFS = $(AREF) $(VREF)
192
57f09630 193$(REFS): TAG = GEN
bde51e6a 194
9be24c60 195$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
57f09630
MR
196 $(M)$(SRC_PATH)/tests/codec-regression.sh vref vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
197 $(Q)$(SRC_PATH)/tests/codec-regression.sh vref vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 198
9be24c60 199$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
57f09630 200 $(M)$(SRC_PATH)/tests/codec-regression.sh aref acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 201
d7167f05 202ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
bde51e6a
JR
203 @echo
204 @echo "Unfortunately ffserver is broken and therefore its regression"
205 @echo "test fails randomly. Treat the results accordingly."
206 @echo
767e14c3 207 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
bde51e6a 208
82bb3329 209tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
4ab20de6
MR
210 @mkdir -p tests/vsynth1
211 $(M)$(BUILD_ROOT)/$< 'tests/vsynth1/'
bde51e6a 212
82bb3329 213tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
4ab20de6
MR
214 @mkdir -p tests/vsynth2
215 $(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
bde51e6a 216
d7167f05 217tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
4ab20de6
MR
218 @mkdir -p tests/data
219 $(M)$(BUILD_ROOT)/$< $@
220
221tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
bde51e6a 222
684b28e0
MR
223tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
224 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
bde51e6a 225
2fad0977 226include $(SRC_PATH_BARE)/tests/fate.mak
7e264ca1
MR
227include $(SRC_PATH_BARE)/tests/fate2.mak
228
229FATE_TESTS += $(FATE2_TESTS)
666d7d18 230
57f09630
MR
231FATE_ACODEC = $(ACODEC_TESTS:%=fate-acodec-%)
232FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%)
233FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%)
9a3f31ef 234FATE_VCODEC = $(FATE_VSYNTH1) $(FATE_VSYNTH2)
57f09630
MR
235FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%)
236FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%)
9a3f31ef
MR
237FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%)
238
239FATE = $(FATE_ACODEC) \
240 $(FATE_VCODEC) \
241 $(FATE_LAVF) \
242 $(FATE_LAVFI) \
243 $(FATE_SEEK) \
244
245$(FATE_ACODEC): $(AREF)
246$(FATE_VCODEC): $(VREF)
247$(FATE_LAVF): $(REFS)
248$(FATE_LAVFI): $(REFS)
249$(FATE_SEEK): fate-codec fate-lavf tests/seek_test$(EXESUF)
250
251$(FATE_ACODEC): CMD = codectest acodec
252$(FATE_VSYNTH1): CMD = codectest vsynth1
253$(FATE_VSYNTH2): CMD = codectest vsynth2
254$(FATE_LAVF): CMD = lavftest
255$(FATE_LAVFI): CMD = lavfitest
256$(FATE_SEEK): CMD = seektest
257
258fate-codec: fate-acodec fate-vcodec
259fate-acodec: $(FATE_ACODEC)
260fate-vcodec: $(FATE_VCODEC)
261fate-lavf: $(FATE_LAVF)
262fate-lavfi: $(FATE_LAVFI)
263fate-seek: $(FATE_SEEK)
264
666d7d18 265ifdef SAMPLES
9a3f31ef 266FATE += $(FATE_TESTS)
2fad0977 267else
9a3f31ef 268fate2 $(FATE_TESTS):
2fad0977
MR
269 @echo "SAMPLES not specified, cannot run FATE"
270endif
bde51e6a 271
9a3f31ef
MR
272fate: $(FATE)
273fate2: $(FATE2_TESTS)
274
275$(FATE): ffmpeg$(EXESUF) tests/tiny_psnr$(HOSTEXESUF)
f6ae77d4 276 @echo "TEST $(@:fate-%=%)"
9a3f31ef
MR
277 $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)'
278
34ae2d90 279.PHONY: documentation *test regtest-* alltools check config