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