Statistics
| Branch: | Revision:

ffmpeg / Makefile @ 97668ac7

History | View | Annotate | Download (10.4 KB)

1
include config.mak
2

    
3
SRC_DIR = $(SRC_PATH_BARE)
4

    
5
vpath %.texi $(SRC_PATH_BARE)
6

    
7
PROGS-$(CONFIG_FFMPEG)   += ffmpeg
8
PROGS-$(CONFIG_FFPLAY)   += ffplay
9
PROGS-$(CONFIG_FFSERVER) += ffserver
10

    
11
PROGS       = $(addsuffix   $(EXESUF), $(PROGS-yes))
12
PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
13
OBJS        = $(addsuffix .o,          $(PROGS-yes)) cmdutils.o
14
MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
15

    
16
BASENAMES   = ffmpeg ffplay ffserver
17
ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
18
ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
19
ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
20

    
21
FFLIBS-$(CONFIG_AVFILTER) += avfilter
22
FFLIBS-$(CONFIG_POSTPROC) += postproc
23

    
24
FFLIBS := avdevice avformat avcodec avutil swscale
25

    
26
DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
27

    
28
include common.mak
29

    
30
FF_LDFLAGS   := $(FFLDFLAGS)
31
FF_EXTRALIBS := $(FFEXTRALIBS)
32
FF_DEP_LIBS  := $(DEP_LIBS)
33

    
34
ALL_TARGETS-$(BUILD_DOC)    += documentation
35

    
36
ifneq ($(PROGS),)
37
INSTALL_TARGETS-yes             += install-progs install-data
38
INSTALL_TARGETS-$(BUILD_DOC)    += install-man
39
endif
40
INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
41

    
42
all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
43

    
44
$(PROGS): %$(EXESUF): %_g$(EXESUF)
45
	cp -p $< $@
46
	$(STRIP) $@
47

    
48
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES \
49
               ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS
