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