5 vpath %.cpp $(SRC_PATH)
7 vpath %.inc $(SRC_PATH)
10 vpath %.asm $(SRC_PATH)
11 vpath %.rc $(SRC_PATH)
13 vpath %.texi $(SRC_PATH)
14 vpath %/fate_config.sh.template $(SRC_PATH)
16 AVPROGS-$(CONFIG_FFMPEG) += ffmpeg
17 AVPROGS-$(CONFIG_FFPLAY) += ffplay
18 AVPROGS-$(CONFIG_FFPROBE) += ffprobe
19 AVPROGS-$(CONFIG_FFSERVER) += ffserver
21 AVPROGS := $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF))
22 INSTPROGS = $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF))
25 AVBASENAMES = ffmpeg ffplay ffprobe ffserver
26 ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF))
27 ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
29 $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o))
30 $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_opencl.o))
32 OBJS-ffmpeg += ffmpeg_opt.o ffmpeg_filter.o
33 OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += ffmpeg_videotoolbox.o
34 OBJS-ffmpeg-$(CONFIG_LIBMFX) += ffmpeg_qsv.o
35 OBJS-ffmpeg-$(CONFIG_VAAPI) += ffmpeg_vaapi.o
36 ifndef CONFIG_VIDEOTOOLBOX
37 OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o
39 OBJS-ffmpeg-$(CONFIG_CUVID) += ffmpeg_cuvid.o
40 OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o
41 OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o
42 OBJS-ffserver += ffserver_config.o
44 TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
45 HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
47 # $(FFLIBS-yes) needs to be in linking order
48 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
49 FFLIBS-$(CONFIG_AVFILTER) += avfilter
50 FFLIBS-$(CONFIG_AVFORMAT) += avformat
51 FFLIBS-$(CONFIG_AVCODEC) += avcodec
52 FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
53 FFLIBS-$(CONFIG_POSTPROC) += postproc
54 FFLIBS-$(CONFIG_SWRESAMPLE) += swresample
55 FFLIBS-$(CONFIG_SWSCALE) += swscale
59 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
60 EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile $(SRC_PATH)/doc/examples/README
62 SKIPHEADERS = cmdutils_common_opts.h \
65 # first so "all" becomes default target
68 include $(SRC_PATH)/tools/Makefile
69 include $(SRC_PATH)/common.mak
71 FF_EXTRALIBS := $(FFEXTRALIBS)
72 FF_DEP_LIBS := $(DEP_LIBS)
73 FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
77 $(TOOLS): %$(EXESUF): %.o
78 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS)
80 CONFIGURABLE_COMPONENTS = \
81 $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
82 $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/version.h)) \
83 $(SRC_PATH)/libavcodec/bitstream_filters.c \
84 $(SRC_PATH)/libavformat/protocols.c \
87 .config: $(CONFIGURABLE_COMPONENTS)
88 @-tput bold 2>/dev/null
89 @-printf '\nWARNING: $(?) newer than config.h, rerun configure\n\n'
90 @-tput sgr0 2>/dev/null
92 SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
93 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
94 ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
95 ALTIVEC-OBJS VSX-OBJS MMX-OBJS YASM-OBJS \
96 MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
97 MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS
105 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
107 include $(SRC_PATH)/$(1)/Makefile
108 -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
109 -include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
110 include $(SRC_PATH)/library.mak
113 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
115 include $(SRC_PATH)/doc/Makefile
118 OBJS-$(1) += $(1).o $(OBJS-$(1)-yes)
119 $(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1))
120 $$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
121 $(1)$(PROGSSUF)_g$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
122 $(1)$(PROGSSUF)_g$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
123 -include $$(OBJS-$(1):.o=.d)
126 $(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=))))
128 ffprobe.o cmdutils.o libavcodec/utils.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.o : libavutil/ffversion.h
130 $(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
134 %$(PROGSSUF)_g$(EXESUF): %.o $(FF_DEP_LIBS)
135 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
137 VERSION_SH = $(SRC_PATH)/version.sh
138 GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
140 .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
143 libavutil/ffversion.h .version:
144 $(M)$(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION)
147 # force version.sh to run whenever version might have changed
151 install: install-progs install-data
154 install: install-libs install-headers
156 install-libs: install-libs-yes
159 install-progs-$(CONFIG_SHARED): install-libs
161 install-progs: install-progs-yes $(AVPROGS)
162 $(Q)mkdir -p "$(BINDIR)"
163 $(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)"
165 install-data: $(DATA_FILES) $(EXAMPLES_FILES)
166 $(Q)mkdir -p "$(DATADIR)/examples"
167 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
168 $(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples"
170 uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
173 $(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
176 $(RM) -r "$(DATADIR)"
179 $(RM) $(ALLAVPROGS) $(ALLAVPROGS_G)
180 $(RM) $(CLEANSUFFIXES)
181 $(RM) $(CLEANSUFFIXES:%=compat/msvcrt/%)
182 $(RM) $(CLEANSUFFIXES:%=compat/atomics/pthread/%)
183 $(RM) $(CLEANSUFFIXES:%=compat/%)
184 $(RM) -r coverage-html
185 $(RM) -rf coverage.info coverage.info.in lcov
188 $(RM) $(DISTCLEANSUFFIXES)
189 $(RM) config.* .config libavutil/avconfig.h .version mapfile avversion.h version.h libavutil/ffversion.h libavcodec/codec_names.h libavcodec/bsf_list.c libavformat/protocol_list.c
190 ifeq ($(SRC_LINK),src)
193 $(RM) -rf doc/examples/pc-uninstalled
196 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
198 check: all alltools examples testprogs fate
200 include $(SRC_PATH)/tests/Makefile
205 # Dummy rule to stop make trying to rebuild removed or renamed headers
209 # Disable suffix rules. Most of the builtin rules are suffix rules,
210 # so this saves some time on slow systems.
213 .PHONY: all all-yes alltools check *clean config install*
214 .PHONY: testprogs uninstall*