Remove ffmpeg.
[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
14SILENT = DEPCC YASMDEP RM RANLIB
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
371584c4
MR
23ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
24
bb524924
MR
25IFLAGS := -I. -I$(SRC_PATH)
26CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
27CFLAGS += $(ECFLAGS)
bc877faf 28CCFLAGS = $(CFLAGS)
cc73511e 29YASMFLAGS += $(IFLAGS) -I$(SRC_PATH)/libavutil/x86/ -Pconfig.asm
bb524924 30HOSTCFLAGS += $(IFLAGS)
371584c4 31LDFLAGS := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS)
bb524924 32
bc877faf
MR
33define COMPILE
34 $($(1)DEP)
35 $($(1)) $(CPPFLAGS) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $<
36endef
37
38COMPILE_C = $(call COMPILE,CC)
39COMPILE_S = $(call COMPILE,AS)
40
bb524924 41%.o: %.c
bc877faf 42 $(COMPILE_C)
bb524924
MR
43
44%.o: %.S
bc877faf 45 $(COMPILE_S)
bb524924
MR
46
47%.ho: %.h
48 $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
49
50%.ver: %.v
51 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
52
53%.c %.h: TAG = GEN
54
6291d7e4 55PROGS-$(CONFIG_AVCONV) += avconv
266463da 56PROGS-$(CONFIG_AVPLAY) += avplay
9e12f0bf 57PROGS-$(CONFIG_AVPROBE) += avprobe
4d58e4cb 58PROGS-$(CONFIG_AVSERVER) += avserver
bde51e6a 59
583fcb52 60PROGS := $(PROGS-yes:%=%$(EXESUF))
583fcb52 61OBJS = $(PROGS-yes:%=%.o) cmdutils.o
3d157bf3
MR
62TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
63HOSTPROGS := $(TESTTOOLS:%=tests/%)
28e1c979
MR
64TOOLS = qt-faststart trasher
65TOOLS-$(CONFIG_ZLIB) += cws2fws
bde51e6a 66
0fec2cb1 67BASENAMES = avconv avplay avprobe avserver
583fcb52 68ALLPROGS = $(BASENAMES:%=%$(EXESUF))
583fcb52 69ALLMANPAGES = $(BASENAMES:%=%.1)
bde51e6a 70
5a0f7131 71FFLIBS-$(CONFIG_AVDEVICE) += avdevice
bde51e6a 72FFLIBS-$(CONFIG_AVFILTER) += avfilter
5a0f7131 73FFLIBS-$(CONFIG_AVFORMAT) += avformat
97d5fa38 74FFLIBS-$(CONFIG_AVCODEC) += avcodec
bde51e6a 75FFLIBS-$(CONFIG_POSTPROC) += postproc
5a0f7131 76FFLIBS-$(CONFIG_SWSCALE) += swscale
bde51e6a 77
5a0f7131 78FFLIBS := avutil
bde51e6a 79
8096fdf0 80DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
a1a84f69 81
9b55e2e7
MR
82SKIPHEADERS = cmdutils_common_opts.h
83
57b4a3dd 84include $(SRC_PATH)/common.mak
bde51e6a 85
bde51e6a
JR
86FF_EXTRALIBS := $(FFEXTRALIBS)
87FF_DEP_LIBS := $(DEP_LIBS)
88
1fef92fd 89all: $(PROGS)
bde51e6a 90
28e1c979
MR
91$(TOOLS): %$(EXESUF): %.o
92 $(LD) $(LDFLAGS) -o $@ $< $(ELIBS)
93
94tools/cws2fws$(EXESUF): ELIBS = -lz
95
86601915 96config.h: .config
f038cf3c 97.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
9d0b3042
MR
98 @-tput bold 2>/dev/null
99 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
100 @-tput sgr0 2>/dev/null
86601915 101
95f2c769 102SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
de4070b5 103 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
28e1c979 104 HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS TOOLS
bde51e6a
JR
105
106define RESET
107$(1) :=
108$(1)-yes :=
109endef
110
111define DOSUBDIR
112$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
113SUBDIR := $(1)/
57b4a3dd 114include $(SRC_PATH)/$(1)/Makefile
144904e9 115include $(SRC_PATH)/library.mak
bde51e6a
JR
116endef
117
118$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
119
266463da
AK
120avplay.o: CFLAGS += $(SDL_CFLAGS)
121avplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
4d58e4cb 122avserver$(EXESUF): LDFLAGS += $(AVSERVERLDFLAGS)
bde51e6a 123
6d170962 124$(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
ca903615 125 $(LD) $(LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
bde51e6a 126
5e27ec28
MR
127OBJDIRS += tools
128
08df7f86 129-include $(wildcard tools/*.d)
bde51e6a 130
f038cf3c
MR
131VERSION_SH = $(SRC_PATH)/version.sh
132GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
6a53fffd 133
faa6f1c3 134.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
6a53fffd
MR
135.version: M=@
136
137version.h .version:
0853a2b4 138 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
6a53fffd
MR
139 $(Q)touch .version
140
141# force version.sh to run whenever version might have changed
142-include .version
36798f1b 143
623ffe8c
MR
144ifdef PROGS
145install: install-progs install-data
146endif
147
148install: install-libs install-headers
d7a72d25
MR
149
150install-libs: install-libs-yes
bde51e6a 151
151c5841 152install-progs-yes:
623ffe8c
MR
153install-progs-$(CONFIG_SHARED): install-libs
154
155install-progs: install-progs-yes $(PROGS)
63611f31 156 $(Q)mkdir -p "$(BINDIR)"
fd676deb 157 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
bde51e6a 158
a1a84f69 159install-data: $(DATA_FILES)
63611f31 160 $(Q)mkdir -p "$(DATADIR)"
fd676deb 161 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 162
f87b03b5 163uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
d3cb93b3
RP
164
165uninstall-progs:
50e10cbd 166 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
d3cb93b3
RP
167
168uninstall-data:
50e10cbd 169 $(RM) -r "$(DATADIR)"
d3cb93b3 170
698a183e 171clean::
e0be794a 172 $(RM) $(ALLPROGS)
50e10cbd 173 $(RM) $(CLEANSUFFIXES)
50e10cbd 174 $(RM) $(TOOLS)
40321376 175 $(RM) $(CLEANSUFFIXES:%=tools/%)
bde51e6a
JR
176
177distclean::
50e10cbd 178 $(RM) $(DISTCLEANSUFFIXES)
59748689 179 $(RM) config.* .version version.h libavutil/avconfig.h
bde51e6a 180
9d0b3042 181config:
29ba0911 182 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
0c3b2d65 183
57b4a3dd
MR
184include $(SRC_PATH)/doc/Makefile
185include $(SRC_PATH)/tests/Makefile
d29d9ccc 186
5e27ec28
MR
187$(sort $(OBJDIRS)):
188 $(Q)mkdir -p $@
189
8d853efe
MR
190# Dummy rule to stop make trying to rebuild removed or renamed headers
191%.h:
192 @:
193
194# Disable suffix rules. Most of the builtin rules are suffix rules,
195# so this saves some time on slow systems.
196.SUFFIXES:
197
db54be09 198.PHONY: all all-yes alltools *clean config examples install*
698a183e 199.PHONY: testprogs uninstall*