Allow disabling doc generation with --disable-doc
[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: uninstall-progs uninstall-data uninstall-man
114
115 uninstall-progs:
116         rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
117
118 uninstall-data:
119         rm -rf "$(DATADIR)"
120
121 uninstall-man:
122         rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
123
124 testclean:
125         rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/*~
126
127 clean:: testclean
128         rm -f $(ALLPROGS) $(ALLPROGS_G)
129         rm -f $(CLEANSUFFIXES)
130         rm -f doc/*.html doc/*.pod doc/*.1
131         rm -f tests/seek_test$(EXESUF) tests/seek_test.o
132         rm -f $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
133         rm -f $(TOOLS)
134
135 distclean::
136         rm -f $(DISTCLEANSUFFIXES)
137         rm -f version.h config.*
138
139 config:
140         $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
141
142 # regression tests
143
144 check: test checkheaders
145
146 fulltest test: codectest lavftest seektest
147
148 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
149 LAVF_REFFILE     = $(SRC_PATH)/tests/lavf.regression.ref
150 LAVFI_REFFILE    = $(SRC_PATH)/tests/lavfi.regression.ref
151 ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
152 SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
153 VSYNTH_REFFILE   = $(SRC_PATH)/tests/vsynth.regression.ref
154
155 CODEC_TESTS = $(addprefix regtest-,             \
156         mpeg                                    \
157         mpeg2                                   \
158         mpeg2thread                             \
159         msmpeg4v2                               \
160         msmpeg4                                 \
161         wmv1                                    \
162         wmv2                                    \
163         h261                                    \
164         h263                                    \
165         h263p                                   \
166         mpeg4                                   \
167         huffyuv                                 \
168         rc                                      \
169         mpeg4adv                                \
170         mpeg4thread                             \
171         error                                   \
172         mpeg4nr                                 \
173         mpeg1b                                  \
174         mjpeg                                   \
175         ljpeg                                   \
176         jpegls                                  \
177         rv10                                    \
178         rv20                                    \
179         asv1                                    \
180         asv2                                    \
181         flv                                     \
182         ffv1                                    \
183         snow                                    \
184         snowll                                  \
185         dv                                      \
186         dv50                                    \
187         dnxhd_1080i                             \
188         dnxhd_720p                              \
189         dnxhd_720p_rd                           \
190         svq1                                    \
191         flashsv                                 \
192         mp2                                     \
193         ac3                                     \
194         g726                                    \
195         adpcm_ima_wav                           \
196         adpcm_ima_qt                            \
197         adpcm_ms                                \
198         adpcm_yam                               \
199         adpcm_swf                               \
200         alac                                    \
201         flac                                    \
202         wma                                     \
203         pcm                                     \
204     )
205
206 LAVF_TESTS = $(addprefix regtest-,              \
207         avi                                     \
208         asf                                     \
209         rm                                      \
210         mpg                                     \
211         mxf                                     \
212         ts                                      \
213         swf                                     \
214         ffm                                     \
215         flv_fmt                                 \
216         mov                                     \
217         dv_fmt                                  \
218         gxf                                     \
219         nut                                     \
220         mkv                                     \
221         pbmpipe                                 \
222         pgmpipe                                 \
223         ppmpipe                                 \
224         gif                                     \
225         yuv4mpeg                                \
226         pgm                                     \
227         ppm                                     \
228         bmp                                     \
229         tga                                     \
230         tiff                                    \
231         sgi                                     \
232         jpg                                     \
233         wav                                     \
234         alaw                                    \
235         mulaw                                   \
236         au                                      \
237         mmf                                     \
238         aiff                                    \
239         voc                                     \
240         ogg                                     \
241         pixfmt                                  \
242         pcx                                     \
243     )
244
245 LAVFI_TESTS = $(addprefix regtest-,             \
246     )
247
248 RESFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
249
250 ROTOZOOM_RESFILES = $(call RESFILES,rotozoom.regression,$(CODEC_TESTS))
251 VSYNTH_RESFILES   = $(call RESFILES,vsynth.regression,$(CODEC_TESTS))
252
253 LAVF_RESFILES = $(call RESFILES,lavf.regression,$(LAVF_TESTS))
254 LAVFI_RESFILES = $(call RESFILES,lavfi.regression,$(LAVFI_TESTS))
255
256 LAVF_RESFILE     = tests/data/lavf.regression
257 LAVFI_RESFILE    = tests/data/lavfi.regression
258 ROTOZOOM_RESFILE = tests/data/rotozoom.regression
259 VSYNTH_RESFILE   = tests/data/vsynth.regression
260
261 ifneq ($(CONFIG_ZLIB),yes)
262 regtest-flashsv codectest: zlib-error
263 endif
264 zlib-error:
265         @echo
266         @echo "This regression test requires zlib."
267         @echo
268         @exit 1
269
270 codectest: $(VSYNTH_RESFILE) $(ROTOZOOM_RESFILE)
271         diff -u -w $(VSYNTH_REFFILE)   $(VSYNTH_RESFILE)
272         diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_RESFILE)
273
274 lavftest: $(LAVF_RESFILE)
275         diff -u -w $(LAVF_REFFILE) $(LAVF_RESFILE)
276
277 # lavfitest: $(LAVFI_RESFILE)
278 #       diff -u -w $(LAVFI_REFFILE) $(LAVFI_RESFILE)
279
280 $(VSYNTH_RESFILE) $(ROTOZOOM_RESFILE) $(LAVF_RESFILE) $(LAVFI_RESFILE):
281         cat $^ > $@
282
283 $(LAVF_RESFILE):     $(LAVF_RESFILES)
284 $(LAVFI_RESFILE):    $(LAVFI_RESFILES)
285 $(ROTOZOOM_RESFILE): $(ROTOZOOM_RESFILES)
286 $(VSYNTH_RESFILE):   $(VSYNTH_RESFILES)
287
288 $(VSYNTH_RESFILES) $(ROTOZOOM_RESFILES): $(CODEC_TESTS)
289
290 $(LAVF_RESFILES): $(LAVF_TESTS)
291 $(LAVFI_RESFILES): $(LAVFI_TESTS)
292
293 $(CODEC_TESTS) $(LAVF_TESTS) $(LAVFI_TESTS): regtest-ref
294
295 regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/data/asynth1.sw
296
297 $(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(HOSTEXESUF)
298         $(SRC_PATH)/tests/codec-regression.sh $@ vsynth   tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
299         $(SRC_PATH)/tests/codec-regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
300
301 $(LAVF_TESTS):
302         $(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
303
304 $(LAVFI_TESTS):
305         $(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
306
307 seektest: codectest lavftest tests/seek_test$(EXESUF)
308         $(SRC_PATH)/tests/seek-regression.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
309
310 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
311         @echo
312         @echo "Unfortunately ffserver is broken and therefore its regression"
313         @echo "test fails randomly. Treat the results accordingly."
314         @echo
315         $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
316
317 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
318         mkdir -p tests/vsynth1
319         $(BUILD_ROOT)/$< 'tests/vsynth1/'
320
321 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
322         mkdir -p tests/vsynth2
323         $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
324
325 tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
326         mkdir -p tests/data
327         $(BUILD_ROOT)/$< $@
328
329 tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
330         $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
331
332
333 .PHONY: documentation *test regtest-* zlib-error alltools check config