Statistics
| Branch: | Revision:

ffmpeg / Makefile @ fe858d7b

History | View | Annotate | Download (8.98 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_FFPROBE)  += ffprobe
10
PROGS-$(CONFIG_FFSERVER) += ffserver
11

    
12
PROGS      := $(addsuffix   $(EXESUF), $(PROGS-yes))
13
PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
14
OBJS        = $(addsuffix .o,          $(PROGS-yes)) cmdutils.o
15
MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
16
PODPAGES    = $(addprefix doc/, $(addsuffix .pod, $(PROGS-yes)))
17
HTMLPAGES   = $(addprefix doc/, $(addsuffix -doc.html, $(PROGS-yes)))
18
TOOLS       = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
19
HOSTPROGS   = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr base64)
20

    
21
BASENAMES   = ffmpeg ffplay ffprobe ffserver
22
ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
23
ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
24
ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
25
ALLHTMLPAGES= $(addsuffix -doc.html, $(BASENAMES))
26

    
27
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
28
FFLIBS-$(CONFIG_AVFILTER) += avfilter
29
FFLIBS-$(CONFIG_AVFORMAT) += avformat
30
FFLIBS-$(CONFIG_AVCODEC)  += avcodec
31
FFLIBS-$(CONFIG_POSTPROC) += postproc
32
FFLIBS-$(CONFIG_SWSCALE)  += swscale
33
FFLIBS-$(CONFIG_AVCORE)   += avcore
34

    
35
FFLIBS := avutil
36

    
37
DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
38

    
39
SKIPHEADERS = cmdutils_common_opts.h
40

    
41
include common.mak
42

    
43
FF_LDFLAGS   := $(FFLDFLAGS)
44
FF_EXTRALIBS := $(FFEXTRALIBS)
45
FF_DEP_LIBS  := $(DEP_LIBS)
46

    
47
ALL_TARGETS-$(CONFIG_DOC)       += documentation
48

    
49
ifdef PROGS
50
INSTALL_TARGETS-yes             += install-progs install-data
51
INSTALL_TARGETS-$(CONFIG_DOC)   += install-man
52
endif
53
INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
54

    
55
all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
56

    
57
$(PROGS): %$(EXESUF): %_g$(EXESUF)
58
	$(CP) $< $@
59
	$(STRIP) $@
60

    
61
config.h: .config
62
.config: $(wildcard $(FFLIBS:%=$(SRC_DIR)/lib%/all*.c))
63
	@-tput bold 2>/dev/null
64
	@-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
65
	@-tput sgr0 2>/dev/null
66

    
67
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
68
               ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
69
               HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS
