Statistics
| Branch: | Revision:

ffmpeg / Makefile @ 9a5771e9

History | View | Annotate | Download (11.3 KB)

1 bde51e6a Justin Ruggles
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
include common.mak
28
29
FF_LDFLAGS   := $(FFLDFLAGS)
30
FF_EXTRALIBS := $(FFEXTRALIBS)
31
FF_DEP_LIBS  := $(DEP_LIBS)
32
33
ALL_TARGETS-$(CONFIG_VHOOK) += videohook
34
ALL_TARGETS-$(BUILD_DOC)    += documentation
35
36
INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
37
ifneq ($(PROGS),)
38
INSTALL_TARGETS-yes             += install-progs
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 c87348a9 Måns Rullgård
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTS
50 bde51e6a Justin Ruggles
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 9bce82fa Diego Biurrun
alltools: $(addsuffix $(EXESUF),$(addprefix tools/, cws2fws pktdumper qt-faststart trasher))
79
80 bde51e6a Justin Ruggles
VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
81
82
BASEHOOKS = fish null watermark
83
ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
84
ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
85
86
HOOKS-$(HAVE_FORK)      += ppm
87
HOOKS-$(HAVE_IMLIB2)    += imlib2
88
HOOKS-$(HAVE_FREETYPE2) += drawtext
89
90
HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
91
92
VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
93
LIBS_imlib2$(SLIBSUF)       = `imlib2-config --libs`
94
95
VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
96
LIBS_drawtext$(SLIBSUF)        = `freetype-config --libs`
97
98
VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
99
100
vhook/%.o vhook/%.d: CFLAGS:=$(VHOOKCFLAGS)
101
102
# vhooks compile fine without libav*, but need them nonetheless.
103
videohook: $(FF_DEP_LIBS) $(HOOKS)
104
105
$(eval VHOOKSHFLAGS=$(VHOOKSHFLAGS))
106
vhook/%$(SLIBSUF): vhook/%.o
107
	$(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
108
109
VHOOK_DEPS = $(HOOKS:$(SLIBSUF)=.d)
110
depend dep: $(VHOOK_DEPS)
111
112
documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
113
                                 ffplay-doc.html general.html hooks.html \
114
                                 $(ALLMANPAGES))
115
116
doc/%.html: doc/%.texi
117
	texi2html -monolithic -number $<
118
	mv $(@F) $@
119
120
doc/%.pod: doc/%-doc.texi
121
	doc/texi2pod.pl $< $@
122
123
doc/%.1: doc/%.pod
124
	pod2man --section=1 --center=" " --release=" " $< > $@
125
126
install: $(INSTALL_TARGETS-yes)
127
128
install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
129
	install -d "$(BINDIR)"
130
	install -c -m 755 $(PROGS) "$(BINDIR)"
131
132
install-man: $(MANPAGES)
133
	install -d "$(MANDIR)/man1"
134
	install -m 644 $(MANPAGES) "$(MANDIR)/man1"
135
136
install-vhook: videohook
137
	install -d "$(SHLIBDIR)/vhook"
138
	install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
139
140
uninstall: uninstall-progs uninstall-man uninstall-vhook
141
142
uninstall-progs:
143
	rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
144
145
uninstall-man:
146
	rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
147
148
uninstall-vhook:
149
	rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
150
	-rmdir "$(SHLIBDIR)/vhook/"
151
152
clean::
153
	rm -f $(ALLPROGS) $(ALLPROGS_G) output_example$(EXESUF)
