lavc: properly handle subtitle_header in avcodec_copy_context()
[libav.git] / Makefile
CommitLineData
bde51e6a
JR
1include config.mak
2
f038cf3c
MR
3vpath %.c $(SRC_PATH)
4vpath %.h $(SRC_PATH)
5vpath %.S $(SRC_PATH)
6vpath %.asm $(SRC_PATH)
7vpath %.v $(SRC_PATH)
8vpath %.texi $(SRC_PATH)
bde51e6a 9
bb524924
MR
10ifndef V
11Q = @
12ECHO = printf "$(1)\t%s\n" $(2)
095792f2 13BRIEF = CC HOSTCC HOSTLD AS YASM AR LD
c7f25d4c 14SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM STRIP
bb524924
MR
15MSG = $@
16M = @$(call ECHO,$(TAG),$@);
17$(foreach VAR,$(BRIEF), \
18 $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
19$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
f038cf3c 20$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL))
bb524924
MR
21endif
22
c8af852b 23ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil swscale
371584c4 24
bb524924
MR
25IFLAGS := -I. -I$(SRC_PATH)
26CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
27CFLAGS += $(ECFLAGS)
a758c5e2
MR
28CCFLAGS = $(CPPFLAGS) $(CFLAGS)
29ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
04581c8c 30YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
4cc4b33f 31HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
8db73c61 32LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
bb524924 33
bc877faf 34define COMPILE
a758c5e2 35 $(call $(1)DEP,$(1))
23565c26 36 $($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $<
bc877faf
MR
37endef
38
39COMPILE_C = $(call COMPILE,CC)
40COMPILE_S = $(call COMPILE,AS)
ad477710 41COMPILE_HOSTC = $(call COMPILE,HOSTCC)
bc877faf 42
bb524924 43%.o: %.c
bc877faf 44 $(COMPILE_C)
bb524924
MR
45
46%.o: %.S
bc877faf 47 $(COMPILE_S)
bb524924 48
5a9fcc7d
DB
49%_host.o: %.c
50 $(COMPILE_HOSTC)
51
c2626492
MR
52%.i: %.c
53 $(CC) $(CCFLAGS) $(CC_E) $<
54
dfd9159f
MR
55%.h.c:
56 $(Q)echo '#include "$*.h"' >$@
bb524924
MR
57
58%.ver: %.v
59 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
60
61%.c %.h: TAG = GEN
62
14abeaa4
DB
63AVPROGS-$(CONFIG_AVCONV) += avconv
64AVPROGS-$(CONFIG_AVPLAY) += avplay
65AVPROGS-$(CONFIG_AVPROBE) += avprobe
66AVPROGS-$(CONFIG_AVSERVER) += avserver
bde51e6a 67
14abeaa4
DB
68AVPROGS := $(AVPROGS-yes:%=%$(EXESUF))
69PROGS += $(AVPROGS)
7671dd7c 70
14abeaa4
DB
71AVBASENAMES = avconv avplay avprobe avserver
72ALLAVPROGS = $(AVBASENAMES:%=%$(EXESUF))
73
dc80e2f7 74$(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o))
14abeaa4
DB
75
76OBJS-avconv += avconv_opt.o avconv_filter.o
7671dd7c 77OBJS-avconv-$(HAVE_VDPAU_X11) += avconv_vdpau.o
a61c2115 78OBJS-avconv-$(HAVE_DXVA2_LIB) += avconv_dxva2.o
1839fafa 79OBJS-avconv-$(CONFIG_VDA) += avconv_vda.o
7671dd7c 80
3d157bf3 81TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
0d0b81f9 82HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
28e1c979
MR
83TOOLS = qt-faststart trasher
84TOOLS-$(CONFIG_ZLIB) += cws2fws
bde51e6a 85
5a0f7131 86FFLIBS-$(CONFIG_AVDEVICE) += avdevice
bde51e6a 87FFLIBS-$(CONFIG_AVFILTER) += avfilter
5a0f7131 88FFLIBS-$(CONFIG_AVFORMAT) += avformat
c8af852b 89FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
97d5fa38 90FFLIBS-$(CONFIG_AVCODEC) += avcodec
5a0f7131 91FFLIBS-$(CONFIG_SWSCALE) += swscale
bde51e6a 92
5a0f7131 93FFLIBS := avutil
bde51e6a 94
8096fdf0 95DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
a1a84f69 96
90f9a583 97SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h
9b55e2e7 98
57b4a3dd 99include $(SRC_PATH)/common.mak
bde51e6a 100
bde51e6a
JR
101FF_EXTRALIBS := $(FFEXTRALIBS)
102FF_DEP_LIBS := $(DEP_LIBS)
103
14abeaa4 104all: $(AVPROGS)
bde51e6a 105
80521c19
MR
106$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
107 $(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
28e1c979 108
7baa115a 109tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
28e1c979 110
86601915 111config.h: .config
f038cf3c 112.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
9d0b3042
MR
113 @-tput bold 2>/dev/null
114 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
115 @-tput sgr0 2>/dev/null
86601915 116
e7e19b15 117SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
121604b0 118 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
8675bcb0 119 ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
b4dd424d 120 ALTIVEC-OBJS MMX-OBJS YASM-OBJS \
24d3796d 121 OBJS HOSTOBJS TESTOBJS
bde51e6a
JR
122
123define RESET
124$(1) :=
125$(1)-yes :=
126endef
127
128define DOSUBDIR
129$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
130SUBDIR := $(1)/
57b4a3dd 131include $(SRC_PATH)/$(1)/Makefile
07a873a2 132-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
144904e9 133include $(SRC_PATH)/library.mak
bde51e6a
JR
134endef
135
136$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
137
ab81f24a
DB
138include $(SRC_PATH)/doc/Makefile
139
baac24e6 140define DOPROG
14abeaa4 141OBJS-$(1) += $(1).o $(EXEOBJS) $(OBJS-$(1)-yes)
07b3790d 142$(1)$(EXESUF): $$(OBJS-$(1))
baac24e6
MR
143$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
144$(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
145$(1)$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
146-include $$(OBJS-$(1):.o=.d)
147endef
148
dc80e2f7 149$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(EXESUF)=))))
bde51e6a 150
07b3790d
MR
151$(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
152 $(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
bde51e6a 153
5e27ec28
MR
154OBJDIRS += tools
155
08df7f86 156-include $(wildcard tools/*.d)
bde51e6a 157
f038cf3c
MR
158VERSION_SH = $(SRC_PATH)/version.sh
159GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
6a53fffd 160
faa6f1c3 161.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
6a53fffd
MR
162.version: M=@
163
164version.h .version:
0853a2b4 165 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
6a53fffd
MR
166 $(Q)touch .version
167
168# force version.sh to run whenever version might have changed
169-include .version
36798f1b 170
14abeaa4 171ifdef AVPROGS
623ffe8c
MR
172install: install-progs install-data
173endif
174
175install: install-libs install-headers
d7a72d25
MR
176
177install-libs: install-libs-yes
bde51e6a 178
151c5841 179install-progs-yes:
623ffe8c
MR
180install-progs-$(CONFIG_SHARED): install-libs
181
14abeaa4 182install-progs: install-progs-yes $(AVPROGS)
63611f31 183 $(Q)mkdir -p "$(BINDIR)"
14abeaa4 184 $(INSTALL) -c -m 755 $(AVPROGS) "$(BINDIR)"
bde51e6a 185
a1a84f69 186install-data: $(DATA_FILES)
63611f31 187 $(Q)mkdir -p "$(DATADIR)"
fd676deb 188 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 189
f87b03b5 190uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
d3cb93b3
RP
191
192uninstall-progs:
14abeaa4 193 $(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
d3cb93b3
RP
194
195uninstall-data:
50e10cbd 196 $(RM) -r "$(DATADIR)"
d3cb93b3 197
698a183e 198clean::
14abeaa4 199 $(RM) $(ALLAVPROGS)
50e10cbd 200 $(RM) $(CLEANSUFFIXES)
40321376 201 $(RM) $(CLEANSUFFIXES:%=tools/%)
a862c7d3 202 $(RM) -rf coverage.info lcov
bde51e6a
JR
203
204distclean::
50e10cbd 205 $(RM) $(DISTCLEANSUFFIXES)
b4d24b47 206 $(RM) config.* .config libavutil/avconfig.h .version version.h
bde51e6a 207
9d0b3042 208config:
29ba0911 209 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
0c3b2d65 210
4982e1dd
DB
211check: all alltools checkheaders examples testprogs fate
212
57b4a3dd 213include $(SRC_PATH)/tests/Makefile
d29d9ccc 214
5e27ec28
MR
215$(sort $(OBJDIRS)):
216 $(Q)mkdir -p $@
217
8d853efe
MR
218# Dummy rule to stop make trying to rebuild removed or renamed headers
219%.h:
220 @:
221
222# Disable suffix rules. Most of the builtin rules are suffix rules,
223# so this saves some time on slow systems.
224.SUFFIXES:
225
4982e1dd 226.PHONY: all all-yes alltools check *clean config examples install*
698a183e 227.PHONY: testprogs uninstall*