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