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