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