70

    
71
define RESET
72
$(1) :=
73
$(1)-yes :=
74
endef
75

    
76
define DOSUBDIR
77
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
78
SUBDIR := $(1)/
79
include $(1)/Makefile
80
endef
81

    
82
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
83

    
84
ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
85
ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
86

    
87
%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
88
	$(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
89

    
90
tools/%$(EXESUF): tools/%.o
91
	$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
92

    
93
tools/%.o: tools/%.c
94
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
95

    
96
ffplay.o: CFLAGS += $(SDL_CFLAGS)
97

    
98
VERSION_SH  = $(SRC_PATH_BARE)/version.sh
99
GIT_LOG     = $(SRC_PATH_BARE)/.git/logs/HEAD
100
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
101

    
102
.version: $(wildcard $(GIT_LOG) $(SVN_ENTRIES)) $(VERSION_SH) config.mak
103
.version: M=@
104

    
105
version.h .version:
106
	$(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
107
	$(Q)touch .version
108

    
109
# force version.sh to run whenever version might have changed
110
-include .version
111

    
112
alltools: $(TOOLS)
113

    
114
documentation: $(addprefix doc/, developer.html faq.html general.html libavfilter.html \
115
                                 $(ALLHTMLPAGES) $(ALLMANPAGES))
116

    
117
$(HTMLPAGES) $(PODPAGES): doc/fftools-common-opts.texi
118

    
119
doc/ffmpeg.pod doc/ffmpeg-doc.html: doc/bitstream_filters.texi doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi
120
doc/ffplay.pod doc/ffplay-doc.html: doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi
121
doc/ffprobe.pod doc/ffprobe-doc.html: doc/indevs.texi doc/protocols.texi
122

    
123
doc/%.html: TAG = HTML
124
doc/%.html: doc/%.texi
125
	$(M)cd doc && texi2html -monolithic -number $(<:doc/%=%)
126

    
127
doc/%.pod: TAG = POD
128
doc/%.pod: doc/%-doc.texi
129
	$(M)doc/texi2pod.pl $< $@
130

    
131
doc/%.1: TAG = MAN
132
doc/%.1: doc/%.pod
133
	$(M)pod2man --section=1 --center=" " --release=" " $< > $@
134

    
135
install: $(INSTALL_TARGETS-yes)
136

    
137
install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
138
	$(Q)mkdir -p "$(BINDIR)"
139
	$(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
140

    
141
install-data: $(DATA_FILES)
142
	$(Q)mkdir -p "$(DATADIR)"
143
	$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
144

    
145
install-man: $(MANPAGES)
146
	$(Q)mkdir -p "$(MANDIR)/man1"
147
	$(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
148

    
149
uninstall: uninstall-progs uninstall-data uninstall-man
150

    
151
uninstall-progs:
152
	$(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
153

    
154
uninstall-data:
155
	$(RM) -r "$(DATADIR)"
156

    
157
uninstall-man:
158
	$(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
159

    
160
testclean:
161
	$(RM) -r tests/vsynth1 tests/vsynth2 tests/data
162
	$(RM) $(addprefix tests/,$(CLEANSUFFIXES))
163
	$(RM) tests/seek_test$(EXESUF) tests/seek_test.o
164
	$(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr base64))
165

    
166
clean:: testclean
167
	$(RM) $(ALLPROGS) $(ALLPROGS_G)
168
	$(RM) $(CLEANSUFFIXES)
169
	$(RM) doc/*.html doc/*.pod doc/*.1
170
	$(RM) $(TOOLS)
171

    
172
distclean::
173
	$(RM) $(DISTCLEANSUFFIXES)
174
	$(RM) version.h config.* libavutil/avconfig.h
175

    
176
config:
177
	$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
178

    
179
# regression tests
180

    
181
check: test checkheaders
182

    
183
fulltest test: codectest lavftest lavfitest seektest
184

    
185
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
186
SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
187

    
188
codectest: fate-codec
189
lavftest:  fate-lavf
190
lavfitest: fate-lavfi
191
seektest:  fate-seek
192

    
193
AREF = tests/data/acodec.ref.wav
194
VREF = tests/data/vsynth1.ref.yuv
195
REFS = $(AREF) $(VREF)
196

    
197
$(REFS): TAG = GEN
198

    
199
$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
200
	$(M)$(SRC_PATH)/tests/codec-regression.sh vref vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
201
	$(Q)$(SRC_PATH)/tests/codec-regression.sh vref vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
202

    
203
$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
204
	$(M)$(SRC_PATH)/tests/codec-regression.sh aref acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
205

    
206
ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
207
	@echo
208
	@echo "Unfortunately ffserver is broken and therefore its regression"
209
	@echo "test fails randomly. Treat the results accordingly."
210
	@echo
211
	$(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
212

    
213
tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
214
	@mkdir -p tests/vsynth1
215
	$(M)$(BUILD_ROOT)/$< 'tests/vsynth1/'
216

    
217
tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
218
	@mkdir -p tests/vsynth2
219
	$(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
220

    
221
tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
222
	@mkdir -p tests/data
223
	$(M)$(BUILD_ROOT)/$< $@
224

    
225
tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
226

    
227
tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
228
	$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
229

    
230
tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS)
231
	$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
232

    
233
include $(SRC_PATH_BARE)/tests/fate.mak
234
include $(SRC_PATH_BARE)/tests/fate2.mak
235

    
236
include $(SRC_PATH_BARE)/tests/fate/aac.mak
237
include $(SRC_PATH_BARE)/tests/fate/als.mak
238
include $(SRC_PATH_BARE)/tests/fate/fft.mak
239
include $(SRC_PATH_BARE)/tests/fate/h264.mak
240
include $(SRC_PATH_BARE)/tests/fate/mp3.mak
241
include $(SRC_PATH_BARE)/tests/fate/vorbis.mak
242
include $(SRC_PATH_BARE)/tests/fate/vp8.mak
243

    
244
FATE_ACODEC  = $(ACODEC_TESTS:%=fate-acodec-%)
245
FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%)
246
FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%)
247
FATE_VCODEC  = $(FATE_VSYNTH1) $(FATE_VSYNTH2)
248
FATE_LAVF    = $(LAVF_TESTS:%=fate-lavf-%)
249
FATE_LAVFI   = $(LAVFI_TESTS:%=fate-lavfi-%)
250
FATE_SEEK    = $(SEEK_TESTS:seek_%=fate-seek-%)
251

    
252
FATE = $(FATE_ACODEC)                                                   \
253
       $(FATE_VCODEC)                                                   \
254
       $(FATE_LAVF)                                                     \
255
       $(FATE_LAVFI)                                                    \
256
       $(FATE_SEEK)                                                     \
257

    
258
$(FATE_ACODEC): $(AREF)
259
$(FATE_VCODEC): $(VREF)
260
$(FATE_LAVF):   $(REFS)
261
$(FATE_LAVFI):  $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
262
$(FATE_SEEK):   fate-codec fate-lavf tests/seek_test$(EXESUF)
263

    
264
$(FATE_ACODEC):  CMD = codectest acodec
265
$(FATE_VSYNTH1): CMD = codectest vsynth1
266
$(FATE_VSYNTH2): CMD = codectest vsynth2
267
$(FATE_LAVF):    CMD = lavftest
268
$(FATE_LAVFI):   CMD = lavfitest
269
$(FATE_SEEK):    CMD = seektest
270

    
271
fate-codec:  fate-acodec fate-vcodec
272
fate-acodec: $(FATE_ACODEC)
273
fate-vcodec: $(FATE_VCODEC)
274
fate-lavf:   $(FATE_LAVF)
275
fate-lavfi:  $(FATE_LAVFI)
276
fate-seek:   $(FATE_SEEK)
277

    
278
ifdef SAMPLES
279
FATE += $(FATE_TESTS)
280
else
281
$(FATE_TESTS):
282
	@echo "SAMPLES not specified, cannot run FATE"
283
endif
284

    
285
FATE_UTILS = base64 tiny_psnr
286

    
287
fate: $(FATE)
288

    
289
$(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
290
	@echo "TEST    $(@:fate-%=%)"
291
	$(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)'
292

    
293
fate-list:
294
	@printf '%s\n' $(sort $(FATE))
295

    
296
.PHONY: documentation *test regtest-* alltools check config