Statistics
| Branch: | Revision:

ffmpeg / Makefile @ fdf11906

History | View | Annotate | Download (10.3 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
FFLIBS-$(CONFIG_SWSCALE)  += swscale
24

    
25
FFLIBS := avdevice avformat avcodec avutil
26

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

    
29
include common.mak
30

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

    
35
ALL_TARGETS-$(BUILD_DOC)    += documentation
36

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

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

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

    
49
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTS
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
output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
71
	$(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
72

    
73
tools/%$(EXESUF): tools/%.c
74
	$(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
75

    
76
ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
77

    
78
cmdutils.o cmdutils.d: version.h
79

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

    
82
documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
83
                                 ffplay-doc.html general.html $(ALLMANPAGES))
84

    
85
doc/%.html: doc/%.texi
86
	texi2html -monolithic -number $<
87
	mv $(@F) $@
88

    
89
doc/%.pod: doc/%-doc.texi
90
	doc/texi2pod.pl $< $@
91

    
92
doc/%.1: doc/%.pod
93
	pod2man --section=1 --center=" " --release=" " $< > $@
94

    
95
install: $(INSTALL_TARGETS-yes)
96

    
97
install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
98
	install -d "$(BINDIR)"
99
	install -c -m 755 $(PROGS) "$(BINDIR)"
100

    
101
install-data: $(DATA_FILES)
102
	install -d "$(DATADIR)"
103
	install -m 644 $(DATA_FILES) "$(DATADIR)"
104

    
105
install-man: $(MANPAGES)
106
	install -d "$(MANDIR)/man1"
107
	install -m 644 $(MANPAGES) "$(MANDIR)/man1"
108

    
109
uninstall: uninstall-progs uninstall-data uninstall-man
110

    
111
uninstall-progs:
112
	rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
113

    
114
uninstall-data:
115
	rm -rf "$(DATADIR)"
116

    
117
uninstall-man:
118
	rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
119

    
120
testclean:
121
	rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
122

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

    
129
distclean::
130
	rm -f version.h config.*
131

    
132
# regression tests
133

    
134
check: test checkheaders
135

    
136
fulltest test: codectest libavtest seektest
137

    
138
FFMPEG_REFFILE   = $(SRC_PATH)/tests/ffmpeg.regression.ref
139
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
140
LIBAV_REFFILE    = $(SRC_PATH)/tests/libav.regression.ref
141
ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
142
SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
143

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

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

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

    
230
CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
231
CODEC_VSYNTH   = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
232

    
233
LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
234

    
235
LAVF_REG     = tests/data/lavf.regression
236
ROTOZOOM_REG = tests/data/rotozoom.regression
237
VSYNTH_REG   = tests/data/vsynth.regression
238

    
239
ifneq ($(CONFIG_SWSCALE),yes)
240
servertest codectest $(CODEC_TESTS) libavtest: swscale-error
241
swscale-error:
242
	@echo
243
	@echo "This regression test requires --enable-swscale."
244
	@echo
245
	@exit 1
246
endif
247

    
248
ifneq ($(CONFIG_ZLIB),yes)
249
regtest-flashsv codectest: zlib-error
250
endif
251
zlib-error:
252
	@echo
253
	@echo "This regression test requires zlib."
254
	@echo
255
	@exit 1
256

    
257
codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
258
	diff -u -w $(FFMPEG_REFFILE)   $(VSYNTH_REG)
259
	diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
260

    
261
libavtest: $(LAVF_REG)
262
	diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
263

    
264
$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
265
	cat $^ > $@
266

    
267
$(LAVF_REG):     $(LAVF_REGFILES)
268
$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
269
$(VSYNTH_REG):   $(CODEC_VSYNTH)
270

    
271
$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
272

    
273
$(LAVF_REGFILES): $(LAVF_TESTS)
274

    
275
$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
276

    
277
regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
278

    
279
$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
280
	$(SRC_PATH)/tests/regression.sh $@ vsynth   tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
281
	$(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
282

    
283
$(LAVF_TESTS):
284
	$(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
285

    
286
seektest: codectest libavtest tests/seek_test$(EXESUF)
287
	$(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
288

    
289
servertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
290
	@echo
291
	@echo "Unfortunately ffserver is broken and therefore its regression"
292
	@echo "test fails randomly. Treat the results accordingly."
293
	@echo
294
	$(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
295

    
296
tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
297
	mkdir -p tests/vsynth1
298
	$(BUILD_ROOT)/$< 'tests/vsynth1/'
299

    
300
tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
301
	mkdir -p tests/vsynth2
302
	$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
303

    
304
tests/asynth1.sw: tests/audiogen$(EXESUF)
305
	$(BUILD_ROOT)/$< $@
306

    
307
tests/%$(EXESUF): tests/%.c
308
	$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
309

    
310
tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
311
	$(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
312

    
313

    
314
.PHONY: lib documentation *test regtest-* swscale-error zlib-error alltools check