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