Use the official FFmpeg spelling: "ffmpeg" -> "FFmpeg".
[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
5a0f7131 23FFLIBS-$(CONFIG_AVDEVICE) += avdevice
bde51e6a 24FFLIBS-$(CONFIG_AVFILTER) += avfilter
5a0f7131 25FFLIBS-$(CONFIG_AVFORMAT) += avformat
97d5fa38 26FFLIBS-$(CONFIG_AVCODEC) += avcodec
bde51e6a 27FFLIBS-$(CONFIG_POSTPROC) += postproc
5a0f7131 28FFLIBS-$(CONFIG_SWSCALE) += swscale
bde51e6a 29
5a0f7131 30FFLIBS := avutil
bde51e6a 31
a1a84f69
RS
32DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
33
bde51e6a
JR
34include common.mak
35
36FF_LDFLAGS := $(FFLDFLAGS)
37FF_EXTRALIBS := $(FFEXTRALIBS)
38FF_DEP_LIBS := $(DEP_LIBS)
39
c73f65d9 40ALL_TARGETS-$(CONFIG_DOC) += documentation
bde51e6a 41
a48289c7 42ifdef PROGS
a1a84f69 43INSTALL_TARGETS-yes += install-progs install-data
c73f65d9 44INSTALL_TARGETS-$(CONFIG_DOC) += install-man
bde51e6a 45endif
bea81a52 46INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
bde51e6a
JR
47
48all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
49
50$(PROGS): %$(EXESUF): %_g$(EXESUF)
51 cp -p $< $@
52 $(STRIP) $@
53
95f2c769 54SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
de4070b5 55 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
aa310a9f 56 HOSTPROGS BUILT_HEADERS
bde51e6a
JR
57
58define RESET
59$(1) :=
60$(1)-yes :=
61endef
62
63define DOSUBDIR
64$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
65SUBDIR := $(1)/
66include $(1)/Makefile
67endef
68
69$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
70
71ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
72ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
73
74%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
684b28e0 75 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
bde51e6a 76
2dfa3054
MR
77tools/%$(EXESUF): tools/%.o
78 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
79
2205da0d 80tools/%.o: tools/%.c
2dfa3054 81 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
bde51e6a
JR
82
83ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
84
36798f1b
MR
85cmdutils.o cmdutils.d: version.h
86
13b1c80b 87alltools: $(TOOLS)
9bce82fa 88
15674f12
DB
89documentation: $(addprefix doc/, developer.html faq.html ffmpeg-doc.html \
90 ffplay-doc.html ffserver-doc.html \
dba755fa 91 general.html libavfilter.html $(ALLMANPAGES))
bde51e6a
JR
92
93doc/%.html: doc/%.texi
94 texi2html -monolithic -number $<
95 mv $(@F) $@
96
97doc/%.pod: doc/%-doc.texi
98 doc/texi2pod.pl $< $@
99
100doc/%.1: doc/%.pod
101 pod2man --section=1 --center=" " --release=" " $< > $@
102
103install: $(INSTALL_TARGETS-yes)
104
105install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
106 install -d "$(BINDIR)"
107 install -c -m 755 $(PROGS) "$(BINDIR)"
108
a1a84f69
RS
109install-data: $(DATA_FILES)
110 install -d "$(DATADIR)"
111 install -m 644 $(DATA_FILES) "$(DATADIR)"
112
bde51e6a
JR
113install-man: $(MANPAGES)
114 install -d "$(MANDIR)/man1"
115 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
116
d3cb93b3
RP
117uninstall: uninstall-progs uninstall-data uninstall-man
118
119uninstall-progs:
120 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
121
122uninstall-data:
123 rm -rf "$(DATADIR)"
124
125uninstall-man:
126 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
bde51e6a 127
250dd6f0 128testclean:
b6fa8e35
MR
129 rm -rf tests/vsynth1 tests/vsynth2 tests/data
130 rm -f $(addprefix tests/,$(CLEANSUFFIXES))
131 rm -f tests/seek_test$(EXESUF) tests/seek_test.o
132 rm -f $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
250dd6f0
FC
133
134clean:: testclean
219a7185 135 rm -f $(ALLPROGS) $(ALLPROGS_G)
2b7a351e 136 rm -f $(CLEANSUFFIXES)
bde51e6a 137 rm -f doc/*.html doc/*.pod doc/*.1
13b1c80b 138 rm -f $(TOOLS)
bde51e6a
JR
139
140distclean::
2b7a351e 141 rm -f $(DISTCLEANSUFFIXES)
2897dc78 142 rm -f version.h config.* libavutil/avconfig.h
bde51e6a 143
0c3b2d65
MR
144config:
145 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
146
bde51e6a
JR
147# regression tests
148
5bab8536
DB
149check: test checkheaders
150
1cde611d 151fulltest test: codectest lavftest seektest
bde51e6a 152
bde51e6a 153FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
bde51e6a
JR
154SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
155
05e24fa8
MR
156ENCDEC = $(and $(CONFIG_$(1)_ENCODER),$(CONFIG_$(1)_DECODER))
157MUXDEM = $(and $(CONFIG_$(1)_MUXER),$(CONFIG_$(or $(2),$(1))_DEMUXER))
158
c676895f
MR
159VCODEC_TESTS =
160VCODEC_TESTS-$(call ENCDEC,ASV1) += asv1
161VCODEC_TESTS-$(call ENCDEC,ASV2) += asv2
162VCODEC_TESTS-$(call ENCDEC,DNXHD) += dnxhd_1080i dnxhd_720p dnxhd_720p_rd
163VCODEC_TESTS-$(call ENCDEC,DVVIDEO) += dv dv50
164VCODEC_TESTS-$(call ENCDEC,FFV1) += ffv1
165VCODEC_TESTS-$(call ENCDEC,FLASHSV) += flashsv
166VCODEC_TESTS-$(call ENCDEC,FLV) += flv
167VCODEC_TESTS-$(call ENCDEC,H261) += h261
168VCODEC_TESTS-$(call ENCDEC,H263) += h263 h263p
169VCODEC_TESTS-$(call ENCDEC,HUFFYUV) += huffyuv
170VCODEC_TESTS-$(call ENCDEC,JPEGLS) += jpegls
171VCODEC_TESTS-$(call ENCDEC,MJPEG) += mjpeg ljpeg
172VCODEC_TESTS-$(call ENCDEC,MPEG1VIDEO) += mpeg mpeg1b
173VCODEC_TESTS-$(call ENCDEC,MPEG2VIDEO) += mpeg2 mpeg2thread
174VCODEC_TESTS-$(call ENCDEC,MPEG4) += mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc
175VCODEC_TESTS-$(call ENCDEC,MSMPEG4V1) += msmpeg4
176VCODEC_TESTS-$(call ENCDEC,MSMPEG4V2) += msmpeg4v2
177VCODEC_TESTS-$(call ENCDEC,ROQ) += roq
178VCODEC_TESTS-$(call ENCDEC,RV10) += rv10
179VCODEC_TESTS-$(call ENCDEC,RV20) += rv20
180VCODEC_TESTS-$(call ENCDEC,SNOW) += snow snowll
181VCODEC_TESTS-$(call ENCDEC,SVQ1) += svq1
182VCODEC_TESTS-$(call ENCDEC,WMV1) += wmv1
183VCODEC_TESTS-$(call ENCDEC,WMV2) += wmv2
184
185ACODEC_TESTS =
186ACODEC_TESTS-$(call ENCDEC,AC3) += ac3
187ACODEC_TESTS-$(call ENCDEC,ADPCM_G726) += g726
188ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_QT) += adpcm_ima_qt
189ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_WAV) += adpcm_ima_wav
190ACODEC_TESTS-$(call ENCDEC,ADPCM_MS) += adpcm_ms
191ACODEC_TESTS-$(call ENCDEC,ADPCM_SWF) += adpcm_swf
192ACODEC_TESTS-$(call ENCDEC,ADPCM_YAMAHA) += adpcm_yam
193ACODEC_TESTS-$(call ENCDEC,ALAC) += alac
194ACODEC_TESTS-$(call ENCDEC,FLAC) += flac
195ACODEC_TESTS-$(call ENCDEC,MP2) += mp2
196ACODEC_TESTS-$(call ENCDEC,PCM_S16LE) += pcm # fixme
197ACODEC_TESTS-$(call ENCDEC,WMAV1) += wmav1
198ACODEC_TESTS-$(call ENCDEC,WMAV1) += wmav2
05e24fa8
MR
199
200LAVF_TESTS =
201LAVF_TESTS-$(call MUXDEM,AIFF) += aiff
202LAVF_TESTS-$(call MUXDEM,PCM_ALAW) += alaw
203LAVF_TESTS-$(call MUXDEM,ASF) += asf
204LAVF_TESTS-$(call MUXDEM,AU) += au
205LAVF_TESTS-$(call MUXDEM,AVI) += avi
206LAVF_TESTS-$(call ENCDEC,BMP) += bmp
207LAVF_TESTS-$(call MUXDEM,DV) += dv_fmt
208LAVF_TESTS-$(call MUXDEM,FFM) += ffm
209LAVF_TESTS-$(call MUXDEM,FLV) += flv_fmt
210LAVF_TESTS-$(call ENCDEC,GIF) += gif
211LAVF_TESTS-$(call MUXDEM,GXF) += gxf
212LAVF_TESTS-$(call ENCDEC,MJPEG) += jpg
213LAVF_TESTS-$(call MUXDEM,MATROSKA) += mkv
214LAVF_TESTS-$(call MUXDEM,MMF) += mmf
215LAVF_TESTS-$(call MUXDEM,MOV) += mov
216LAVF_TESTS-$(call MUXDEM,MPEG1SYSTEM,MPEGPS) += mpg
217LAVF_TESTS-$(call MUXDEM,PCM_MULAW) += mulaw
218LAVF_TESTS-$(call MUXDEM,MXF) += mxf
219LAVF_TESTS-$(call MUXDEM,NUT) += nut
220LAVF_TESTS-$(call MUXDEM,OGG) += ogg
221LAVF_TESTS-$(call ENCDEC,PBM) += pbmpipe
222LAVF_TESTS-$(call ENCDEC,PCX) += pcx
223LAVF_TESTS-$(call ENCDEC,PGM) += pgm pgmpipe
224LAVF_TESTS-$(call MUXDEM,RAWVIDEO) += pixfmt
225LAVF_TESTS-$(call ENCDEC,PPM) += ppm ppmpipe
226LAVF_TESTS-$(call MUXDEM,RM) += rm
227LAVF_TESTS-$(call ENCDEC,SGI) += sgi
228LAVF_TESTS-$(call MUXDEM,SWF) += swf
229LAVF_TESTS-$(call ENCDEC,TARGA) += tga
230LAVF_TESTS-$(call ENCDEC,TIFF) += tiff
231LAVF_TESTS-$(call MUXDEM,MPEGTS) += ts
232LAVF_TESTS-$(call MUXDEM,VOC) += voc
233LAVF_TESTS-$(call MUXDEM,WAV) += wav
234LAVF_TESTS-$(call MUXDEM,YUV4MPEGPIPE) += yuv4mpeg
235
236LAVFI_TESTS =
237
c676895f
MR
238ACODEC_TESTS := $(addprefix regtest-, $(ACODEC_TESTS) $(ACODEC_TESTS-yes))
239VCODEC_TESTS := $(addprefix regtest-, $(VCODEC_TESTS) $(VCODEC_TESTS-yes))
05e24fa8
MR
240LAVF_TESTS := $(addprefix regtest-, $(LAVF_TESTS) $(LAVF_TESTS-yes))
241LAVFI_TESTS := $(addprefix regtest-, $(LAVFI_TESTS) $(LAVFI_TESTS-yes))
20a93972 242
c676895f
MR
243CODEC_TESTS = $(VCODEC_TESTS) $(ACODEC_TESTS)
244
eca478c3
MR
245codectest: $(CODEC_TESTS)
246lavftest: $(LAVF_TESTS)
bde51e6a 247
eca478c3 248# lavfitest: $(LAVFI_TESTS)
40e02409 249
c676895f
MR
250$(ACODEC_TESTS): regtest-aref
251$(VCODEC_TESTS): regtest-vref
252$(LAVF_TESTS) $(LAVFI_TESTS): regtest-ref
bde51e6a 253
eca478c3
MR
254REFFILE = $(SRC_PATH)/tests/ref/$(1)/$(2:regtest-%=%)
255RESFILE = tests/data/$(2:regtest-%=%).$(1).regression
bde51e6a 256
eca478c3
MR
257define CODECTEST_CMD
258 $(SRC_PATH)/tests/codec-regression.sh $@ vsynth1 tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
259 $(SRC_PATH)/tests/codec-regression.sh $@ vsynth2 tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
260endef
bde51e6a 261
c676895f
MR
262regtest-ref: regtest-aref regtest-vref
263
264regtest-vref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
eca478c3 265 $(CODECTEST_CMD)
bde51e6a 266
c676895f
MR
267regtest-aref: ffmpeg$(EXESUF) tests/data/asynth1.sw
268 @$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec a "$(TARGET_EXEC)" "$(TARGET_PATH)"
269
270$(VCODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
271 @echo "TEST VCODEC $(@:regtest-%=%)"
eca478c3
MR
272 @$(CODECTEST_CMD)
273 @diff -u -w $(call REFFILE,vsynth1,$@) $(call RESFILE,vsynth1,$@)
274 @diff -u -w $(call REFFILE,vsynth2,$@) $(call RESFILE,vsynth2,$@)
bde51e6a 275
c676895f
MR
276$(ACODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
277 @echo "TEST ACODEC $(@:regtest-%=%)"
278 @$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec a "$(TARGET_EXEC)" "$(TARGET_PATH)"
279 @diff -u -w $(call REFFILE,acodec,$@) $(call RESFILE,acodec,$@)
280
bde51e6a 281$(LAVF_TESTS):
eca478c3
MR
282 @echo "TEST LAVF $(@:regtest-%=%)"
283 @$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
284 @diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@)
bde51e6a 285
40e02409 286$(LAVFI_TESTS):
eca478c3
MR
287 @echo "TEST LAVFI $(@:regtest-%=%)"
288 @$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
289 @diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@)
40e02409 290
1cde611d 291seektest: codectest lavftest tests/seek_test$(EXESUF)
62cb577e 292 $(SRC_PATH)/tests/seek-regression.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
bde51e6a 293
d7167f05 294ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
bde51e6a
JR
295 @echo
296 @echo "Unfortunately ffserver is broken and therefore its regression"
297 @echo "test fails randomly. Treat the results accordingly."
298 @echo
767e14c3 299 $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
bde51e6a 300
82bb3329 301tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
bde51e6a
JR
302 mkdir -p tests/vsynth1
303 $(BUILD_ROOT)/$< 'tests/vsynth1/'
304
82bb3329 305tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
bde51e6a
JR
306 mkdir -p tests/vsynth2
307 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
308
d7167f05
DB
309tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
310 mkdir -p tests/data
bde51e6a
JR
311 $(BUILD_ROOT)/$< $@
312
684b28e0
MR
313tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
314 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
bde51e6a
JR
315
316
0c3b2d65 317.PHONY: documentation *test regtest-* zlib-error alltools check config