Disable MMX for i686 and pentiumpro
[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))
ce3a841d 18HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr base64)
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))
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 \
f89c1402 68 HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS
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
2dfa3054 93 $(CC) $(CPPFLAGS) $(CFLAGS) $(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
dd46b538
SS
113documentation: $(addprefix doc/, developer.html faq.html general.html libavfilter.html \
114 $(ALLHTMLPAGES) $(ALLMANPAGES))
115
116$(HTMLPAGES) $(MANPAGES): doc/fftools-common-opts.texi
bde51e6a 117
1de4cfe6
SS
118doc/ffmpeg.pod doc/ffmpeg-doc.html: doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi
119doc/ffplay.pod doc/ffplay-doc.html: doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi
120doc/ffprobe.pod doc/ffprobe-doc.html: doc/indevs.texi doc/protocols.texi
3275ac6a 121
7732f641 122doc/%.html: TAG = HTML
bde51e6a 123doc/%.html: doc/%.texi
86be2bc3 124 $(M)cd doc && texi2html -monolithic -number $(<:doc/%=%)
bde51e6a 125
7732f641 126doc/%.pod: TAG = POD
bde51e6a 127doc/%.pod: doc/%-doc.texi
86be2bc3 128 $(M)doc/texi2pod.pl $< $@
bde51e6a 129
7732f641 130doc/%.1: TAG = MAN
bde51e6a 131doc/%.1: doc/%.pod
86be2bc3 132 $(M)pod2man --section=1 --center=" " --release=" " $< > $@
bde51e6a
JR
133
134install: $(INSTALL_TARGETS-yes)
135
136install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
63611f31 137 $(Q)mkdir -p "$(BINDIR)"
fd676deb 138 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
bde51e6a 139
a1a84f69 140install-data: $(DATA_FILES)
63611f31 141 $(Q)mkdir -p "$(DATADIR)"
fd676deb 142 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 143
bde51e6a 144install-man: $(MANPAGES)
63611f31 145 $(Q)mkdir -p "$(MANDIR)/man1"
fd676deb 146 $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
bde51e6a 147
d3cb93b3
RP
148uninstall: uninstall-progs uninstall-data uninstall-man
149
150uninstall-progs:
50e10cbd 151 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
d3cb93b3
RP
152
153uninstall-data:
50e10cbd 154 $(RM) -r "$(DATADIR)"
d3cb93b3
RP
155
156uninstall-man:
50e10cbd 157 $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
bde51e6a 158
250dd6f0 159testclean:
50e10cbd
MR
160 $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
161 $(RM) $(addprefix tests/,$(CLEANSUFFIXES))
162 $(RM) tests/seek_test$(EXESUF) tests/seek_test.o
ce3a841d 163 $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr base64))
250dd6f0
FC
164
165clean:: testclean
50e10cbd
MR
166 $(RM) $(ALLPROGS) $(ALLPROGS_G)
167 $(RM) $(CLEANSUFFIXES)
168 $(RM) doc/*.html doc/*.pod doc/*.1
169 $(RM) $(TOOLS)
bde51e6a
JR
170
171distclean::
50e10cbd
MR
172 $(RM) $(DISTCLEANSUFFIXES)
173 $(RM) version.h config.* libavutil/avconfig.h
bde51e6a 174
9d0b3042 175config:
0c3b2d65
MR
176 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
177
bde51e6a
JR
178# regression tests
179
5bab8536
DB
180check: test checkheaders
181
b3dce4b9 182fulltest test: codectest lavftest lavfitest seektest
bde51e6a 183
bde51e6a 184FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
bde51e6a
JR
185SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
186
57f09630
MR
187codectest: fate-codec
188lavftest: fate-lavf
189lavfitest: fate-lavfi
190seektest: fate-seek
40e02409 191
9770a7ad
MR
192AREF = tests/data/acodec.ref.wav
193VREF = tests/data/vsynth1.ref.yuv
194REFS = $(AREF) $(VREF)
195
57f09630 196$(REFS): TAG = GEN
bde51e6a 197
9be24c60 198$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
57f09630
MR
199 $(M)$(SRC_PATH)/tests/codec-regression.sh vref vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
200 $(Q)$(SRC_PATH)/tests/codec-regression.sh vref vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 201
9be24c60 202$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
57f09630 203 $(M)$(SRC_PATH)/tests/codec-regression.sh aref acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 204
d7167f05 205ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
bde51e6a
JR
206 @echo
207 @echo "Unfortunately ffserver is broken and therefore its regression"
208 @echo "test fails randomly. Treat the results accordingly."
209 @echo
767e14c3 210 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
bde51e6a 211
82bb3329 212tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
4ab20de6
MR
213 @mkdir -p tests/vsynth1
214 $(M)$(BUILD_ROOT)/$< 'tests/vsynth1/'
bde51e6a 215
82bb3329 216tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
4ab20de6
MR
217 @mkdir -p tests/vsynth2
218 $(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
bde51e6a 219
d7167f05 220tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
4ab20de6
MR
221 @mkdir -p tests/data
222 $(M)$(BUILD_ROOT)/$< $@
223
224tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
bde51e6a 225
684b28e0
MR
226tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
227 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
bde51e6a 228
43d2c6a5
SS
229tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS)
230 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
231
2fad0977 232include $(SRC_PATH_BARE)/tests/fate.mak
7e264ca1
MR
233include $(SRC_PATH_BARE)/tests/fate2.mak
234
4c3fbd4f
MR
235include $(SRC_PATH_BARE)/tests/fate/aac.mak
236include $(SRC_PATH_BARE)/tests/fate/als.mak
237include $(SRC_PATH_BARE)/tests/fate/fft.mak
238include $(SRC_PATH_BARE)/tests/fate/h264.mak
680aefa2 239include $(SRC_PATH_BARE)/tests/fate/mp3.mak
4c3fbd4f
MR
240include $(SRC_PATH_BARE)/tests/fate/vorbis.mak
241include $(SRC_PATH_BARE)/tests/fate/vp8.mak
242
57f09630
MR
243FATE_ACODEC = $(ACODEC_TESTS:%=fate-acodec-%)
244FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%)
245FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%)
9a3f31ef 246FATE_VCODEC = $(FATE_VSYNTH1) $(FATE_VSYNTH2)
57f09630
MR
247FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%)
248FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%)
9a3f31ef
MR
249FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%)
250
251FATE = $(FATE_ACODEC) \
252 $(FATE_VCODEC) \
253 $(FATE_LAVF) \
254 $(FATE_LAVFI) \
255 $(FATE_SEEK) \
256
257$(FATE_ACODEC): $(AREF)
258$(FATE_VCODEC): $(VREF)
259$(FATE_LAVF): $(REFS)
43d2c6a5 260$(FATE_LAVFI): $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
9a3f31ef
MR
261$(FATE_SEEK): fate-codec fate-lavf tests/seek_test$(EXESUF)
262
263$(FATE_ACODEC): CMD = codectest acodec
264$(FATE_VSYNTH1): CMD = codectest vsynth1
265$(FATE_VSYNTH2): CMD = codectest vsynth2
266$(FATE_LAVF): CMD = lavftest
267$(FATE_LAVFI): CMD = lavfitest
268$(FATE_SEEK): CMD = seektest
269
270fate-codec: fate-acodec fate-vcodec
271fate-acodec: $(FATE_ACODEC)
272fate-vcodec: $(FATE_VCODEC)
273fate-lavf: $(FATE_LAVF)
274fate-lavfi: $(FATE_LAVFI)
275fate-seek: $(FATE_SEEK)
276
666d7d18 277ifdef SAMPLES
9a3f31ef 278FATE += $(FATE_TESTS)
2fad0977 279else
715e9be2 280$(FATE_TESTS):
2fad0977
MR
281 @echo "SAMPLES not specified, cannot run FATE"
282endif
bde51e6a 283
b82be636
MR
284FATE_UTILS = base64 tiny_psnr
285
9a3f31ef 286fate: $(FATE)
9a3f31ef 287
b82be636 288$(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
f6ae77d4 289 @echo "TEST $(@:fate-%=%)"
9a3f31ef
MR
290 $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)'
291
34ae2d90 292.PHONY: documentation *test regtest-* alltools check config