Simplify code in sws_getContext() which logs if the destination format
[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_FFSERVER) += ffserver
10
11 PROGS      := $(addsuffix   $(EXESUF), $(PROGS-yes))
12 PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
13 OBJS        = $(addsuffix .o,          $(PROGS-yes)) cmdutils.o
14 MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
15 TOOLS       = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
16 HOSTPROGS   = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
17
18 BASENAMES   = ffmpeg ffplay ffserver
19 ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
20 ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
21 ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
22
23 FFLIBS-$(CONFIG_AVFILTER) += avfilter
24 FFLIBS-$(CONFIG_POSTPROC) += postproc
25
26 FFLIBS := avdevice avformat avcodec avutil swscale
27
28 DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
29
30 include common.mak
31
32 FF_LDFLAGS   := $(FFLDFLAGS)
33 FF_EXTRALIBS := $(FFEXTRALIBS)
34 FF_DEP_LIBS  := $(DEP_LIBS)
35
36 ALL_TARGETS-$(CONFIG_DOC)       += documentation
37
38 ifdef PROGS
39 INSTALL_TARGETS-yes             += install-progs install-data
40 INSTALL_TARGETS-$(CONFIG_DOC)   += install-man
41 endif
42 INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
43
44 all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
45
46 $(PROGS): %$(EXESUF): %_g$(EXESUF)
47         cp -p $< $@
48         $(STRIP) $@
49
50 SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
51                ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
52                HOSTPROGS
53
54 define RESET
55 $(1) :=
56 $(1)-yes :=
57 endef
58
59 define DOSUBDIR
60 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
61 SUBDIR := $(1)/
62 include $(1)/Makefile
63 endef
64
65 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
66
67 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
68 ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
69
70 %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
71         $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
72
73 tools/%$(EXESUF): tools/%.o
74         $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
75
76 tools/%.o: tools/%.c
77         $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
78
79 ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
80
81 cmdutils.o cmdutils.d: version.h
82
83 alltools: $(TOOLS)
84
85 documentation: $(addprefix doc/, developer.html faq.html ffmpeg-doc.html \
86                                  ffplay-doc.html ffserver-doc.html       \
87                                  general.html libavfilter.html $(ALLMANPAGES))
88
89 doc/%.html: doc/%.texi
90         texi2html -monolithic -number $<
91         mv $(@F) $@
92
93 doc/%.pod: doc/%-doc.texi
94         doc/texi2pod.pl $< $@
95
96 doc/%.1: doc/%.pod
97         pod2man --section=1 --center=" " --release=" " $< > $@
98
99 install: $(INSTALL_TARGETS-yes)
100
101 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
102         install -d "$(BINDIR)"
103         install -c -m 755 $(PROGS) "$(BINDIR)"
104
105 install-data: $(DATA_FILES)
106         install -d "$(DATADIR)"
107         install -m 644 $(DATA_FILES) "$(DATADIR)"
108
109 install-man: $(MANPAGES)
110         install -d "$(MANDIR)/man1"
111         install -m 644 $(MANPAGES) "$(MANDIR)/man1"
112
113 uninstall:
114         @echo "I'm sorry, Dave. I'm afraid I can't do that"
115
116 testclean:
117         rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/*~
118
119 clean:: testclean
120         rm -f $(ALLPROGS) $(ALLPROGS_G)
121         rm -f $(CLEANSUFFIXES)
122         rm -f doc/*.html doc/*.pod doc/*.1
123         rm -f tests/seek_test$(EXESUF) tests/seek_test.o
124         rm -f $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
125         rm -f $(TOOLS)
126
127 distclean::
128         rm -f $(DISTCLEANSUFFIXES)
129         rm -f version.h config.*
130
131 config:
132         $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
133
134 # regression tests
135
136 check: test checkheaders
137
138 fulltest test: codectest lavftest seektest
139
140 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
141 LAVF_REFFILE     = $(SRC_PATH)/tests/lavf.regression.ref
142 LAVFI_REFFILE    = $(SRC_PATH)/tests/lavfi.regression.ref
143 ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
144 SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
145 VSYNTH_REFFILE   = $(SRC_PATH)/tests/vsynth.regression.ref
146
147 CODEC_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         dnxhd_1080i                             \
180         dnxhd_720p                              \
181         dnxhd_720p_rd                           \
182         svq1                                    \
183         flashsv                                 \
184         roq                                     \
185         mp2                                     \
186         ac3                                     \
187         g726                                    \
188         adpcm_ima_wav                           \
189         adpcm_ima_qt                            \
190         adpcm_ms                                \
191         adpcm_yam                               \
192         adpcm_swf                               \
193         alac                                    \
194         flac                                    \
195         wma                                     \
196         pcm                                     \
197     )
198
199 LAVF_TESTS = $(addprefix regtest-,              \
200         avi                                     \
201         asf                                     \
202         rm                                      \
203         mpg                                     \
204         mxf                                     \
205         ts                                      \
206         swf                                     \
207         ffm                                     \
208         flv_fmt                                 \
209         mov                                     \
210         dv_fmt                                  \
211         gxf                                     \
212         nut                                     \
213         mkv                                     \
214         pbmpipe                                 \
215         pgmpipe                                 \
216         ppmpipe                                 \
217         gif                                     \
218         yuv4mpeg                                \
219         pgm                                     \
220         ppm                                     \
221         bmp                                     \
222         tga                                     \
223         tiff                                    \
224         sgi                                     \
225         jpg                                     \
226         wav                                     \
227         alaw                                    \
228         mulaw                                   \
229         au                                      \
230         mmf                                     \
231         aiff                                    \
232         voc                                     \
233         ogg                                     \
234         pixfmt                                  \
235         pcx                                     \
236     )
237
238 LAVFI_TESTS = $(addprefix regtest-,             \
239     )
240
241 RESFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
242
243 ROTOZOOM_RESFILES = $(call RESFILES,rotozoom.regression,$(CODEC_TESTS))
244 VSYNTH_RESFILES   = $(call RESFILES,vsynth.regression,$(CODEC_TESTS))
245
246 LAVF_RESFILES = $(call RESFILES,lavf.regression,$(LAVF_TESTS))
247 LAVFI_RESFILES = $(call RESFILES,lavfi.regression,$(LAVFI_TESTS))
248
249 LAVF_RESFILE     = tests/data/lavf.regression
250 LAVFI_RESFILE    = tests/data/lavfi.regression
251 ROTOZOOM_RESFILE = tests/data/rotozoom.regression
252 VSYNTH_RESFILE   = tests/data/vsynth.regression
253
254 ifneq ($(CONFIG_ZLIB),yes)
255 regtest-flashsv codectest: zlib-error
256 endif
257 zlib-error:
258         @echo
259         @echo "This regression test requires zlib."
260         @echo
261         @exit 1
262
263 codectest: $(VSYNTH_RESFILE) $(ROTOZOOM_RESFILE)
264         diff -u -w $(VSYNTH_REFFILE)   $(VSYNTH_RESFILE)
265         diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_RESFILE)
266
267 lavftest: $(LAVF_RESFILE)
268         diff -u -w $(LAVF_REFFILE) $(LAVF_RESFILE)
269
270 # lavfitest: $(LAVFI_RESFILE)
271 #       diff -u -w $(LAVFI_REFFILE) $(LAVFI_RESFILE)
272
273 $(VSYNTH_RESFILE) $(ROTOZOOM_RESFILE) $(LAVF_RESFILE) $(LAVFI_RESFILE):
274         cat $^ > $@
275
276 $(LAVF_RESFILE):     $(LAVF_RESFILES)
277 $(LAVFI_RESFILE):    $(LAVFI_RESFILES)
278 $(ROTOZOOM_RESFILE): $(ROTOZOOM_RESFILES)
279 $(VSYNTH_RESFILE):   $(VSYNTH_RESFILES)
280
281 $(VSYNTH_RESFILES) $(ROTOZOOM_RESFILES): $(CODEC_TESTS)
282
283 $(LAVF_RESFILES): $(LAVF_TESTS)
284 $(LAVFI_RESFILES): $(LAVFI_TESTS)
285
286 $(CODEC_TESTS) $(LAVF_TESTS) $(LAVFI_TESTS): regtest-ref
287
288 regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/data/asynth1.sw
289
290 $(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(HOSTEXESUF)
291         $(SRC_PATH)/tests/codec-regression.sh $@ vsynth   tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
292         $(SRC_PATH)/tests/codec-regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
293
294 $(LAVF_TESTS):
295         $(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
296
297 $(LAVFI_TESTS):
298         $(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
299
300 seektest: codectest lavftest tests/seek_test$(EXESUF)
301         $(SRC_PATH)/tests/seek-regression.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
302
303 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
304         @echo
305         @echo "Unfortunately ffserver is broken and therefore its regression"
306         @echo "test fails randomly. Treat the results accordingly."
307         @echo
308         $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
309
310 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
311         mkdir -p tests/vsynth1
312         $(BUILD_ROOT)/$< 'tests/vsynth1/'
313
314 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
315         mkdir -p tests/vsynth2
316         $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
317
318 tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
319         mkdir -p tests/data
320         $(BUILD_ROOT)/$< $@
321
322 tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
323         $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
324
325
326 .PHONY: documentation *test regtest-* zlib-error alltools check config