6 vpath %.asm $(SRC_PATH)
8 vpath %.texi $(SRC_PATH)
12 ECHO = printf "$(1)\t%s\n" $(2)
13 BRIEF = CC AS YASM AR LD HOSTCC
14 SILENT = DEPCC DEPAS DEPHOSTCC YASMDEP RM RANLIB
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) -I$(SRC_PATH)/libavutil/x86/ -Pconfig.asm
31 HOSTCFLAGS += $(IFLAGS)
32 LDFLAGS := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS)
36 $($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $<
39 COMPILE_C = $(call COMPILE,CC)
40 COMPILE_S = $(call COMPILE,AS)
49 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ -x c $<
52 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
56 PROGS-$(CONFIG_AVCONV) += avconv
57 PROGS-$(CONFIG_AVPLAY) += avplay
58 PROGS-$(CONFIG_AVPROBE) += avprobe
59 PROGS-$(CONFIG_AVSERVER) += avserver
61 PROGS := $(PROGS-yes:%=%$(EXESUF))
62 OBJS = $(PROGS-yes:%=%.o) cmdutils.o
63 TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
64 HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
65 TOOLS = qt-faststart trasher
66 TOOLS-$(CONFIG_ZLIB) += cws2fws
68 BASENAMES = avconv avplay avprobe avserver
69 ALLPROGS = $(BASENAMES:%=%$(EXESUF))
70 ALLMANPAGES = $(BASENAMES:%=%.1)
72 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
73 FFLIBS-$(CONFIG_AVFILTER) += avfilter
74 FFLIBS-$(CONFIG_AVFORMAT) += avformat
75 FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
76 FFLIBS-$(CONFIG_AVCODEC) += avcodec
77 FFLIBS-$(CONFIG_SWSCALE) += swscale
81 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
83 SKIPHEADERS = cmdutils_common_opts.h
85 include $(SRC_PATH)/common.mak
87 FF_EXTRALIBS := $(FFEXTRALIBS)
88 FF_DEP_LIBS := $(DEP_LIBS)
92 $(TOOLS): %$(EXESUF): %.o
93 $(LD) $(LDFLAGS) -o $@ $< $(ELIBS)
95 tools/cws2fws$(EXESUF): ELIBS = -lz
98 .config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
99 @-tput bold 2>/dev/null
100 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
101 @-tput sgr0 2>/dev/null
103 SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
104 ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
105 ALTIVEC-OBJS ARMV5TE-OBJS ARMV6-OBJS ARMVFP-OBJS MMI-OBJS \
106 MMX-OBJS NEON-OBJS VIS-OBJS YASM-OBJS \
115 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
117 include $(SRC_PATH)/$(1)/Makefile
118 -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
119 include $(SRC_PATH)/library.mak
122 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
124 avplay.o: CFLAGS += $(SDL_CFLAGS)
125 avplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
126 avserver$(EXESUF): LDFLAGS += $(AVSERVERLDFLAGS)
128 $(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
129 $(LD) $(LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
133 -include $(wildcard tools/*.d)
135 VERSION_SH = $(SRC_PATH)/version.sh
136 GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
138 .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
142 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
145 # force version.sh to run whenever version might have changed
149 install: install-progs install-data
152 install: install-libs install-headers
154 install-libs: install-libs-yes
157 install-progs-$(CONFIG_SHARED): install-libs
159 install-progs: install-progs-yes $(PROGS)
160 $(Q)mkdir -p "$(BINDIR)"
161 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
163 install-data: $(DATA_FILES)
164 $(Q)mkdir -p "$(DATADIR)"
165 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
167 uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
170 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
173 $(RM) -r "$(DATADIR)"
177 $(RM) $(CLEANSUFFIXES)
179 $(RM) $(CLEANSUFFIXES:%=tools/%)
182 $(RM) $(DISTCLEANSUFFIXES)
183 $(RM) config.* .version version.h libavutil/avconfig.h
186 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
188 check: all alltools checkheaders examples testprogs fate
190 include $(SRC_PATH)/doc/Makefile
191 include $(SRC_PATH)/tests/Makefile
196 # Dummy rule to stop make trying to rebuild removed or renamed headers
200 # Disable suffix rules. Most of the builtin rules are suffix rules,
201 # so this saves some time on slow systems.
204 .PHONY: all all-yes alltools check *clean config examples install*
205 .PHONY: testprogs uninstall*