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