Makefile 8.29 KB
Newer Older
1 2 3 4 5 6 7 8
include config.mak

SRC_DIR = $(SRC_PATH_BARE)

vpath %.texi $(SRC_PATH_BARE)

PROGS-$(CONFIG_FFMPEG)   += ffmpeg
PROGS-$(CONFIG_FFPLAY)   += ffplay
Stefano Sabatini's avatar
Stefano Sabatini committed
9
PROGS-$(CONFIG_FFPROBE)  += ffprobe
10 11
PROGS-$(CONFIG_FFSERVER) += ffserver

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

Stefano Sabatini's avatar
Stefano Sabatini committed
21
BASENAMES   = ffmpeg ffplay ffprobe ffserver
22 23
ALLPROGS    = $(BASENAMES:%=%$(EXESUF))
ALLMANPAGES = $(BASENAMES:%=%.1)
24

25
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
26
FFLIBS-$(CONFIG_AVFILTER) += avfilter
27
FFLIBS-$(CONFIG_AVFORMAT) += avformat
Måns Rullgård's avatar
Måns Rullgård committed
28
FFLIBS-$(CONFIG_AVCODEC)  += avcodec
29
FFLIBS-$(CONFIG_POSTPROC) += postproc
30
FFLIBS-$(CONFIG_SWSCALE)  += swscale
31

32
FFLIBS := avutil
33

34 35
DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)

36 37
SKIPHEADERS = cmdutils_common_opts.h

38 39 40 41 42 43
include common.mak

FF_LDFLAGS   := $(FFLDFLAGS)
FF_EXTRALIBS := $(FFEXTRALIBS)
FF_DEP_LIBS  := $(DEP_LIBS)

44
all-$(CONFIG_DOC): documentation
45

46
all: $(FF_DEP_LIBS) $(PROGS)
47

48 49
config.h: .config
.config: $(wildcard $(FFLIBS:%=$(SRC_DIR)/lib%/all*.c))
50 51 52
	@-tput bold 2>/dev/null
	@-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
	@-tput sgr0 2>/dev/null
53

54
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
55
               ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
56
               HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS
57 58 59 60 61 62 63 64 65 66 67 68 69 70

define RESET
$(1) :=
$(1)-yes :=
endef

define DOSUBDIR
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
SUBDIR := $(1)/
include $(1)/Makefile
endef

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

71
ffplay.o: CFLAGS += $(SDL_CFLAGS)
72 73
ffplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
ffserver$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
74

