Fix swscale-error vs. swscale_error typo; it is marked as the former in .PHONY.
[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
23FFLIBS-$(CONFIG_SWSCALE) += swscale
24
25FFLIBS := avdevice avformat avcodec avutil
26
a1a84f69
RS
27DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
28
bde51e6a
JR
29include common.mak
30
31FF_LDFLAGS := $(FFLDFLAGS)
32FF_EXTRALIBS := $(FFEXTRALIBS)
33FF_DEP_LIBS := $(DEP_LIBS)
34
35ALL_TARGETS-$(CONFIG_VHOOK) += videohook
36ALL_TARGETS-$(BUILD_DOC) += documentation
37
38INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
39ifneq ($(PROGS),)
a1a84f69 40INSTALL_TARGETS-yes += install-progs install-data
bde51e6a
JR
41INSTALL_TARGETS-$(BUILD_DOC) += install-man
42endif
43INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
44
45all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
46
47$(PROGS): %$(EXESUF): %_g$(EXESUF)
48 cp -p $< $@
49 $(STRIP) $@
50
c87348a9 51SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTS
bde51e6a
JR
52
53define RESET
54$(1) :=
55$(1)-yes :=
56endef
57
58define DOSUBDIR
59$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
60SUBDIR := $(1)/
61include $(1)/Makefile
62endef
63
64$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
65
66ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
67ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
68
69%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
70 $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
71
72output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
73 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
74
75tools/%$(EXESUF): tools/%.c
76 $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
77
78ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
79
36798f1b
MR
80cmdutils.o cmdutils.d: version.h
81
9bce82fa
DB
82alltools: $(addsuffix $(EXESUF),$(addprefix tools/, cws2fws pktdumper qt-faststart trasher))
83
bde51e6a
JR
84VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
85
86BASEHOOKS = fish null watermark
87ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
88ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
89
90HOOKS-$(HAVE_FORK) += ppm
91HOOKS-$(HAVE_IMLIB2) += imlib2
92HOOKS-$(HAVE_FREETYPE2) += drawtext
93
94HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
95
96VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
97LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
98
99VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
100LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
101
102VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
103
104vhook/%.o vhook/%.d: CFLAGS:=$(VHOOKCFLAGS)
105
106# vhooks compile fine without libav*, but need them nonetheless.
107videohook: $(FF_DEP_LIBS) $(HOOKS)
108
109$(eval VHOOKSHFLAGS=$(VHOOKSHFLAGS))
110vhook/%$(SLIBSUF): vhook/%.o
111 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
112
113VHOOK_DEPS = $(HOOKS:$(SLIBSUF)=.d)
114depend dep: $(VHOOK_DEPS)
115
116documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
117 ffplay-doc.html general.html hooks.html \
118 $(ALLMANPAGES))
119
120doc/%.html: doc/%.texi
121 texi2html -monolithic -number $<
122 mv $(@F) $@
123
124doc/%.pod: doc/%-doc.texi
125 doc/texi2pod.pl $< $@
126
127doc/%.1: doc/%.pod
128 pod2man --section=1 --center=" " --release=" " $< > $@
129
130install: $(INSTALL_TARGETS-yes)
131
132install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
133 install -d "$(BINDIR)"
134 install -c -m 755 $(PROGS) "$(BINDIR)"
135
a1a84f69
RS
136install-data: $(DATA_FILES)
137 install -d "$(DATADIR)"
138 install -m 644 $(DATA_FILES) "$(DATADIR)"
139
bde51e6a
JR
140install-man: $(MANPAGES)
141 install -d "$(MANDIR)/man1"
142 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
143
144install-vhook: videohook
145 install -d "$(SHLIBDIR)/vhook"
146 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
147
a1a84f69 148uninstall: uninstall-progs uninstall-data uninstall-man uninstall-vhook
bde51e6a
JR
149
150uninstall-progs:
151 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
152
a1a84f69
RS
153uninstall-data:
154 rm -rf "$(DATADIR)"
155
bde51e6a
JR
156uninstall-man:
157 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
158
159uninstall-vhook:
160 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
161 -rmdir "$(SHLIBDIR)/vhook/"
162
250dd6f0
FC
163testclean:
164 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
165
166clean:: testclean
bde51e6a
JR
167 rm -f $(ALLPROGS) $(ALLPROGS_G) output_example$(EXESUF)
168 rm -f doc/*.html doc/*.pod doc/*.1
bde51e6a
JR
169 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
170 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
171 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
172
173distclean::
174 rm -f version.h config.* vhook/*.d
175
176# regression tests
177
5bab8536
DB
178check: test checkheaders
179
bde51e6a
JR
180fulltest test: codectest libavtest seektest
181
182FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
183FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
184LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
185ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
186SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
187
188CODEC_TESTS = $(addprefix regtest-, \
189 mpeg \
190 mpeg2 \
191 mpeg2thread \
192 msmpeg4v2 \
193 msmpeg4 \
194 wmv1 \
195 wmv2 \
196 h261 \
197 h263 \
198 h263p \
199 mpeg4 \
200 huffyuv \
201 rc \
202 mpeg4adv \
203 mpeg4thread \
204 error \
205 mpeg4nr \
206 mpeg1b \
207 mjpeg \
208 ljpeg \
209 jpegls \
210 rv10 \
211 rv20 \
212 asv1 \
213 asv2 \
214 flv \
215 ffv1 \
216 snow \
217 snowll \
218 dv \
219 dv50 \
220 svq1 \
221 flashsv \
222 mp2 \
223 ac3 \
224 g726 \
225 adpcm_ima_wav \
226 adpcm_ima_qt \
227 adpcm_ms \
228 adpcm_yam \
229 adpcm_swf \
230 flac \
231 wma \
232 pcm \
233 )
234
235LAVF_TESTS = $(addprefix regtest-, \
236 avi \
237 asf \
238 rm \
239 mpg \
240 ts \
241 swf \
242 ffm \
243 flv_fmt \
244 mov \
245 dv_fmt \
246 gxf \
247 nut \
248 mkv \
249 pbmpipe \
250 pgmpipe \
251 ppmpipe \
252 gif \
253 yuv4mpeg \
254 pgm \
255 ppm \
256 bmp \
257 tga \
258 tiff \
259 sgi \
260 jpg \
261 wav \
262 alaw \
263 mulaw \
264 au \
265 mmf \
266 aiff \
267 voc \
268 ogg \
269 pixfmt \
270 )
271
272REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
273
274CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
275CODEC_VSYNTH = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
276
277LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
278
279LAVF_REG = tests/data/lavf.regression
280ROTOZOOM_REG = tests/data/rotozoom.regression
281VSYNTH_REG = tests/data/vsynth.regression
282
3e3c638e 283ifneq ($(CONFIG_SWSCALE),yes)
7ea3880a
DB
284servertest codectest $(CODEC_TESTS) libavtest: swscale-error
285swscale-error:
bde51e6a 286 @echo
3e3c638e 287 @echo "This regression test requires --enable-swscale."
bde51e6a
JR
288 @echo
289 @exit 1
290endif
291
292codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
293 diff -u -w $(FFMPEG_REFFILE) $(VSYNTH_REG)
294 diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
295
296libavtest: $(LAVF_REG)
297 diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
298
299$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
300 cat $^ > $@
301
302$(LAVF_REG): $(LAVF_REGFILES)
303$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
304$(VSYNTH_REG): $(CODEC_VSYNTH)
305
306$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
307
308$(LAVF_REGFILES): $(LAVF_TESTS)
309
310$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
311
312regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
313
314$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
9a5771e9
MR
315 $(SRC_PATH)/tests/regression.sh $@ vsynth tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
316 $(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a
JR
317
318$(LAVF_TESTS):
9a5771e9 319 $(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a
JR
320
321seektest: codectest libavtest tests/seek_test$(EXESUF)
9a5771e9 322 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a
JR
323
324servertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
325 @echo
326 @echo "Unfortunately ffserver is broken and therefore its regression"
327 @echo "test fails randomly. Treat the results accordingly."
328 @echo
329 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
330
331tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
332 mkdir -p tests/vsynth1
333 $(BUILD_ROOT)/$< 'tests/vsynth1/'
334
335tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
336 mkdir -p tests/vsynth2
337 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
338
339tests/asynth1.sw: tests/audiogen$(EXESUF)
340 $(BUILD_ROOT)/$< $@
341
dbad2c29
MR
342tests/%$(EXESUF): tests/%.c
343 $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
bde51e6a
JR
344
345tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
346 $(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
347
348
5bab8536 349.PHONY: lib videohook documentation *test regtest-* swscale-error alltools check
bde51e6a
JR
350
351-include $(VHOOK_DEPS)