50

    
51
define RESET
52
$(1) :=
53
$(1)-yes :=
54
endef
55

    
56
define DOSUBDIR
57
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
58
SUBDIR := $(1)/
59
include $(1)/Makefile
60
endef
61

    
62
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
63

    
64
ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
65
ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
66

    
67
%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
68
	$(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
69

    
70
tools/%$(EXESUF): tools/%.c
71
	$(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
72

    
73
ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
74

    
75
cmdutils.o cmdutils.d: version.h
76

    
77
alltools: $(addsuffix $(EXESUF),$(addprefix tools/, cws2fws pktdumper qt-faststart trasher))
78

    
79
documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
80
                                 ffplay-doc.html general.html $(ALLMANPAGES))
81

    
82
doc/%.html: doc/%.texi
83
	texi2html -monolithic -number $<
84
	mv $(@F) $@
85

    
86
doc/%.pod: doc/%-doc.texi
87
	doc/texi2pod.pl $< $@
88

    
89
doc/%.1: doc/%.pod
90
	pod2man --section=1 --center=" " --release=" " $< > $@
91

    
92
install: $(INSTALL_TARGETS-yes)
93

    
94
install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
95
	install -d "$(BINDIR)"
96
	install -c -m 755 $(PROGS) "$(BINDIR)"
97

    
98
install-data: $(DATA_FILES)
99
	install -d "$(DATADIR)"
100
	install -m 644 $(DATA_FILES) "$(DATADIR)"
101

    
102
install-man: $(MANPAGES)
103
	install -d "$(MANDIR)/man1"
104
	install -m 644 $(MANPAGES) "$(MANDIR)/man1"
105

    
106
uninstall: uninstall-progs uninstall-data uninstall-man
107

    
108
uninstall-progs:
109
	rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
110

    
111
uninstall-data:
112
	rm -rf "$(DATADIR)"
113

    
114
uninstall-man:
115
	rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
116

    
117
testclean:
118
	rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/*~
119

    
120
clean:: testclean
121
	rm -f $(ALLPROGS) $(ALLPROGS_G)
122
	rm -f $(CLEANSUFFIXES)
123
	rm -f doc/*.html doc/*.pod doc/*.1
124
	rm -f tests/seek_test$(EXESUF)
125
	rm -f $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
126
	rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
127

    
128
distclean::
129
	rm -f $(DISTCLEANSUFFIXES)
130
	rm -f version.h config.*
131

    
132
config:
133
	$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
134

    
135
# regression tests
136

    
137
check: test checkheaders
138

    
139
fulltest test: codectest lavftest seektest
140

    
141
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
142
LAVF_REFFILE     = $(SRC_PATH)/tests/lavf.regression.ref
143
ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
144
SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
145
VSYNTH_REFFILE   = $(SRC_PATH)/tests/vsynth.regression.ref
146

    
147
CODEC_TESTS = $(addprefix regtest-,             \
148
        mpeg                                    \
149
        mpeg2                                   \
150
        mpeg2thread                             \
151
        msmpeg4v2                               \
152
        msmpeg4                                 \
153
        wmv1                                    \
154
        wmv2                                    \
155
        h261                                    \
156
        h263                                    \
157
        h263p                                   \
158
        mpeg4                                   \
159
        huffyuv                                 \
160
        rc                                      \
161
        mpeg4adv                                \
162
        mpeg4thread                             \
163
        error                                   \
164
        mpeg4nr                                 \
165
        mpeg1b                                  \
166
        mjpeg                                   \
167
        ljpeg                                   \
168
        jpegls                                  \
169
        rv10                                    \
170
        rv20                                    \
171
        asv1                                    \
172
        asv2                                    \
173
        flv                                     \
174
        ffv1                                    \
175
        snow                                    \
176
        snowll                                  \
177
        dv                                      \
178
        dv50                                    \
179
        svq1                                    \
180
        flashsv                                 \
181
        mp2                                     \
182
        ac3                                     \
183
        g726                                    \
184
        adpcm_ima_wav                           \
185
        adpcm_ima_qt                            \
186
        adpcm_ms                                \
187
        adpcm_yam                               \
188
        adpcm_swf                               \
189
        flac                                    \
190
        wma                                     \
191
        pcm                                     \
192
    )
193

    
194
LAVF_TESTS = $(addprefix regtest-,              \
195
        avi                                     \
196
        asf                                     \
197
        rm                                      \
198
        mpg                                     \
199
        mxf                                     \
200
        ts                                      \
201
        swf                                     \
202
        ffm                                     \
203
        flv_fmt                                 \
204
        mov                                     \
205
        dv_fmt                                  \
206
        gxf                                     \
207
        nut                                     \
208
        mkv                                     \
209
        pbmpipe                                 \
210
        pgmpipe                                 \
211
        ppmpipe                                 \
212
        gif                                     \
213
        yuv4mpeg                                \
214
        pgm                                     \
215
        ppm                                     \
216
        bmp                                     \
217
        tga                                     \
218
        tiff                                    \
219
        sgi                                     \
220
        jpg                                     \
221
        wav                                     \
222
        alaw                                    \
223
        mulaw                                   \
224
        au                                      \
225
        mmf                                     \
226
        aiff                                    \
227
        voc                                     \
228
        ogg                                     \
229
        pixfmt                                  \
230
        pcx                                     \
231
    )
232

    
233
REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
234

    
235
CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
236
CODEC_VSYNTH   = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
237

    
238
LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
239

    
240
LAVF_REG     = tests/data/lavf.regression
241
ROTOZOOM_REG = tests/data/rotozoom.regression
242
VSYNTH_REG   = tests/data/vsynth.regression
243

    
244
ifneq ($(CONFIG_ZLIB),yes)
245
regtest-flashsv codectest: zlib-error
246
endif
247
zlib-error:
248
	@echo
249
	@echo "This regression test requires zlib."
250
	@echo
251
	@exit 1
252

    
253
codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
254
	diff -u -w $(VSYNTH_REFFILE)   $(VSYNTH_REG)
255
	diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
256

    
257
lavftest: $(LAVF_REG)
258
	diff -u -w $(LAVF_REFFILE) $(LAVF_REG)
259

    
260
$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
261
	cat $^ > $@
262

    
263
$(LAVF_REG):     $(LAVF_REGFILES)
264
$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
265
$(VSYNTH_REG):   $(CODEC_VSYNTH)
266

    
267
$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
268

    
269
$(LAVF_REGFILES): $(LAVF_TESTS)
270

    
271
$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
272

    
273
regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/data/asynth1.sw
274

    
275
$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(HOSTEXESUF)
276
	$(SRC_PATH)/tests/codec-regression.sh $@ vsynth   tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
277
	$(SRC_PATH)/tests/codec-regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
278

    
279
$(LAVF_TESTS):
280
	$(SRC_PATH)/tests/codec-regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
281

    
282
seektest: codectest lavftest tests/seek_test$(EXESUF)
283
	$(SRC_PATH)/tests/seek-regression.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
284

    
285
ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
286
	@echo
287
	@echo "Unfortunately ffserver is broken and therefore its regression"
288
	@echo "test fails randomly. Treat the results accordingly."
289
	@echo
290
	$(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
291

    
292
tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
293
	mkdir -p tests/vsynth1
294
	$(BUILD_ROOT)/$< 'tests/vsynth1/'
295

    
296
tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
297
	mkdir -p tests/vsynth2
298
	$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
299

    
300
tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
301
	mkdir -p tests/data
302
	$(BUILD_ROOT)/$< $@
303

    
304
tests/%$(HOSTEXESUF): tests/%.c
305
	$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
306

    
307
tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
308
	$(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
309

    
310

    
311
.PHONY: documentation *test regtest-* zlib-error alltools check config