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