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