6 vpath %.asm $(SRC_PATH)
8 vpath %.texi $(SRC_PATH)
12 ECHO = printf "$(1)\t%s\n" $(2)
13 BRIEF = CC HOSTCC HOSTLD AS YASM AR LD
14 SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM STRIP
16 M = @$(call ECHO,$(TAG),$@);
17 $(foreach VAR,$(BRIEF), \
18 $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
19 $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
20 $(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL))
23 ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil swscale
25 IFLAGS := -I. -I$(SRC_PATH)
26 CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
28 CCFLAGS = $(CPPFLAGS) $(CFLAGS)
29 ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
30 YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
31 HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
32 LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
36 $($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $<
39 COMPILE_C = $(call COMPILE,CC)
40 COMPILE_S = $(call COMPILE,AS)
41 COMPILE_HOSTC = $(call COMPILE,HOSTCC)
53 $(CC) $(CCFLAGS) $(CC_E) $<
56 $(Q)echo '#include "$*.h"' >$@
59 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
63 AVPROGS-$(CONFIG_AVCONV) += avconv
64 AVPROGS-$(CONFIG_AVPLAY) += avplay
65 AVPROGS-$(CONFIG_AVPROBE) += avprobe
67 AVPROGS := $(AVPROGS-yes:%=%$(EXESUF))
70 AVBASENAMES = avconv avplay avprobe
71 ALLAVPROGS = $(AVBASENAMES:%=%$(EXESUF))
73 $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o))
75 OBJS-avconv += avconv_opt.o avconv_filter.o
76 OBJS-avconv-$(HAVE_VDPAU_X11) += avconv_vdpau.o
77 OBJS-avconv-$(HAVE_DXVA2_LIB) += avconv_dxva2.o
78 OBJS-avconv-$(CONFIG_VDA) += avconv_vda.o
80 TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
81 HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
82 TOOLS = qt-faststart trasher
83 TOOLS-$(CONFIG_ZLIB) += cws2fws
85 # $(FFLIBS-yes) needs to be in linking order
86 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
87 FFLIBS-$(CONFIG_AVFILTER) += avfilter
88 FFLIBS-$(CONFIG_AVFORMAT) += avformat
89 FFLIBS-$(CONFIG_AVCODEC) += avcodec
90 FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
91 FFLIBS-$(CONFIG_SWSCALE) += swscale
95 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
97 SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h
99 include $(SRC_PATH)/common.mak
101 FF_EXTRALIBS := $(FFEXTRALIBS)
102 FF_DEP_LIBS := $(DEP_LIBS)
106 $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
107 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS)
109 tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
112 .config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
113 @-tput bold 2>/dev/null
114 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
115 @-tput sgr0 2>/dev/null
117 SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
118 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
119 ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
120 ALTIVEC-OBJS MMX-OBJS YASM-OBJS \
121 OBJS HOSTOBJS TESTOBJS
129 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
131 include $(SRC_PATH)/$(1)/Makefile
132 -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
133 -include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
134 include $(SRC_PATH)/library.mak
137 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
139 include $(SRC_PATH)/doc/Makefile
142 OBJS-$(1) += $(1).o $(EXEOBJS) $(OBJS-$(1)-yes)
143 $(1)$(EXESUF): $$(OBJS-$(1))
144 $$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
145 $(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
146 $(1)$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
147 -include $$(OBJS-$(1):.o=.d)
150 $(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(EXESUF)=))))
152 $(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
153 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
157 -include $(wildcard tools/*.d)
159 VERSION_SH = $(SRC_PATH)/version.sh
160 GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
162 .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
166 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
169 # force version.sh to run whenever version might have changed
173 install: install-progs install-data
176 install: install-libs install-headers
178 install-libs: install-libs-yes
181 install-progs-$(CONFIG_SHARED): install-libs
183 install-progs: install-progs-yes $(AVPROGS)
184 $(Q)mkdir -p "$(BINDIR)"
185 $(INSTALL) -c -m 755 $(AVPROGS) "$(BINDIR)"
187 install-data: $(DATA_FILES)
188 $(Q)mkdir -p "$(DATADIR)"
189 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
191 uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
194 $(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
197 $(RM) -r "$(DATADIR)"
201 $(RM) $(CLEANSUFFIXES)
202 $(RM) $(CLEANSUFFIXES:%=tools/%)
203 $(RM) -rf coverage.info lcov
206 $(RM) $(DISTCLEANSUFFIXES)
207 $(RM) config.* .config libavutil/avconfig.h .version version.h
210 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
212 check: all alltools checkheaders examples testprogs fate
214 include $(SRC_PATH)/tests/Makefile
219 # Dummy rule to stop make trying to rebuild removed or renamed headers
223 # Disable suffix rules. Most of the builtin rules are suffix rules,
224 # so this saves some time on slow systems.
227 .PHONY: all all-yes alltools check *clean config examples install*
228 .PHONY: testprogs uninstall*