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