fix rgb444 support in avi.
[ffmpeg.git] / Makefile
1 include config.mak
2
3 SRC_DIR = $(SRC_PATH_BARE)
4
5 vpath %.texi $(SRC_PATH_BARE)
6
7 PROGS-$(CONFIG_FFMPEG)   += ffmpeg
8 PROGS-$(CONFIG_FFPLAY)   += ffplay
9 PROGS-$(CONFIG_FFPROBE)  += ffprobe
10 PROGS-$(CONFIG_FFSERVER) += ffserver
11
12 PROGS      := $(addsuffix   $(EXESUF), $(PROGS-yes))
13 PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
14 OBJS        = $(addsuffix .o,          $(PROGS-yes)) cmdutils.o
15 MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
16 TOOLS       = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
17 HOSTPROGS   = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
18
19 BASENAMES   = ffmpeg ffplay ffprobe ffserver
20 ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
21 ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
22 ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
23
24 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
25 FFLIBS-$(CONFIG_AVFILTER) += avfilter
26 FFLIBS-$(CONFIG_AVFORMAT) += avformat
27 FFLIBS-$(CONFIG_AVCODEC)  += avcodec
28 FFLIBS-$(CONFIG_POSTPROC) += postproc
29 FFLIBS-$(CONFIG_SWSCALE)  += swscale
30
31 FFLIBS := avutil
32
33 DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
34
35 SKIPHEADERS = cmdutils_common_opts.h
36
37 include common.mak
38
39 FF_LDFLAGS   := $(FFLDFLAGS)
40 FF_EXTRALIBS := $(FFEXTRALIBS)
41 FF_DEP_LIBS  := $(DEP_LIBS)
42
43 ALL_TARGETS-$(CONFIG_DOC)       += documentation
44
45 ifdef PROGS
46 INSTALL_TARGETS-yes             += install-progs install-data
47 INSTALL_TARGETS-$(CONFIG_DOC)   += install-man
48 endif
49 INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
50
51 all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
52
53 $(PROGS): %$(EXESUF): %_g$(EXESUF)
54         $(CP) $< $@
55         $(STRIP) $@
56
57 SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
58                ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
59                HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS
60
61 define RESET
62 $(1) :=
63 $(1)-yes :=
64 endef
65
66 define DOSUBDIR
67 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
68 SUBDIR := $(1)/
69 include $(1)/Makefile
70 endef
71
72 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
73
74 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
75 ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
76
77 %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
78         $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
79
80 tools/%$(EXESUF): tools/%.o
81         $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
82
83 tools/%.o: tools/%.c
84         $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
85
86 ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
87
88 VERSION_SH  = $(SRC_PATH_BARE)/version.sh
89 GIT_LOG     = $(SRC_PATH_BARE)/.git/logs/HEAD
90 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
91
92 .version: $(wildcard $(GIT_LOG) $(SVN_ENTRIES)) $(VERSION_SH) config.mak
93 .version: M=@
94
95 version.h .version:
96         $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
97         $(Q)touch .version
98
99 # force version.sh to run whenever version might have changed
100 -include .version
101
102 alltools: $(TOOLS)
103
104 documentation: $(addprefix doc/, developer.html faq.html ffmpeg-doc.html \
105                                  ffplay-doc.html ffprobe-doc.html ffserver-doc.html \
106                                  general.html libavfilter.html $(ALLMANPAGES))
107
108 doc/%.html: TAG = HTML
109 doc/%.html: doc/%.texi
110         $(M)cd doc && texi2html -monolithic -number $(<:doc/%=%)
111
112 doc/%.pod: TAG = POD
113 doc/%.pod: doc/%-doc.texi
114         $(M)doc/texi2pod.pl $< $@
115
116 doc/%.1: TAG = MAN
117 doc/%.1: doc/%.pod
118         $(M)pod2man --section=1 --center=" " --release=" " $< > $@
119
120 install: $(INSTALL_TARGETS-yes)
121
122 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
123         $(Q)mkdir -p "$(BINDIR)"
124         $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
125
126 install-data: $(DATA_FILES)
127         $(Q)mkdir -p "$(DATADIR)"
128         $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
129
130 install-man: $(MANPAGES)
131         $(Q)mkdir -p "$(MANDIR)/man1"
132         $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
133
134 uninstall: uninstall-progs uninstall-data uninstall-man
135
136 uninstall-progs:
137         $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
138
139 uninstall-data:
140         $(RM) -r "$(DATADIR)"
141
142 uninstall-man:
143         $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
144
145 testclean:
146         $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
147         $(RM) $(addprefix tests/,$(CLEANSUFFIXES))
148         $(RM) tests/seek_test$(EXESUF) tests/seek_test.o
149         $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
150
151 clean:: testclean
152         $(RM) $(ALLPROGS) $(ALLPROGS_G)
153         $(RM) $(CLEANSUFFIXES)
154         $(RM) doc/*.html doc/*.pod doc/*.1
155         $(RM) $(TOOLS)
156
157 distclean::
158         $(RM) $(DISTCLEANSUFFIXES)
159         $(RM) version.h config.* libavutil/avconfig.h
160
161 config:
162         $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
163
164 # regression tests
165
166 check: test checkheaders
167
168 fulltest test: codectest lavftest seektest
169
170 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
171 SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
172
173 ENCDEC = $(and $(CONFIG_$(1)_ENCODER),$(CONFIG_$(1)_DECODER))
174 MUXDEM = $(and $(CONFIG_$(1)_MUXER),$(CONFIG_$(or $(2),$(1))_DEMUXER))
175
176 VCODEC_TESTS =
177 VCODEC_TESTS-$(call ENCDEC,ASV1)             += asv1
178 VCODEC_TESTS-$(call ENCDEC,ASV2)             += asv2
179 VCODEC_TESTS-$(call ENCDEC,DNXHD)            += dnxhd_1080i dnxhd_720p dnxhd_720p_rd
180 VCODEC_TESTS-$(call ENCDEC,DVVIDEO)          += dv dv50
181 VCODEC_TESTS-$(call ENCDEC,FFV1)             += ffv1
182 VCODEC_TESTS-$(call ENCDEC,FLASHSV)          += flashsv
183 VCODEC_TESTS-$(call ENCDEC,FLV)              += flv
184 VCODEC_TESTS-$(call ENCDEC,H261)             += h261
185 VCODEC_TESTS-$(call ENCDEC,H263)             += h263 h263p
186 VCODEC_TESTS-$(call ENCDEC,HUFFYUV)          += huffyuv
187 VCODEC_TESTS-$(call ENCDEC,JPEGLS)           += jpegls
188 VCODEC_TESTS-$(call ENCDEC,MJPEG)            += mjpeg ljpeg
189 VCODEC_TESTS-$(call ENCDEC,MPEG1VIDEO)       += mpeg mpeg1b
190 VCODEC_TESTS-$(call ENCDEC,MPEG2VIDEO)       += mpeg2 mpeg2thread
191 VCODEC_TESTS-$(call ENCDEC,MPEG4)            += mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc
192 VCODEC_TESTS-$(call ENCDEC,MSMPEG4V1)        += msmpeg4
193 VCODEC_TESTS-$(call ENCDEC,MSMPEG4V2)        += msmpeg4v2
194 VCODEC_TESTS-$(call ENCDEC,RAWVIDEO)         += rgb yuv
195 VCODEC_TESTS-$(call ENCDEC,ROQ)              += roq
196 VCODEC_TESTS-$(call ENCDEC,RV10)             += rv10
197 VCODEC_TESTS-$(call ENCDEC,RV20)             += rv20
198 VCODEC_TESTS-$(call ENCDEC,SNOW)             += snow snowll
199 VCODEC_TESTS-$(call ENCDEC,SVQ1)             += svq1
200 VCODEC_TESTS-$(call ENCDEC,WMV1)             += wmv1
201 VCODEC_TESTS-$(call ENCDEC,WMV2)             += wmv2
202
203 ACODEC_TESTS =
204 ACODEC_TESTS-$(call ENCDEC,AC3)              += ac3
205 ACODEC_TESTS-$(call ENCDEC,ADPCM_G726)       += g726
206 ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_QT)     += adpcm_ima_qt
207 ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_WAV)    += adpcm_ima_wav
208 ACODEC_TESTS-$(call ENCDEC,ADPCM_MS)         += adpcm_ms
209 ACODEC_TESTS-$(call ENCDEC,ADPCM_SWF)        += adpcm_swf
210 ACODEC_TESTS-$(call ENCDEC,ADPCM_YAMAHA)     += adpcm_yam
211 ACODEC_TESTS-$(call ENCDEC,ALAC)             += alac
212 ACODEC_TESTS-$(call ENCDEC,FLAC)             += flac
213 ACODEC_TESTS-$(call ENCDEC,MP2)              += mp2
214 ACODEC_TESTS-$(call ENCDEC,PCM_S16LE)        += pcm         # fixme
215 ACODEC_TESTS-$(call ENCDEC,WMAV1)            += wmav1
216 ACODEC_TESTS-$(call ENCDEC,WMAV1)            += wmav2
217
218 LAVF_TESTS =
219 LAVF_TESTS-$(call MUXDEM,AIFF)               += aiff
220 LAVF_TESTS-$(call MUXDEM,PCM_ALAW)           += alaw
221 LAVF_TESTS-$(call MUXDEM,ASF)                += asf
222 LAVF_TESTS-$(call MUXDEM,AU)                 += au
223 LAVF_TESTS-$(call MUXDEM,AVI)                += avi
224 LAVF_TESTS-$(call ENCDEC,BMP)                += bmp
225 LAVF_TESTS-$(call MUXDEM,DV)                 += dv_fmt
226 LAVF_TESTS-$(call MUXDEM,FFM)                += ffm
227 LAVF_TESTS-$(call MUXDEM,FLV)                += flv_fmt
228 LAVF_TESTS-$(call ENCDEC,GIF)                += gif
229 LAVF_TESTS-$(call MUXDEM,GXF)                += gxf
230 LAVF_TESTS-$(call ENCDEC,MJPEG)              += jpg
231 LAVF_TESTS-$(call MUXDEM,MATROSKA)           += mkv
232 LAVF_TESTS-$(call MUXDEM,MMF)                += mmf
233 LAVF_TESTS-$(call MUXDEM,MOV)                += mov
234 LAVF_TESTS-$(call MUXDEM,MPEG1SYSTEM,MPEGPS) += mpg
235 LAVF_TESTS-$(call MUXDEM,PCM_MULAW)          += mulaw
236 LAVF_TESTS-$(call MUXDEM,MXF)                += mxf
237 LAVF_TESTS-$(call MUXDEM,NUT)                += nut
238 LAVF_TESTS-$(call MUXDEM,OGG)                += ogg
239 LAVF_TESTS-$(call ENCDEC,PBM)                += pbmpipe
240 LAVF_TESTS-$(call ENCDEC,PCX)                += pcx
241 LAVF_TESTS-$(call ENCDEC,PGM)                += pgm pgmpipe
242 LAVF_TESTS-$(call MUXDEM,RAWVIDEO)           += pixfmt
243 LAVF_TESTS-$(call ENCDEC,PPM)                += ppm ppmpipe
244 LAVF_TESTS-$(call MUXDEM,RM)                 += rm
245 LAVF_TESTS-$(call ENCDEC,SGI)                += sgi
246 LAVF_TESTS-$(call MUXDEM,SWF)                += swf
247 LAVF_TESTS-$(call ENCDEC,TARGA)              += tga
248 LAVF_TESTS-$(call ENCDEC,TIFF)               += tiff
249 LAVF_TESTS-$(call MUXDEM,MPEGTS)             += ts
250 LAVF_TESTS-$(call MUXDEM,VOC)                += voc
251 LAVF_TESTS-$(call MUXDEM,WAV)                += wav
252 LAVF_TESTS-$(call MUXDEM,YUV4MPEGPIPE)       += yuv4mpeg
253
254 LAVFI_TESTS =           \
255     crop                \
256     crop_scale          \
257     crop_scale_vflip    \
258     crop_vflip          \
259     null                \
260     scale200            \
261     scale500            \
262     vflip               \
263     vflip_crop          \
264     vflip_vflip         \
265 #   lavfi_pix_fmts      \
266
267 ACODEC_TESTS := $(addprefix regtest-, $(ACODEC_TESTS) $(ACODEC_TESTS-yes))
268 VCODEC_TESTS := $(addprefix regtest-, $(VCODEC_TESTS) $(VCODEC_TESTS-yes))
269 LAVF_TESTS  := $(addprefix regtest-, $(LAVF_TESTS)  $(LAVF_TESTS-yes))
270 LAVFI_TESTS := $(addprefix regtest-, $(LAVFI_TESTS) $(LAVFI_TESTS-yes))
271
272 CODEC_TESTS = $(VCODEC_TESTS) $(ACODEC_TESTS)
273
274 codectest: $(CODEC_TESTS)
275 lavftest:  $(LAVF_TESTS)
276 lavfitest: $(LAVFI_TESTS)
277
278 $(ACODEC_TESTS): regtest-aref
279 $(VCODEC_TESTS): regtest-vref
280 $(LAVF_TESTS) $(LAVFI_TESTS): regtest-ref
281
282 REFFILE = $(SRC_PATH)/tests/ref/$(1)/$(2:regtest-%=%)
283 RESFILE = tests/data/$(2:regtest-%=%).$(1).regression
284
285 define CODECTEST_CMD
286         $(SRC_PATH)/tests/codec-regression.sh $@ vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
287         $(SRC_PATH)/tests/codec-regression.sh $@ vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
288 endef
289
290 regtest-ref: regtest-aref regtest-vref
291
292 regtest-vref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
293         $(CODECTEST_CMD)
294
295 regtest-aref: ffmpeg$(EXESUF) tests/data/asynth1.sw
296         @$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
297
298 $(VCODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
299         @echo "TEST VCODEC $(@:regtest-%=%)"
300         @$(CODECTEST_CMD)
301         @diff -u -w $(call REFFILE,vsynth1,$@) $(call RESFILE,vsynth1,$@)
302         @diff -u -w $(call REFFILE,vsynth2,$@) $(call RESFILE,vsynth2,$@)
303
304 $(ACODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
305         @echo "TEST ACODEC $(@:regtest-%=%)"
306         @$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
307         @diff -u -w $(call REFFILE,acodec,$@) $(call RESFILE,acodec,$@)
308
309 $(LAVF_TESTS):
310         @echo "TEST LAVF  $(@:regtest-%=%)"
311         @$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
312         @diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@)
313
314 $(LAVFI_TESTS): tools/lavfi-showfiltfmts$(EXESUF)
315         @echo "TEST LAVFI $(@:regtest-%=%)"
316         @$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
317         @diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@)
318
319 seektest: codectest lavftest tests/seek_test$(EXESUF)
320         $(SRC_PATH)/tests/seek-regression.sh $(SRC_PATH) "$(TARGET_EXEC)" "$(TARGET_PATH)"
321
322 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
323         @echo
324         @echo "Unfortunately ffserver is broken and therefore its regression"
325         @echo "test fails randomly. Treat the results accordingly."
326         @echo
327         $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
328
329 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
330         mkdir -p tests/vsynth1
331         $(BUILD_ROOT)/$< 'tests/vsynth1/'
332
333 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
334         mkdir -p tests/vsynth2
335         $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
336
337 tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
338         mkdir -p tests/data
339         $(BUILD_ROOT)/$< $@
340
341 tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
342         $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
343
344 include $(SRC_PATH_BARE)/tests/fate.mak
345
346 ifdef SAMPLES
347 fate: $(FATE_TESTS)
348 $(FATE_TESTS): ffmpeg$(EXESUF)
349         @echo "TEST FATE   $(@:fate-%=%)"
350         @$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)'
351 else
352 fate $(FATE_TESTS):
353         @echo "SAMPLES not specified, cannot run FATE"
354 endif
355
356 .PHONY: documentation *test regtest-* zlib-error alltools check config