154
	rm -f doc/*.html doc/*.pod doc/*.1
155
	rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
156
	rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
157
	rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
158
	rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
159
160
distclean::
161
	rm -f version.h config.* vhook/*.d
162
163
# regression tests
164
165 5bab8536 Diego Biurrun
check: test checkheaders
166
167 bde51e6a Justin Ruggles
fulltest test: codectest libavtest seektest
168
169
FFMPEG_REFFILE   = $(SRC_PATH)/tests/ffmpeg.regression.ref
170
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
171
LIBAV_REFFILE    = $(SRC_PATH)/tests/libav.regression.ref
172
ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
173
SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
174
175
CODEC_TESTS = $(addprefix regtest-,             \
176
        mpeg                                    \
177
        mpeg2                                   \
178
        mpeg2thread                             \
179
        msmpeg4v2                               \
180
        msmpeg4                                 \
181
        wmv1                                    \
182
        wmv2                                    \
183
        h261                                    \
184
        h263                                    \
185
        h263p                                   \
186
        mpeg4                                   \
187
        huffyuv                                 \
188
        rc                                      \
189
        mpeg4adv                                \
190
        mpeg4thread                             \
191
        error                                   \
192
        mpeg4nr                                 \
193
        mpeg1b                                  \
194
        mjpeg                                   \
195
        ljpeg                                   \
196
        jpegls                                  \
197
        rv10                                    \
198
        rv20                                    \
199
        asv1                                    \
200
        asv2                                    \
201
        flv                                     \
202
        ffv1                                    \
203
        snow                                    \
204
        snowll                                  \
205
        dv                                      \
206
        dv50                                    \
207
        svq1                                    \
208
        flashsv                                 \
209
        mp2                                     \
210
        ac3                                     \
211
        g726                                    \
212
        adpcm_ima_wav                           \
213
        adpcm_ima_qt                            \
214
        adpcm_ms                                \
215
        adpcm_yam                               \
216
        adpcm_swf                               \
217
        flac                                    \
218
        wma                                     \
219
        pcm                                     \
220
    )
221
222
LAVF_TESTS = $(addprefix regtest-,              \
223
        avi                                     \
224
        asf                                     \
225
        rm                                      \
226
        mpg                                     \
227
        ts                                      \
228
        swf                                     \
229
        ffm                                     \
230
        flv_fmt                                 \
231
        mov                                     \
232
        dv_fmt                                  \
233
        gxf                                     \
234
        nut                                     \
235
        mkv                                     \
236
        pbmpipe                                 \
237
        pgmpipe                                 \
238
        ppmpipe                                 \
239
        gif                                     \
240
        yuv4mpeg                                \
241
        pgm                                     \
242
        ppm                                     \
243
        bmp                                     \
244
        tga                                     \
245
        tiff                                    \
246
        sgi                                     \
247
        jpg                                     \
248
        wav                                     \
249
        alaw                                    \
250
        mulaw                                   \
251
        au                                      \
252
        mmf                                     \
253
        aiff                                    \
254
        voc                                     \
255
        ogg                                     \
256
        pixfmt                                  \
257
    )
258
259
REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
260
261
CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
262
CODEC_VSYNTH   = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
263
264
LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
265
266
LAVF_REG     = tests/data/lavf.regression
267
ROTOZOOM_REG = tests/data/rotozoom.regression
268
VSYNTH_REG   = tests/data/vsynth.regression
269
270 3e3c638e Michael Niedermayer
ifneq ($(CONFIG_SWSCALE),yes)
271 bde51e6a Justin Ruggles
servertest codectest $(CODEC_TESTS) libavtest: swscale_error
272
swscale_error:
273
	@echo
274 3e3c638e Michael Niedermayer
	@echo "This regression test requires --enable-swscale."
275 bde51e6a Justin Ruggles
	@echo
276
	@exit 1
277
endif
278
279
codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
280
	diff -u -w $(FFMPEG_REFFILE)   $(VSYNTH_REG)
281
	diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
282
283
libavtest: $(LAVF_REG)
284
	diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
285
286
$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
287
	cat $^ > $@
288
289
$(LAVF_REG):     $(LAVF_REGFILES)
290
$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
291
$(VSYNTH_REG):   $(CODEC_VSYNTH)
292
293
$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
294
295
$(LAVF_REGFILES): $(LAVF_TESTS)
296
297
$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
298
299
regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
300
301
$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
302 9a5771e9 Måns Rullgård
	$(SRC_PATH)/tests/regression.sh $@ vsynth   tests/vsynth1 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
303
	$(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a "$(TARGET_EXEC)" "$(TARGET_PATH)"
304 bde51e6a Justin Ruggles
305
$(LAVF_TESTS):
306 9a5771e9 Måns Rullgård
	$(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b "$(TARGET_EXEC)" "$(TARGET_PATH)"
307 bde51e6a Justin Ruggles
308
seektest: codectest libavtest tests/seek_test$(EXESUF)
309 9a5771e9 Måns Rullgård
	$(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE) "$(TARGET_EXEC)" "$(TARGET_PATH)"
310 bde51e6a Justin Ruggles
311
servertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
312
	@echo
313
	@echo "Unfortunately ffserver is broken and therefore its regression"
314
	@echo "test fails randomly. Treat the results accordingly."
315
	@echo
316
	$(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
317
318
tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
319
	mkdir -p tests/vsynth1
320
	$(BUILD_ROOT)/$< 'tests/vsynth1/'
321
322
tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
323
	mkdir -p tests/vsynth2
324
	$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
325
326
tests/asynth1.sw: tests/audiogen$(EXESUF)
327
	$(BUILD_ROOT)/$< $@
328
329 dbad2c29 Måns Rullgård
tests/%$(EXESUF): tests/%.c
330
	$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
331 bde51e6a Justin Ruggles
332
tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
333
	$(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
334
335
336 5bab8536 Diego Biurrun
.PHONY: lib videohook documentation *test regtest-* swscale-error alltools check
337 bde51e6a Justin Ruggles
338
-include $(VHOOK_DEPS)