1 include avbuild/config.mak
7 vpath %.asm $(SRC_PATH)
9 vpath %.texi $(SRC_PATH)
13 ECHO = printf "$(1)\t%s\n" $(2)
14 BRIEF = CC HOSTCC HOSTLD AS YASM AR LD
15 SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM STRIP
17 M = @$(call ECHO,$(TAG),$@);
18 $(foreach VAR,$(BRIEF), \
19 $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
20 $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
21 $(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL))
24 ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil swscale
26 IFLAGS := -I. -I$(SRC_PATH)
27 CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
29 CCFLAGS = $(CPPFLAGS) $(CFLAGS)
30 OBJCFLAGS += $(EOBJCFLAGS)
31 OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
32 ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
33 YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
34 HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
35 LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
39 $($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $<
42 COMPILE_C = $(call COMPILE,CC)
43 COMPILE_S = $(call COMPILE,AS)
44 COMPILE_M = $(call COMPILE,OBJCC)
45 COMPILE_HOSTC = $(call COMPILE,HOSTCC)
60 $(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
61 $(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
62 -$(STRIP) $(STRIPFLAGS) $@
65 $(CC) $(CCFLAGS) $(CC_E) $<
68 $(Q)echo '#include "$*.h"' >$@
70 %.c %.h %.pc %.ver %.version: TAG = GEN
72 AVPROGS-$(CONFIG_AVCONV) += avconv
73 AVPROGS-$(CONFIG_AVPLAY) += avplay
74 AVPROGS-$(CONFIG_AVPROBE) += avprobe
76 AVPROGS := $(AVPROGS-yes:%=%$(EXESUF))
79 AVBASENAMES = avconv avplay avprobe
80 ALLAVPROGS = $(AVBASENAMES:%=%$(EXESUF))
82 $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o))
84 OBJS-avconv += avconv_opt.o avconv_filter.o
85 OBJS-avconv-$(CONFIG_LIBMFX) += avconv_qsv.o
86 OBJS-avconv-$(CONFIG_VAAPI) += avconv_vaapi.o
87 OBJS-avconv-$(CONFIG_VDA) += avconv_vda.o
88 OBJS-avconv-$(HAVE_DXVA2_LIB) += avconv_dxva2.o
89 OBJS-avconv-$(HAVE_VDPAU_X11) += avconv_vdpau.o
91 TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
92 HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
94 # $(FFLIBS-yes) needs to be in linking order
95 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
96 FFLIBS-$(CONFIG_AVFILTER) += avfilter
97 FFLIBS-$(CONFIG_AVFORMAT) += avformat
98 FFLIBS-$(CONFIG_AVCODEC) += avcodec
99 FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
100 FFLIBS-$(CONFIG_SWSCALE) += swscale
104 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
106 SKIPHEADERS = compat/w32pthreads.h
108 # first so "all" becomes default target
111 include $(SRC_PATH)/tools/Makefile
112 include $(SRC_PATH)/avbuild/common.mak
114 FF_EXTRALIBS := $(FFEXTRALIBS)
115 FF_DEP_LIBS := $(DEP_LIBS)
116 FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
120 $(TOOLS): %$(EXESUF): %.o
121 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS) $(ELIBS)
123 CONFIGURABLE_COMPONENTS = \
124 $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
125 $(SRC_PATH)/libavcodec/bitstream_filters.c \
126 $(SRC_PATH)/libavformat/protocols.c \
128 config.h: avbuild/.config
129 avbuild/.config: $(CONFIGURABLE_COMPONENTS)
130 @-tput bold 2>/dev/null
131 @-printf '\nWARNING: $(?) newer than config.h, rerun configure\n\n'
132 @-tput sgr0 2>/dev/null
134 SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
135 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
136 ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
137 ALTIVEC-OBJS VSX-OBJS MMX-OBJS YASM-OBJS \
138 OBJS HOSTOBJS TESTOBJS
146 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
148 include $(SRC_PATH)/$(1)/Makefile
149 -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
150 -include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
151 include $(SRC_PATH)/avbuild/library.mak
154 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
156 include $(SRC_PATH)/doc/Makefile
157 include $(SRC_PATH)/doc/examples/Makefile
160 OBJS-$(1) += $(1).o $(OBJS-$(1)-yes)
161 $(1)$(EXESUF): $$(OBJS-$(1))
162 $$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
163 $(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
164 $(1)$(EXESUF): FF_EXTRALIBS += $(EXTRALIBS-$(1))
165 -include $$(OBJS-$(1):.o=.d)
168 $(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(EXESUF)=))))
170 $(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
171 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
173 VERSION_SH = $(SRC_PATH)/avbuild/version.sh
174 GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
176 .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) avbuild/config.mak
179 cmdutils.o libavutil/utils.o: avversion.h
180 avversion.h .version:
181 $(M)$(VERSION_SH) $(SRC_PATH) avversion.h $(EXTRA_VERSION)
184 # force version.sh to run whenever version might have changed
188 install: install-progs install-data
191 install: install-libs install-headers
193 install-libs: install-libs-yes
196 install-progs-$(CONFIG_SHARED): install-libs
198 install-progs: install-progs-yes $(AVPROGS)
199 $(Q)mkdir -p "$(BINDIR)"
200 $(INSTALL) -c -m 755 $(AVPROGS) "$(BINDIR)"
202 install-data: $(DATA_FILES)
203 $(Q)mkdir -p "$(DATADIR)"
204 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
206 uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
209 $(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
212 $(RM) -r "$(DATADIR)"
216 $(RM) $(CLEANSUFFIXES)
217 $(RM) -rf coverage.info lcov
220 $(RM) $(DISTCLEANSUFFIXES)
221 $(RM) .version avversion.h config.asm config.h mapfile \
222 avbuild/.config avbuild/config.* libavutil/avconfig.h \
223 libavcodec/bsf_list.c libavformat/protocol_list.c
226 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
228 check: all alltools checkheaders examples testprogs fate
230 include $(SRC_PATH)/tests/Makefile
235 # Dummy rule to stop make trying to rebuild removed or renamed headers
239 # Disable suffix rules. Most of the builtin rules are suffix rules,
240 # so this saves some time on slow systems.
243 .PHONY: all all-yes alltools check *clean config install* testprogs uninstall*