id3v2: fix reading unsynchronized frames.
[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
5864eb42 14SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM
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
b9d3c378 31HOSTCCFLAGS = $(IFLAGS) $(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)
41
bb524924 42%.o: %.c
bc877faf 43 $(COMPILE_C)
bb524924
MR
44
45%.o: %.S
bc877faf 46 $(COMPILE_S)
bb524924 47
dfd9159f
MR
48%.h.c:
49 $(Q)echo '#include "$*.h"' >$@
bb524924
MR
50
51%.ver: %.v
52 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
53
54%.c %.h: TAG = GEN
55
6291d7e4 56PROGS-$(CONFIG_AVCONV) += avconv
266463da 57PROGS-$(CONFIG_AVPLAY) += avplay
9e12f0bf 58PROGS-$(CONFIG_AVPROBE) += avprobe
4d58e4cb 59PROGS-$(CONFIG_AVSERVER) += avserver
bde51e6a 60
583fcb52 61PROGS := $(PROGS-yes:%=%$(EXESUF))
80521c19 62OBJS = cmdutils.o $(EXEOBJS)
fe2147e9 63OBJS-avconv = avconv_opt.o avconv_filter.o
3d157bf3 64TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
0d0b81f9 65HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
28e1c979
MR
66TOOLS = qt-faststart trasher
67TOOLS-$(CONFIG_ZLIB) += cws2fws
bde51e6a 68
0fec2cb1 69BASENAMES = avconv avplay avprobe avserver
583fcb52 70ALLPROGS = $(BASENAMES:%=%$(EXESUF))
583fcb52 71ALLMANPAGES = $(BASENAMES:%=%.1)
bde51e6a 72
5a0f7131 73FFLIBS-$(CONFIG_AVDEVICE) += avdevice
bde51e6a 74FFLIBS-$(CONFIG_AVFILTER) += avfilter
5a0f7131 75FFLIBS-$(CONFIG_AVFORMAT) += avformat
c8af852b 76FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
97d5fa38 77FFLIBS-$(CONFIG_AVCODEC) += avcodec
5a0f7131 78FFLIBS-$(CONFIG_SWSCALE) += swscale
bde51e6a 79
5a0f7131 80FFLIBS := avutil
bde51e6a 81
8096fdf0 82DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
a1a84f69 83
9b55e2e7
MR
84SKIPHEADERS = cmdutils_common_opts.h
85
57b4a3dd 86include $(SRC_PATH)/common.mak
bde51e6a 87
bde51e6a
JR
88FF_EXTRALIBS := $(FFEXTRALIBS)
89FF_DEP_LIBS := $(DEP_LIBS)
90
1fef92fd 91all: $(PROGS)
bde51e6a 92
80521c19
MR
93$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
94 $(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
28e1c979 95
7baa115a 96tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
28e1c979 97
86601915 98config.h: .config
f038cf3c 99.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
9d0b3042
MR
100 @-tput bold 2>/dev/null
101 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
102 @-tput sgr0 2>/dev/null
86601915 103
e7e19b15 104SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
121604b0 105 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
5864eb42 106 ARMV5TE-OBJS ARMV6-OBJS ARMVFP-OBJS NEON-OBJS \
ca411fc1 107 ALTIVEC-OBJS VIS-OBJS \
5864eb42 108 MMX-OBJS YASM-OBJS \
24d3796d 109 OBJS HOSTOBJS TESTOBJS
bde51e6a
JR
110
111define RESET
112$(1) :=
113$(1)-yes :=
114endef
115
116define DOSUBDIR
117$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
118SUBDIR := $(1)/
57b4a3dd 119include $(SRC_PATH)/$(1)/Makefile
07a873a2 120-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
144904e9 121include $(SRC_PATH)/library.mak
bde51e6a
JR
122endef
123
124$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
125
baac24e6 126define DOPROG
80521c19 127OBJS-$(1) += $(1).o cmdutils.o $(EXEOBJS)
07b3790d 128$(1)$(EXESUF): $$(OBJS-$(1))
baac24e6
MR
129$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
130$(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
131$(1)$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
132-include $$(OBJS-$(1):.o=.d)
133endef
134
135$(foreach P,$(PROGS-yes),$(eval $(call DOPROG,$(P))))
bde51e6a 136
07b3790d
MR
137$(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
138 $(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
bde51e6a 139
5e27ec28
MR
140OBJDIRS += tools
141
08df7f86 142-include $(wildcard tools/*.d)
bde51e6a 143
f038cf3c
MR
144VERSION_SH = $(SRC_PATH)/version.sh
145GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
6a53fffd 146
faa6f1c3 147.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
6a53fffd
MR
148.version: M=@
149
150version.h .version:
0853a2b4 151 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
6a53fffd
MR
152 $(Q)touch .version
153
154# force version.sh to run whenever version might have changed
155-include .version
36798f1b 156
623ffe8c
MR
157ifdef PROGS
158install: install-progs install-data
159endif
160
161install: install-libs install-headers
d7a72d25
MR
162
163install-libs: install-libs-yes
bde51e6a 164
151c5841 165install-progs-yes:
623ffe8c
MR
166install-progs-$(CONFIG_SHARED): install-libs
167
168install-progs: install-progs-yes $(PROGS)
63611f31 169 $(Q)mkdir -p "$(BINDIR)"
fd676deb 170 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
bde51e6a 171
a1a84f69 172install-data: $(DATA_FILES)
63611f31 173 $(Q)mkdir -p "$(DATADIR)"
fd676deb 174 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 175
f87b03b5 176uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
d3cb93b3
RP
177
178uninstall-progs:
50e10cbd 179 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
d3cb93b3
RP
180
181uninstall-data:
50e10cbd 182 $(RM) -r "$(DATADIR)"
d3cb93b3 183
698a183e 184clean::
e0be794a 185 $(RM) $(ALLPROGS)
50e10cbd 186 $(RM) $(CLEANSUFFIXES)
50e10cbd 187 $(RM) $(TOOLS)
40321376 188 $(RM) $(CLEANSUFFIXES:%=tools/%)
bde51e6a
JR
189
190distclean::
50e10cbd 191 $(RM) $(DISTCLEANSUFFIXES)
59748689 192 $(RM) config.* .version version.h libavutil/avconfig.h
bde51e6a 193
9d0b3042 194config:
29ba0911 195 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
0c3b2d65 196
4982e1dd
DB
197check: all alltools checkheaders examples testprogs fate
198
57b4a3dd
MR
199include $(SRC_PATH)/doc/Makefile
200include $(SRC_PATH)/tests/Makefile
d29d9ccc 201
5e27ec28
MR
202$(sort $(OBJDIRS)):
203 $(Q)mkdir -p $@
204
8d853efe
MR
205# Dummy rule to stop make trying to rebuild removed or renamed headers
206%.h:
207 @:
208
209# Disable suffix rules. Most of the builtin rules are suffix rules,
210# so this saves some time on slow systems.
211.SUFFIXES:
212
4982e1dd 213.PHONY: all all-yes alltools check *clean config examples install*
698a183e 214.PHONY: testprogs uninstall*