75
$(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
76
	$(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
77

78 79
alltools: $(TOOLS)

Måns Rullgård's avatar
Måns Rullgård committed
80 81 82
tools/%$(EXESUF): tools/%.o
	$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)

83
tools/%.o: tools/%.c
84
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
85 86

-include $(wildcard tools/*.d)
87
-include $(wildcard tests/*.d)
88

Måns Rullgård's avatar
Måns Rullgård committed
89
VERSION_SH  = $(SRC_PATH_BARE)/version.sh
90
GIT_LOG     = $(SRC_PATH_BARE)/.git/logs/HEAD
Måns Rullgård's avatar
Måns Rullgård committed
91

92
.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
Måns Rullgård's avatar
Måns Rullgård committed
93 94 95
.version: M=@

version.h .version:
96
	$(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
Måns Rullgård's avatar
Måns Rullgård committed
97 98 99 100
	$(Q)touch .version

# force version.sh to run whenever version might have changed
-include .version
101

102
DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
103

104
documentation: $(DOCS)
105

106 107 108
-include $(wildcard $(DOCS:%=%.d))

TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
109

110
doc/%.html: TAG = HTML
111
doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init
112
	$(Q)$(TEXIDEP)
113
	$(M)texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init --output $@ $<
114

115
doc/%.pod: TAG = POD
116
doc/%.pod: doc/%.texi
117
	$(Q)$(TEXIDEP)
118
	$(M)doc/texi2pod.pl $< $@
119

120
doc/%.1: TAG = MAN
121
doc/%.1: doc/%.pod
122
	$(M)pod2man --section=1 --center=" " --release=" " $< > $@
123

124 125 126 127 128
ifdef PROGS
install: install-progs install-data
endif

install: install-libs install-headers
129 130

install-libs: install-libs-yes
131

132
install-progs-yes:
133 134 135 136
install-progs-$(CONFIG_DOC): install-man
install-progs-$(CONFIG_SHARED): install-libs

install-progs: install-progs-yes $(PROGS)
Måns Rullgård's avatar
Måns Rullgård committed
137
	$(Q)mkdir -p "$(BINDIR)"
138
	$(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
139

140
install-data: $(DATA_FILES)
Måns Rullgård's avatar
Måns Rullgård committed
141
	$(Q)mkdir -p "$(DATADIR)"
142
	$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
143

144
install-man: $(MANPAGES)
Måns Rullgård's avatar
Måns Rullgård committed
145
	$(Q)mkdir -p "$(MANDIR)/man1"
146
	$(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
147

148
uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data uninstall-man
Ramiro Polla's avatar
Ramiro Polla committed
149 150

uninstall-progs:
Måns Rullgård's avatar
Måns Rullgård committed
151
	$(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
Ramiro Polla's avatar
Ramiro Polla committed
152 153

uninstall-data:
Måns Rullgård's avatar
Måns Rullgård committed
154
	$(RM) -r "$(DATADIR)"
Ramiro Polla's avatar
Ramiro Polla committed
155 156

uninstall-man:
Måns Rullgård's avatar
Måns Rullgård committed
157
	$(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
158

159
testclean:
Måns Rullgård's avatar
Måns Rullgård committed
160 161 162
	$(RM) -r tests/vsynth1 tests/vsynth2 tests/data
	$(RM) $(addprefix tests/,$(CLEANSUFFIXES))
	$(RM) tests/seek_test$(EXESUF) tests/seek_test.o
163
	$(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF))
164 165

clean:: testclean
166
	$(RM) $(ALLPROGS)
Måns Rullgård's avatar
Måns Rullgård committed
167 168 169
	$(RM) $(CLEANSUFFIXES)
	$(RM) doc/*.html doc/*.pod doc/*.1
	$(RM) $(TOOLS)
170
	$(RM) $(CLEANSUFFIXES:%=tools/%)
171 172

distclean::
Måns Rullgård's avatar
Måns Rullgård committed
173
	$(RM) $(DISTCLEANSUFFIXES)
174
	$(RM) config.* .version version.h libavutil/avconfig.h
175

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

179 180
# regression tests

181 182
check: test checkheaders

183
fulltest test: codectest lavftest lavfitest seektest
184 185 186

FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref

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

192 193
AREF = fate-acodec-aref
VREF = fate-vsynth1-vref fate-vsynth2-vref
194 195
REFS = $(AREF) $(VREF)

196 197
$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
198

199
ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
200 201 202 203
	@echo
	@echo "Unfortunately ffserver is broken and therefore its regression"
	@echo "test fails randomly. Treat the results accordingly."
	@echo
204
	$(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
205

206
tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
207
	@mkdir -p tests/vsynth1
208
	$(M)./$< 'tests/vsynth1/'
209

210
tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
211
	@mkdir -p tests/vsynth2
212
	$(M)./$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
213

214
tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
215
	@mkdir -p tests/data
216
	$(M)./$< $@
217 218

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

220 221
tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
	$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
222

223 224 225
tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS)
	$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)

Måns Rullgård's avatar
Måns Rullgård committed
226
include $(SRC_PATH_BARE)/tests/fate.mak
227 228
include $(SRC_PATH_BARE)/tests/fate2.mak

229 230 231 232
include $(SRC_PATH_BARE)/tests/fate/aac.mak
include $(SRC_PATH_BARE)/tests/fate/als.mak
include $(SRC_PATH_BARE)/tests/fate/fft.mak
include $(SRC_PATH_BARE)/tests/fate/h264.mak
Vitor Sessak's avatar
Vitor Sessak committed
233
include $(SRC_PATH_BARE)/tests/fate/mp3.mak
234 235 236
include $(SRC_PATH_BARE)/tests/fate/vorbis.mak
include $(SRC_PATH_BARE)/tests/fate/vp8.mak

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

FATE = $(FATE_ACODEC)                                                   \
       $(FATE_VCODEC)                                                   \
       $(FATE_LAVF)                                                     \
       $(FATE_LAVFI)                                                    \
       $(FATE_SEEK)                                                     \

251 252
$(filter-out %-aref,$(FATE_ACODEC)): $(AREF)
$(filter-out %-vref,$(FATE_VCODEC)): $(VREF)
253
$(FATE_LAVF):   $(REFS)
254
$(FATE_LAVFI):  $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
$(FATE_SEEK):   fate-codec fate-lavf tests/seek_test$(EXESUF)

$(FATE_ACODEC):  CMD = codectest acodec
$(FATE_VSYNTH1): CMD = codectest vsynth1
$(FATE_VSYNTH2): CMD = codectest vsynth2
$(FATE_LAVF):    CMD = lavftest
$(FATE_LAVFI):   CMD = lavfitest
$(FATE_SEEK):    CMD = seektest

fate-codec:  fate-acodec fate-vcodec
fate-acodec: $(FATE_ACODEC)
fate-vcodec: $(FATE_VCODEC)
fate-lavf:   $(FATE_LAVF)
fate-lavfi:  $(FATE_LAVFI)
fate-seek:   $(FATE_SEEK)

271
ifdef SAMPLES
272
FATE += $(FATE_TESTS)
Reinhard Tartler's avatar
Reinhard Tartler committed
273 274
fate-rsync:
	rsync -vaLW rsync://fate-suite.libav.org/fate-suite/ $(SAMPLES)
Måns Rullgård's avatar
Måns Rullgård committed
275
else
Reinhard Tartler's avatar
Reinhard Tartler committed
276 277
fate-rsync:
	@echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate suite"
278
$(FATE_TESTS):
Måns Rullgård's avatar
Måns Rullgård committed
279 280
	@echo "SAMPLES not specified, cannot run FATE"
endif
281

Måns Rullgård's avatar
Måns Rullgård committed
282 283
FATE_UTILS = base64 tiny_psnr

284 285
fate: $(FATE)

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

290 291 292
fate-list:
	@printf '%s\n' $(sort $(FATE))

Mans Rullgard's avatar
Mans Rullgard committed
293 294
.PHONY: all alltools *clean check config documentation examples install*
.PHONY: *test testprogs uninstall*