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