Makefile 8.37 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_TARGETS-$(CONFIG_DOC)       += documentation
45

Måns Rullgård's avatar
Måns Rullgård committed
46
ifdef PROGS
47
INSTALL_TARGETS-yes             += install-progs install-data
48
INSTALL_TARGETS-$(CONFIG_DOC)   += install-man
49
endif
50
INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
51 52 53

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

54 55
config.h: .config
.config: $(wildcard $(FFLIBS:%=$(SRC_DIR)/lib%/all*.c))
56 57 58
	@-tput bold 2>/dev/null
	@-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
	@-tput sgr0 2>/dev/null
59

60
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
61
               ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
62
               HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS
63 64 65 66 67 68 69 70 71 72 73 74 75 76

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))))

77 78
ffplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
ffserver$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
79

80
%$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
81
	$(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
82

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

86
tools/%.o: tools/%.c
87
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
88 89

-include $(wildcard tools/*.d)
90
-include $(wildcard tests/*.d)
91

92
ffplay.o: CFLAGS += $(SDL_CFLAGS)
93

Måns Rullgård's avatar
Måns Rullgård committed
94
VERSION_SH  = $(SRC_PATH_BARE)/version.sh
95
GIT_LOG     = $(SRC_PATH_BARE)/.git/logs/HEAD
Måns Rullgård's avatar
Måns Rullgård committed
96

97
.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
Måns Rullgård's avatar
Måns Rullgård committed
98 99 100
.version: M=@

version.h .version:
101
	$(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
Måns Rullgård's avatar
Måns Rullgård committed
102 103 104 105
	$(Q)touch .version

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

107
alltools: $(TOOLS)
108

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

111
documentation: $(DOCS)
112

113 114 115
-include $(wildcard $(DOCS:%=%.d))

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

117
doc/%.html: TAG = HTML
118
doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init
119
	$(Q)$(TEXIDEP)
120
	$(M)texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init --output $@ $<
121

122
doc/%.pod: TAG = POD
123
doc/%.pod: doc/%.texi
124
	$(Q)$(TEXIDEP)
125
	$(M)doc/texi2pod.pl $< $@
126

127
doc/%.1: TAG = MAN
128
doc/%.1: doc/%.pod
129
	$(M)pod2man --section=1 --center=" " --release=" " $< > $@
130

131 132 133
install: install-libs install-headers $(INSTALL_TARGETS-yes)

install-libs: install-libs-yes
134 135

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

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

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

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

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

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

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

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

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

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

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

178 179
# regression tests

180 181
check: test checkheaders

182
fulltest test: codectest lavftest lavfitest seektest
183 184 185

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

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

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

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

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

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

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

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

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

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

222 223 224
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
225
include $(SRC_PATH_BARE)/tests/fate.mak
226 227
include $(SRC_PATH_BARE)/tests/fate2.mak

228 229 230 231
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
232
include $(SRC_PATH_BARE)/tests/fate/mp3.mak
233 234 235
include $(SRC_PATH_BARE)/tests/fate/vorbis.mak
include $(SRC_PATH_BARE)/tests/fate/vp8.mak

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

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

250 251
$(filter-out %-aref,$(FATE_ACODEC)): $(AREF)
$(filter-out %-vref,$(FATE_VCODEC)): $(VREF)
252
$(FATE_LAVF):   $(REFS)
253
$(FATE_LAVFI):  $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
$(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)

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

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

283 284
fate: $(FATE)

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

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

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