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