]> git.sesse.net Git - ffmpeg/blob - Makefile
wmalosslessdec: Reset residues to 0 if they were not decoded from bitstream.
[ffmpeg] / Makefile
1 MAIN_MAKEFILE=1
2 include config.mak
3
4 vpath %.c    $(SRC_PATH)
5 vpath %.cpp  $(SRC_PATH)
6 vpath %.h    $(SRC_PATH)
7 vpath %.S    $(SRC_PATH)
8 vpath %.asm  $(SRC_PATH)
9 vpath %.v    $(SRC_PATH)
10 vpath %.texi $(SRC_PATH)
11 vpath %/fate_config.sh.template $(SRC_PATH)
12
13 PROGS-$(CONFIG_FFMPEG)   += ffmpeg
14 PROGS-$(CONFIG_FFPLAY)   += ffplay
15 PROGS-$(CONFIG_FFPROBE)  += ffprobe
16 PROGS-$(CONFIG_FFSERVER) += ffserver
17
18 PROGS      := $(PROGS-yes:%=%$(EXESUF))
19 INSTPROGS   = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
20 OBJS        = $(PROGS-yes:%=%.o) cmdutils.o
21 TESTTOOLS   = audiogen videogen rotozoom tiny_psnr base64
22 HOSTPROGS  := $(TESTTOOLS:%=tests/%) doc/print_options
23 TOOLS       = qt-faststart trasher
24 TOOLS-$(CONFIG_ZLIB) += cws2fws
25
26 BASENAMES   = ffmpeg ffplay ffprobe ffserver
27 ALLPROGS    = $(BASENAMES:%=%$(PROGSSUF)$(EXESUF))
28 ALLPROGS_G  = $(BASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
29 ALLMANPAGES = $(BASENAMES:%=%.1)
30
31 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
32 FFLIBS-$(CONFIG_AVFILTER) += avfilter
33 FFLIBS-$(CONFIG_AVFORMAT) += avformat
34 FFLIBS-$(CONFIG_AVCODEC)  += avcodec
35 FFLIBS-$(CONFIG_POSTPROC) += postproc
36 FFLIBS-$(CONFIG_SWRESAMPLE)+= swresample
37 FFLIBS-$(CONFIG_SWSCALE)  += swscale
38
39 FFLIBS := avutil
40
41 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
42
43 SKIPHEADERS = cmdutils_common_opts.h
44
45 include $(SRC_PATH)/common.mak
46
47 FF_EXTRALIBS := $(FFEXTRALIBS)
48 FF_DEP_LIBS  := $(DEP_LIBS)
49
50 all: $(PROGS)
51
52 $(PROGS): %$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
53         $(CP) $< $@$(PROGSSUF)
54         $(STRIP) $@$(PROGSSUF)
55
56 $(TOOLS): %$(EXESUF): %.o
57         $(LD) $(LDFLAGS) -o $@ $< $(ELIBS)
58
59 tools/cws2fws$(EXESUF): ELIBS = -lz
60
61 config.h: .config
62 .config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
63         @-tput bold 2>/dev/null
64         @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
65         @-tput sgr0 2>/dev/null
66
67 SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS      \
68                ARCH_HEADERS BUILT_HEADERS SKIPHEADERS                    \
69                ALTIVEC-OBJS ARMV6-OBJS MMX-OBJS NEON-OBJS YASM-OBJS      \
70                OBJS TESTOBJS
71
72 define RESET
73 $(1) :=
74 $(1)-yes :=
75 endef
76
77 define DOSUBDIR
78 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
79 SUBDIR := $(1)/
80 include $(SRC_PATH)/$(1)/Makefile
81 -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
82 include $(SRC_PATH)/library.mak
83 endef
84
85 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
86
87 ffplay.o: CFLAGS += $(SDL_CFLAGS)
88 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
89 ffserver_g$(EXESUF): LDFLAGS += $(FFSERVERLDFLAGS)
90
91 %$(PROGSSUF)_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
92         $(LD) $(LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
93
94 OBJDIRS += tools
95
96 -include $(wildcard tools/*.d)
97
98 VERSION_SH  = $(SRC_PATH)/version.sh
99 GIT_LOG     = $(SRC_PATH)/.git/logs/HEAD
100
101 .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
102 .version: M=@
103
104 version.h .version:
105         $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
106         $(Q)touch .version
107
108 # force version.sh to run whenever version might have changed
109 -include .version
110
111 ifdef PROGS
112 install: install-progs install-data
113 endif
114
115 install: install-libs install-headers
116
117 install-libs: install-libs-yes
118
119 install-progs-yes:
120 install-progs-$(CONFIG_SHARED): install-libs
121
122 install-progs: install-progs-yes $(PROGS)
123         $(Q)mkdir -p "$(BINDIR)"
124         $(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)"
125
126 install-data: $(DATA_FILES)
127         $(Q)mkdir -p "$(DATADIR)"
128         $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
129
130 uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
131
132 uninstall-progs:
133         $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
134
135 uninstall-data:
136         $(RM) -r "$(DATADIR)"
137
138 clean::
139         $(RM) $(ALLPROGS) $(ALLPROGS_G)
140         $(RM) $(CLEANSUFFIXES)
141         $(RM) $(TOOLS)
142         $(RM) $(CLEANSUFFIXES:%=tools/%)
143         $(RM) coverage.info
144         $(RM) -r coverage-html
145
146 distclean::
147         $(RM) $(DISTCLEANSUFFIXES)
148         $(RM) config.* .version version.h libavutil/avconfig.h
149
150 config:
151         $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
152
153 # Without the sed genthml thinks "libavutil" and "./libavutil" are two different things
154 coverage.info: $(wildcard *.gcda *.gcno */*.gcda */*.gcno */*/*.gcda */*/*.gcno)
155         $(Q)lcov -c -d . -b . | sed -e 's#/./#/#g' > $@
156
157 coverage-html: coverage.info
158         $(Q)mkdir -p $@
159         $(Q)genhtml -o $@ $<
160         $(Q)touch $@
161
162 include $(SRC_PATH)/doc/Makefile
163 include $(SRC_PATH)/tests/Makefile
164
165 $(sort $(OBJDIRS)):
166         $(Q)mkdir -p $@
167
168 # Dummy rule to stop make trying to rebuild removed or renamed headers
169 %.h:
170         @:
171
172 # Disable suffix rules.  Most of the builtin rules are suffix rules,
173 # so this saves some time on slow systems.
174 .SUFFIXES:
175
176 .PHONY: all all-yes alltools *clean config examples install*
177 .PHONY: testprogs uninstall*