Remove ffmpeg.
[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 AS YASM AR LD HOSTCC
14 SILENT = DEPCC YASMDEP RM RANLIB
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 avutil postproc swscale
24
25 IFLAGS := -I. -I$(SRC_PATH)
26 CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
27 CFLAGS += $(ECFLAGS)
28 CCFLAGS = $(CFLAGS)
29 YASMFLAGS += $(IFLAGS) -I$(SRC_PATH)/libavutil/x86/ -Pconfig.asm
30 HOSTCFLAGS += $(IFLAGS)
31 LDFLAGS := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS)
32
33 define COMPILE
34 $($(1)DEP)
35 $($(1)) $(CPPFLAGS) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $<
36 endef
37
38 COMPILE_C = $(call COMPILE,CC)
39 COMPILE_S = $(call COMPILE,AS)
40
41 %.o: %.c
42 $(COMPILE_C)
43
44 %.o: %.S
45 $(COMPILE_S)
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
55 PROGS-$(CONFIG_AVCONV) += avconv
56 PROGS-$(CONFIG_AVPLAY) += avplay
57 PROGS-$(CONFIG_AVPROBE) += avprobe
58 PROGS-$(CONFIG_AVSERVER) += avserver
59
60 PROGS := $(PROGS-yes:%=%$(EXESUF))
61 OBJS = $(PROGS-yes:%=%.o) cmdutils.o
62 TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
63 HOSTPROGS := $(TESTTOOLS:%=tests/%)
64 TOOLS = qt-faststart trasher
65 TOOLS-$(CONFIG_ZLIB) += cws2fws
66
67 BASENAMES = avconv avplay avprobe avserver
68 ALLPROGS = $(BASENAMES:%=%$(EXESUF))
69 ALLMANPAGES = $(BASENAMES:%=%.1)
70
71 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
72 FFLIBS-$(CONFIG_AVFILTER) += avfilter
73 FFLIBS-$(CONFIG_AVFORMAT) += avformat
74 FFLIBS-$(CONFIG_AVCODEC) += avcodec
75 FFLIBS-$(CONFIG_POSTPROC) += postproc
76 FFLIBS-$(CONFIG_SWSCALE) += swscale
77
78 FFLIBS := avutil
79
80 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
81
82 SKIPHEADERS = cmdutils_common_opts.h
83
84 include $(SRC_PATH)/common.mak
85
86 FF_EXTRALIBS := $(FFEXTRALIBS)
87 FF_DEP_LIBS := $(DEP_LIBS)
88
89 all: $(PROGS)
90
91 $(TOOLS): %$(EXESUF): %.o
92 $(LD) $(LDFLAGS) -o $@ $< $(ELIBS)
93
94 tools/cws2fws$(EXESUF): ELIBS = -lz
95
96 config.h: .config
97 .config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
98 @-tput bold 2>/dev/null
99 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
100 @-tput sgr0 2>/dev/null
101
102 SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
103 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
104 HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS TOOLS
105
106 define RESET
107 $(1) :=
108 $(1)-yes :=
109 endef
110
111 define DOSUBDIR
112 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
113 SUBDIR := $(1)/
114 include $(SRC_PATH)/$(1)/Makefile
115 include $(SRC_PATH)/library.mak
116 endef
117
118 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
119
120 avplay.o: CFLAGS += $(SDL_CFLAGS)
121 avplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
122 avserver$(EXESUF): LDFLAGS += $(AVSERVERLDFLAGS)
123
124 $(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
125 $(LD) $(LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
126
127 OBJDIRS += tools
128
129 -include $(wildcard tools/*.d)
130
131 VERSION_SH = $(SRC_PATH)/version.sh
132 GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
133
134 .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
135 .version: M=@
136
137 version.h .version:
138 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
139 $(Q)touch .version
140
141 # force version.sh to run whenever version might have changed
142 -include .version
143
144 ifdef PROGS
145 install: install-progs install-data
146 endif
147
148 install: install-libs install-headers
149
150 install-libs: install-libs-yes
151
152 install-progs-yes:
153 install-progs-$(CONFIG_SHARED): install-libs
154
155 install-progs: install-progs-yes $(PROGS)
156 $(Q)mkdir -p "$(BINDIR)"
157 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
158
159 install-data: $(DATA_FILES)
160 $(Q)mkdir -p "$(DATADIR)"
161 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
162
163 uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
164
165 uninstall-progs:
166 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
167
168 uninstall-data:
169 $(RM) -r "$(DATADIR)"
170
171 clean::
172 $(RM) $(ALLPROGS)
173 $(RM) $(CLEANSUFFIXES)
174 $(RM) $(TOOLS)
175 $(RM) $(CLEANSUFFIXES:%=tools/%)
176
177 distclean::
178 $(RM) $(DISTCLEANSUFFIXES)
179 $(RM) config.* .version version.h libavutil/avconfig.h
180
181 config:
182 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
183
184 include $(SRC_PATH)/doc/Makefile
185 include $(SRC_PATH)/tests/Makefile
186
187 $(sort $(OBJDIRS)):
188 $(Q)mkdir -p $@
189
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
198 .PHONY: all all-yes alltools *clean config examples install*
199 .PHONY: testprogs uninstall*