Change dir into doc/ when running texi2html
[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 cmdutils.o cmdutils.d: version.h
89
90 alltools: $(TOOLS)
91
92 documentation: $(addprefix doc/, developer.html faq.html ffmpeg-doc.html \
93                                  ffplay-doc.html ffprobe-doc.html ffserver-doc.html \
94                                  general.html libavfilter.html $(ALLMANPAGES))
95
96 doc/%.html: doc/%.texi
97         cd doc && texi2html -monolithic -number $(<:doc/%=%)
98
99 doc/%.pod: doc/%-doc.texi
100         doc/texi2pod.pl $< $@
101
102 doc/%.1: doc/%.pod
103         pod2man --section=1 --center=" " --release=" " $< > $@
104
105 install: $(INSTALL_TARGETS-yes)
106
107 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
108         $(Q)mkdir -p "$(BINDIR)"
109         $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
110
111 install-data: $(DATA_FILES)
112         $(Q)mkdir -p "$(DATADIR)"
113         $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
114
115 install-man: $(MANPAGES)
116         $(Q)mkdir -p "$(MANDIR)/man1"
117         $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
118
119 uninstall: uninstall-progs uninstall-data uninstall-man
120
121 uninstall-progs:
122         $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
123
124 uninstall-data:
125         $(RM) -r "$(DATADIR)"
126
127 uninstall-man:
128         $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
129
130 testclean:
131         $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
132         $(RM) $(addprefix tests/,$(CLEANSUFFIXES))
133         $(RM) tests/seek_test$(EXESUF) tests/seek_test.o
134         $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
135
136 clean:: testclean
137         $(RM) $(ALLPROGS) $(ALLPROGS_G)
138         $(RM) $(CLEANSUFFIXES)
139         $(RM) doc/*.html doc/*.pod doc/*.1
140         $(RM) $(TOOLS)
141
142 distclean::
143         $(RM) $(DISTCLEANSUFFIXES)
144         $(RM) version.h config.* libavutil/avconfig.h
145
146 config:
147         $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
148
149 # regression tests
150
151 check: test checkheaders
152
153 fulltest test: codectest lavftest seektest
154
155 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
156 SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
157
158 ENCDEC = $(and $(CONFIG_$(1)_ENCODER),$(CONFIG_$(1)_DECODER))
159 MUXDEM = $(and $(CONFIG_$(1)_MUXER),$(CONFIG_$(or $(2),$(1))_DEMUXER))
160
161 VCODEC_TESTS =
162 VCODEC_TESTS-$(call ENCDEC,ASV1)             += asv1
163 VCODEC_TESTS-$(call ENCDEC,ASV2)             += asv2
164 VCODEC_TESTS-$(call ENCDEC,DNXHD)            += dnxhd_1080i dnxhd_720p dnxhd_720p_rd
165 VCODEC_TESTS-$(call ENCDEC,DVVIDEO)          += dv dv50
166 VCODEC_TESTS-$(call ENCDEC,FFV1)             += ffv1
167 VCODEC_TESTS-$(call ENCDEC,FLASHSV)          += flashsv
168 VCODEC_TESTS-$(call ENCDEC,FLV)              += flv
169 VCODEC_TESTS-$(call ENCDEC,H261)             += h261
170 VCODEC_TESTS-$(call ENCDEC,H263)             += h263 h263p
171 VCODEC_TESTS-$(call ENCDEC,HUFFYUV)          += huffyuv
172 VCODEC_TESTS-$(call ENCDEC,JPEGLS)           += jpegls
173 VCODEC_TESTS-$(call ENCDEC,MJPEG)            += mjpeg ljpeg
174 VCODEC_TESTS-$(call ENCDEC,MPEG1VIDEO)       += mpeg mpeg1b
175 VCODEC_TESTS-$(call ENCDEC,MPEG2VIDEO)       += mpeg2 mpeg2thread
176 VCODEC_TESTS-$(call ENCDEC,MPEG4)            += mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc
177 VCODEC_TESTS-$(call ENCDEC,MSMPEG4V1)        += msmpeg4
178 VCODEC_TESTS-$(call ENCDEC,MSMPEG4V2)        += msmpeg4v2
179 VCODEC_TESTS-$(call ENCDEC,ROQ)              += roq
180 VCODEC_TESTS-$(call ENCDEC,RV10)             += rv10
181 VCODEC_TESTS-$(call ENCDEC,RV20)             += rv20
182 VCODEC_TESTS-$(call ENCDEC,SNOW)             += snow snowll
183 VCODEC_TESTS-$(call ENCDEC,SVQ1)             += svq1
184 VCODEC_TESTS-$(call ENCDEC,WMV1)             += wmv1
185 VCODEC_TESTS-$(call ENCDEC,WMV2)             += wmv2
186
187 ACODEC_TESTS =
188 ACODEC_TESTS-$(call ENCDEC,AC3)              += ac3
189 ACODEC_TESTS-$(call ENCDEC,ADPCM_G726)       += g726
190 ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_QT)     += adpcm_ima_qt
191 ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_WAV)    += adpcm_ima_wav
192 ACODEC_TESTS-$(call ENCDEC,ADPCM_MS)         += adpcm_ms
193 ACODEC_TESTS-$(call ENCDEC,ADPCM_SWF)        += adpcm_swf
194 ACODEC_TESTS-$(call ENCDEC,ADPCM_YAMAHA)     += adpcm_yam
195 ACODEC_TESTS-$(call ENCDEC,ALAC)             += alac
196 ACODEC_TESTS-$(call ENCDEC,FLAC)             += flac
197 ACODEC_TESTS-$(call ENCDEC,MP2)              += mp2
198 ACODEC_TESTS-$(call ENCDEC,PCM_S16LE)        += pcm         # fixme
199 ACODEC_TESTS-$(call ENCDEC,WMAV1)            += wmav1
200 ACODEC_TESTS-$(call ENCDEC,WMAV1)            += wmav2
201
202 LAVF_TESTS =
203 LAVF_TESTS-$(call MUXDEM,AIFF)               += aiff
204 LAVF_TESTS-$(call MUXDEM,PCM_ALAW)           += alaw
205 LAVF_TESTS-$(call MUXDEM,ASF)                += asf
206 LAVF_TESTS-$(call MUXDEM,AU)                 += au
207 LAVF_TESTS-$(call MUXDEM,AVI)                += avi
208 LAVF_TESTS-$(call ENCDEC,BMP)                += bmp
209 LAVF_TESTS-$(call MUXDEM,DV)                 += dv_fmt
210 LAVF_TESTS-$(call MUXDEM,FFM)                += ffm
211 LAVF_TESTS-$(call MUXDEM,FLV)                += flv_fmt
212 LAVF_TESTS-$(call ENCDEC,GIF)                += gif
213 LAVF_TESTS-$(call MUXDEM,GXF)                += gxf
214 LAVF_TESTS-$(call ENCDEC,MJPEG)              += jpg
215 LAVF_TESTS-$(call MUXDEM,MATROSKA)           += mkv
216 LAVF_TESTS-$(call MUXDEM,MMF)                += mmf
217 LAVF_TESTS-$(call MUXDEM,MOV)                += mov
218 LAVF_TESTS-$(call MUXDEM,MPEG1SYSTEM,MPEGPS) += mpg
219 LAVF_TESTS-$(call MUXDEM,PCM_MULAW)          += mulaw
220 LAVF_TESTS-$(call MUXDEM,MXF)                += mxf
221 LAVF_TESTS-$(call MUXDEM,NUT)                += nut
222 LAVF_TESTS-$(call MUXDEM,OGG)                += ogg
223 LAVF_TESTS-$(call ENCDEC,PBM)                += pbmpipe
224 LAVF_TESTS-$(call ENCDEC,PCX)                += pcx
225 LAVF_TESTS-$(call ENCDEC,PGM)                += pgm pgmpipe
226 LAVF_TESTS-$(call MUXDEM,RAWVIDEO)           += pixfmt
227 LAVF_TESTS-$(call ENCDEC,PPM)                += ppm ppmpipe
228 LAVF_TESTS-$(call MUXDEM,RM)                 += rm
229 LAVF_TESTS-$(call ENCDEC,SGI)                += sgi
230 LAVF_TESTS-$(call MUXDEM,SWF)                += swf
231 LAVF_TESTS-$(call ENCDEC,TARGA)              += tga
232 LAVF_TESTS-$(call ENCDEC,TIFF)               += tiff
233 LAVF_TESTS-$(call MUXDEM,MPEGTS)             += ts
234 LAVF_TESTS-$(call MUXDEM,VOC)                += voc
235 LAVF_TESTS-$(call MUXDEM,WAV)                += wav
236 LAVF_TESTS-$(call MUXDEM,YUV4MPEGPIPE)       += yuv4mpeg
237
238 LAVFI_TESTS =
239
240 ACODEC_TESTS := $(addprefix regtest-, $(ACODEC_TESTS) $(ACODEC_TESTS-yes))
241 VCODEC_TESTS := $(addprefix regtest-, $(VCODEC_TESTS) $(VCODEC_TESTS-yes))
242 LAVF_TESTS  := $(addprefix regtest-, $(LAVF_TESTS)  $(LAVF_TESTS-yes))
243 LAVFI_TESTS := $(addprefix regtest-, $(LAVFI_TESTS) $(LAVFI_TESTS-yes))
244
245 CODEC_TESTS = $(VCODEC_TESTS) $(ACODEC_TESTS)
246
247 codectest: $(CODEC_TESTS)
248 lavftest:  $(LAVF_TESTS)
249
250 # lavfitest: $(LAVFI_TESTS)
251
252 $(ACODEC_TESTS): regtest-aref
253 $(VCODEC_TESTS): regtest-vref
254 $(LAVF_TESTS) $(LAVFI_TESTS): regtest-ref
255
256 REFFILE = $(SRC_PATH)/tests/ref/$(1)/$(2:regtest-%=%)
257 RESFILE = tests/data/$(2:regtest-%=%).$(1).regression
258
259 define CODECTEST_CMD
260         $(SRC_PATH)/tests/codec-regression.sh $@ vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
261         $(SRC_PATH)/tests/codec-regression.sh $@ vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
262 endef
263
264 regtest-ref: regtest-aref regtest-vref
265
266 regtest-vref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
267         $(CODECTEST_CMD)
268
269 regtest-aref: ffmpeg$(EXESUF) tests/data/asynth1.sw
270         @$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
271
272 $(VCODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
273         @echo "TEST VCODEC $(@:regtest-%=%)"
274         @$(CODECTEST_CMD)
275         @diff -u -w $(call REFFILE,vsynth1,$@) $(call RESFILE,vsynth1,$@)
276         @diff -u -w $(call REFFILE,vsynth2,$@) $(call RESFILE,vsynth2,$@)
277
278 $(ACODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
279         @echo "TEST ACODEC $(@:regtest-%=%)"
280         @$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
281         @diff -u -w $(call REFFILE,acodec,$@) $(call RESFILE,acodec,$@)
282
283 $(LAVF_TESTS):
284         @echo "TEST LAVF  $(@:regtest-%=%)"
285         @$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
286         @diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@)
287
288 $(LAVFI_TESTS):
289         @echo "TEST LAVFI $(@:regtest-%=%)"
290         @$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
291         @diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@)
292
293 seektest: codectest lavftest tests/seek_test$(EXESUF)
294         $(SRC_PATH)/tests/seek-regression.sh $(SRC_PATH) "$(TARGET_EXEC)" "$(TARGET_PATH)"
295
296 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
297         @echo
298         @echo "Unfortunately ffserver is broken and therefore its regression"
299         @echo "test fails randomly. Treat the results accordingly."
300         @echo
301         $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
302
303 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
304         mkdir -p tests/vsynth1
305         $(BUILD_ROOT)/$< 'tests/vsynth1/'
306
307 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
308         mkdir -p tests/vsynth2
309         $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
310
311 tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
312         mkdir -p tests/data
313         $(BUILD_ROOT)/$< $@
314
315 tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
316         $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
317
318
319 .PHONY: documentation *test regtest-* zlib-error alltools check config