avconv: add support for VDPAU decoding
[libav.git] / Makefile
1 include config.mak
2
3 vpath %.c $(SRC_PATH)
4 vpath %.h $(SRC_PATH)
5 vpath %.S $(SRC_PATH)
6 vpath %.asm $(SRC_PATH)
7 vpath %.v $(SRC_PATH)
8 vpath %.texi $(SRC_PATH)
9
10 ifndef V
11 Q = @
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
15 MSG = $@
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))
21 endif
22
23 ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil swscale
24
25 IFLAGS := -I. -I$(SRC_PATH)
26 CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
27 CFLAGS += $(ECFLAGS)
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)
33
34 define COMPILE
35 $(call $(1)DEP,$(1))
36 $($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $<
37 endef
38
39 COMPILE_C = $(call COMPILE,CC)
40 COMPILE_S = $(call COMPILE,AS)
41
42 %.o: %.c
43 $(COMPILE_C)
44
45 %.o: %.S
46 $(COMPILE_S)
47
48 %.i: %.c
49 $(CC) $(CCFLAGS) $(CC_E) $<
50
51 %.h.c:
52 $(Q)echo '#include "$*.h"' >$@
53
54 %.ver: %.v
55 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
56
57 %.c %.h: TAG = GEN
58
59 PROGS-$(CONFIG_AVCONV) += avconv
60 PROGS-$(CONFIG_AVPLAY) += avplay
61 PROGS-$(CONFIG_AVPROBE) += avprobe
62 PROGS-$(CONFIG_AVSERVER) += avserver
63
64 PROGS := $(PROGS-yes:%=%$(EXESUF))
65
66 OBJS-avconv = avconv_opt.o avconv_filter.o
67 OBJS-avconv-$(HAVE_VDPAU_X11) += avconv_vdpau.o
68
69 TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
70 HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
71 TOOLS = qt-faststart trasher
72 TOOLS-$(CONFIG_ZLIB) += cws2fws
73
74 BASENAMES = avconv avplay avprobe avserver
75 ALLPROGS = $(BASENAMES:%=%$(EXESUF))
76 ALLMANPAGES = $(BASENAMES:%=%.1)
77
78 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
79 FFLIBS-$(CONFIG_AVFILTER) += avfilter
80 FFLIBS-$(CONFIG_AVFORMAT) += avformat
81 FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
82 FFLIBS-$(CONFIG_AVCODEC) += avcodec
83 FFLIBS-$(CONFIG_SWSCALE) += swscale
84
85 FFLIBS := avutil
86
87 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
88
89 SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h
90
91 include $(SRC_PATH)/common.mak
92
93 FF_EXTRALIBS := $(FFEXTRALIBS)
94 FF_DEP_LIBS := $(DEP_LIBS)
95
96 all: $(PROGS)
97
98 $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
99 $(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
100
101 tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
102
103 config.h: .config
104 .config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
105 @-tput bold 2>/dev/null
106 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
107 @-tput sgr0 2>/dev/null
108
109 SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
110 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
111 ARMV5TE-OBJS ARMV6-OBJS VFP-OBJS NEON-OBJS \
112 ALTIVEC-OBJS VIS-OBJS \
113 MMX-OBJS YASM-OBJS \
114 OBJS HOSTOBJS TESTOBJS
115
116 define RESET
117 $(1) :=
118 $(1)-yes :=
119 endef
120
121 define DOSUBDIR
122 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
123 SUBDIR := $(1)/
124 include $(SRC_PATH)/$(1)/Makefile
125 -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
126 include $(SRC_PATH)/library.mak
127 endef
128
129 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
130
131 define DOPROG
132 OBJS-$(1) += $(1).o cmdutils.o $(EXEOBJS) $(OBJS-$(1)-yes)
133 $(1)$(EXESUF): $$(OBJS-$(1))
134 $$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
135 $(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
136 $(1)$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
137 -include $$(OBJS-$(1):.o=.d)
138 endef
139
140 $(foreach P,$(PROGS-yes),$(eval $(call DOPROG,$(P))))
141
142 $(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
143 $(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
144
145 OBJDIRS += tools
146
147 -include $(wildcard tools/*.d)
148
149 VERSION_SH = $(SRC_PATH)/version.sh
150 GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
151
152 .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
153 .version: M=@
154
155 version.h .version:
156 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
157 $(Q)touch .version
158
159 # force version.sh to run whenever version might have changed
160 -include .version
161
162 ifdef PROGS
163 install: install-progs install-data
164 endif
165
166 install: install-libs install-headers
167
168 install-libs: install-libs-yes
169
170 install-progs-yes:
171 install-progs-$(CONFIG_SHARED): install-libs
172
173 install-progs: install-progs-yes $(PROGS)
174 $(Q)mkdir -p "$(BINDIR)"
175 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
176
177 install-data: $(DATA_FILES)
178 $(Q)mkdir -p "$(DATADIR)"
179 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
180
181 uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
182
183 uninstall-progs:
184 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
185
186 uninstall-data:
187 $(RM) -r "$(DATADIR)"
188
189 clean::
190 $(RM) $(ALLPROGS)
191 $(RM) $(CLEANSUFFIXES)
192 $(RM) $(CLEANSUFFIXES:%=tools/%)
193 $(RM) -rf coverage.info lcov
194
195 distclean::
196 $(RM) $(DISTCLEANSUFFIXES)
197 $(RM) config.* .config libavutil/avconfig.h .version version.h
198
199 config:
200 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
201
202 check: all alltools checkheaders examples testprogs fate
203
204 include $(SRC_PATH)/doc/Makefile
205 include $(SRC_PATH)/tests/Makefile
206
207 $(sort $(OBJDIRS)):
208 $(Q)mkdir -p $@
209
210 # Dummy rule to stop make trying to rebuild removed or renamed headers
211 %.h:
212 @:
213
214 # Disable suffix rules. Most of the builtin rules are suffix rules,
215 # so this saves some time on slow systems.
216 .SUFFIXES:
217
218 .PHONY: all all-yes alltools check *clean config examples install*
219 .PHONY: testprogs uninstall*