Check for VERSION in source dir.
[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
9PROGS-$(CONFIG_FFSERVER) += ffserver
10
00962aba 11PROGS := $(addsuffix $(EXESUF), $(PROGS-yes))
bde51e6a
JR
12PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
13OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
14MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
94f3c0e5 15TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
de4070b5 16HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
bde51e6a
JR
17
18BASENAMES = ffmpeg ffplay ffserver
19ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
20ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
21ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
22
23FFLIBS-$(CONFIG_AVFILTER) += avfilter
24FFLIBS-$(CONFIG_POSTPROC) += postproc
bde51e6a 25
6d4f53cb 26FFLIBS := avdevice avformat avcodec avutil swscale
bde51e6a 27
a1a84f69
RS
28DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
29
bde51e6a
JR
30include common.mak
31
32FF_LDFLAGS := $(FFLDFLAGS)
33FF_EXTRALIBS := $(FFEXTRALIBS)
34FF_DEP_LIBS := $(DEP_LIBS)
35
c73f65d9 36ALL_TARGETS-$(CONFIG_DOC) += documentation
bde51e6a 37
a48289c7 38ifdef PROGS
a1a84f69 39INSTALL_TARGETS-yes += install-progs install-data
c73f65d9 40INSTALL_TARGETS-$(CONFIG_DOC) += install-man
bde51e6a 41endif
bea81a52 42INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
bde51e6a
JR
43
44all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
45
46$(PROGS): %$(EXESUF): %_g$(EXESUF)
47 cp -p $< $@
48 $(STRIP) $@
49
95f2c769 50SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
de4070b5
MR
51 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
52 HOSTPROGS
bde51e6a
JR
53
54define RESET
55$(1) :=
56$(1)-yes :=
57endef
58
59define DOSUBDIR
60$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
61SUBDIR := $(1)/
62include $(1)/Makefile
63endef
64
65$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
66
67ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
68ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
69
70%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
684b28e0 71 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
bde51e6a 72
2dfa3054
MR
73tools/%$(EXESUF): tools/%.o
74 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
75
2205da0d 76tools/%.o: tools/%.c
2dfa3054 77 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
bde51e6a
JR
78
79ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
80
36798f1b
MR
81cmdutils.o cmdutils.d: version.h
82
13b1c80b 83alltools: $(TOOLS)
9bce82fa 84
15674f12
DB
85documentation: $(addprefix doc/, developer.html faq.html ffmpeg-doc.html \
86 ffplay-doc.html ffserver-doc.html \
dba755fa 87 general.html libavfilter.html $(ALLMANPAGES))
bde51e6a
JR
88
89doc/%.html: doc/%.texi
90 texi2html -monolithic -number $<
91 mv $(@F) $@
92
93doc/%.pod: doc/%-doc.texi
94 doc/texi2pod.pl $< $@
95
96doc/%.1: doc/%.pod
97 pod2man --section=1 --center=" " --release=" " $< > $@
98
99install: $(INSTALL_TARGETS-yes)
100
101install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
102 install -d "$(BINDIR)"
103 install -c -m 755 $(PROGS) "$(BINDIR)"
104
a1a84f69
RS
105install-data: $(DATA_FILES)
106 install -d "$(DATADIR)"
107 install -m 644 $(DATA_FILES) "$(DATADIR)"
108
bde51e6a
JR
109install-man: $(MANPAGES)
110 install -d "$(MANDIR)/man1"
111 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
112
fdf11906 113uninstall: uninstall-progs uninstall-data uninstall-man
bde51e6a
JR
114
115uninstall-progs:
116 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
117
a1a84f69
RS
118uninstall-data:
119 rm -rf "$(DATADIR)"
120
bde51e6a
JR
121uninstall-man:
122 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
123
250dd6f0 124testclean:
d7167f05 125 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/*~
250dd6f0
FC
126
127clean:: testclean
219a7185 128 rm -f $(ALLPROGS) $(ALLPROGS_G)
2b7a351e 129 rm -f $(CLEANSUFFIXES)
bde51e6a 130 rm -f doc/*.html doc/*.pod doc/*.1
4e67aedd 131 rm -f tests/seek_test$(EXESUF) tests/seek_test.o
82bb3329 132 rm -f $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
13b1c80b 133 rm -f $(TOOLS)
bde51e6a
JR
134
135distclean::
2b7a351e 136 rm -f $(DISTCLEANSUFFIXES)
fdf11906 137 rm -f version.h config.*
bde51e6a 138
0c3b2d65
MR
139config:
140 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
141
bde51e6a
JR
142# regression tests
143
5bab8536
DB
144check: test checkheaders
145
1cde611d 146fulltest test: codectest lavftest seektest
bde51e6a 147
bde51e6a 148FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
f1f66d3a 149LAVF_REFFILE = $(SRC_PATH)/tests/lavf.regression.ref
40e02409 150LAVFI_REFFILE = $(SRC_PATH)/tests/lavfi.regression.ref
bde51e6a
JR
151ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
152SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
97668ac7 153VSYNTH_REFFILE = $(SRC_PATH)/tests/vsynth.regression.ref
bde51e6a
JR
154
155CODEC_TESTS = $(addprefix regtest-, \
156 mpeg \
157 mpeg2 \
158 mpeg2thread \
159 msmpeg4v2 \
160 msmpeg4 \
161 wmv1 \
162 wmv2 \
163 h261 \
164 h263 \
165 h263p \
166 mpeg4 \
167 huffyuv \
168 rc \
169 mpeg4adv \
170 mpeg4thread \
171 error \
172 mpeg4nr \
173 mpeg1b \
174 mjpeg \
175 ljpeg \
176 jpegls \
177 rv10 \
178 rv20 \
179 asv1 \
180 asv2 \
181 flv \
182 ffv1 \
183 snow \
184 snowll \
185 dv \
186 dv50 \
96fdb624
MR
187 dnxhd_1080i \
188 dnxhd_720p \
189 dnxhd_720p_rd \
bde51e6a
JR
190 svq1 \
191 flashsv \
ae5e8caa 192 roq \
bde51e6a
JR
193 mp2 \
194 ac3 \
195 g726 \
196 adpcm_ima_wav \
197 adpcm_ima_qt \
198 adpcm_ms \
199 adpcm_yam \
200 adpcm_swf \
9797ce58 201 alac \
bde51e6a
JR
202 flac \
203 wma \
204 pcm \
205 )
206
207LAVF_TESTS = $(addprefix regtest-, \
208 avi \
209 asf \
210 rm \
211 mpg \
b686d0ab 212 mxf \
bde51e6a
JR
213 ts \
214 swf \
215 ffm \
216 flv_fmt \
217 mov \
218 dv_fmt \
219 gxf \
220 nut \
221 mkv \
222 pbmpipe \
223 pgmpipe \
224 ppmpipe \
225 gif \
226 yuv4mpeg \
227 pgm \
228 ppm \
229 bmp \
230 tga \
231 tiff \
232 sgi \
233 jpg \
234 wav \
235 alaw \
236 mulaw \
237 au \
238 mmf \
239 aiff \
240 voc \
241 ogg \
242 pixfmt \
effcedf7 243 pcx \
bde51e6a
JR
244 )
245
40e02409
SS
246LAVFI_TESTS = $(addprefix regtest-, \
247 )
248
2795e357 249RESFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
bde51e6a 250
2795e357
SS
251ROTOZOOM_RESFILES = $(call RESFILES,rotozoom.regression,$(CODEC_TESTS))
252VSYNTH_RESFILES = $(call RESFILES,vsynth.regression,$(CODEC_TESTS))
bde51e6a 253
2795e357 254LAVF_RESFILES = $(call RESFILES,lavf.regression,$(LAVF_TESTS))
40e02409 255LAVFI_RESFILES = $(call RESFILES,lavfi.regression,$(LAVFI_TESTS))
bde51e6a 256
2795e357 257LAVF_RESFILE = tests/data/lavf.regression
40e02409 258LAVFI_RESFILE = tests/data/lavfi.regression
2795e357
SS
259ROTOZOOM_RESFILE = tests/data/rotozoom.regression
260VSYNTH_RESFILE = tests/data/vsynth.regression
bde51e6a 261
20a93972
DB
262ifneq ($(CONFIG_ZLIB),yes)
263regtest-flashsv codectest: zlib-error
264endif
265zlib-error:
266 @echo
267 @echo "This regression test requires zlib."
268 @echo
269 @exit 1
270
2795e357
SS
271codectest: $(VSYNTH_RESFILE) $(ROTOZOOM_RESFILE)
272 diff -u -w $(VSYNTH_REFFILE) $(VSYNTH_RESFILE)
273 diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_RESFILE)
bde51e6a 274
2795e357
SS
275lavftest: $(LAVF_RESFILE)
276 diff -u -w $(LAVF_REFFILE) $(LAVF_RESFILE)
bde51e6a 277
40e02409
SS
278# lavfitest: $(LAVFI_RESFILE)
279# diff -u -w $(LAVFI_REFFILE) $(LAVFI_RESFILE)
280
281$(VSYNTH_RESFILE) $(ROTOZOOM_RESFILE) $(LAVF_RESFILE) $(LAVFI_RESFILE):
bde51e6a
JR
282 cat $^ > $@
283
2795e357 284$(LAVF_RESFILE): $(LAVF_RESFILES)
40e02409 285$(LAVFI_RESFILE): $(LAVFI_RESFILES)
2795e357
SS
286$(ROTOZOOM_RESFILE): $(ROTOZOOM_RESFILES)
287$(VSYNTH_RESFILE): $(VSYNTH_RESFILES)
bde51e6a 288
2795e357 289$(VSYNTH_RESFILES) $(ROTOZOOM_RESFILES): $(CODEC_TESTS)
bde51e6a 290
2795e357 291$(LAVF_RESFILES): $(LAVF_TESTS)
40e02409 292$(LAVFI_RESFILES): $(LAVFI_TESTS)
bde51e6a 293
40e02409 294$(CODEC_TESTS) $(LAVF_TESTS) $(LAVFI_TESTS): regtest-ref
bde51e6a 295
d7167f05 296regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/data/asynth1.sw
bde51e6a 297
82bb3329 298$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(HOSTEXESUF)
6117ffbe
DB
299 $(SRC_PATH)/tests/codec-regression.sh $@ vsynth tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
300 $(SRC_PATH)/tests/codec-regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a
JR
301
302$(LAVF_TESTS):
8f1e4d4f 303 $(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 304
40e02409 305$(LAVFI_TESTS):
77f66963 306 $(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
40e02409 307
1cde611d 308seektest: codectest lavftest tests/seek_test$(EXESUF)
62cb577e 309 $(SRC_PATH)/tests/seek-regression.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 310
d7167f05 311ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
bde51e6a
JR
312 @echo
313 @echo "Unfortunately ffserver is broken and therefore its regression"
314 @echo "test fails randomly. Treat the results accordingly."
315 @echo
767e14c3 316 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
bde51e6a 317
82bb3329 318tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
bde51e6a
JR
319 mkdir -p tests/vsynth1
320 $(BUILD_ROOT)/$< 'tests/vsynth1/'
321
82bb3329 322tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
bde51e6a
JR
323 mkdir -p tests/vsynth2
324 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
325
d7167f05
DB
326tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
327 mkdir -p tests/data
bde51e6a
JR
328 $(BUILD_ROOT)/$< $@
329
684b28e0
MR
330tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
331 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
bde51e6a
JR
332
333
0c3b2d65 334.PHONY: documentation *test regtest-* zlib-error alltools check config