Add new yuv444 pixfmts to avcodec_align_dimensions2
[libav.git] / Makefile
... / ...
CommitLineData
1include config.mak
2
3vpath %.c $(SRC_PATH)
4vpath %.h $(SRC_PATH)
5vpath %.S $(SRC_PATH)
6vpath %.asm $(SRC_PATH)
7vpath %.v $(SRC_PATH)
8vpath %.texi $(SRC_PATH)
9
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))))
20$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL))
21endif
22
23IFLAGS := -I. -I$(SRC_PATH)
24CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
25CFLAGS += $(ECFLAGS)
26CCFLAGS = $(CFLAGS)
27YASMFLAGS += $(IFLAGS) -Pconfig.asm
28HOSTCFLAGS += $(IFLAGS)
29
30define COMPILE
31 $($(1)DEP)
32 $($(1)) $(CPPFLAGS) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $<
33endef
34
35COMPILE_C = $(call COMPILE,CC)
36COMPILE_S = $(call COMPILE,AS)
37
38%.o: %.c
39 $(COMPILE_C)
40
41%.o: %.S
42 $(COMPILE_S)
43
44%.ho: %.h
45 $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
46
47%.ver: %.v
48 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
49
50%.c %.h: TAG = GEN
51
52PROGS-$(CONFIG_FFMPEG) += ffmpeg
53PROGS-$(CONFIG_FFPLAY) += ffplay
54PROGS-$(CONFIG_FFPROBE) += ffprobe
55PROGS-$(CONFIG_FFSERVER) += ffserver
56
57PROGS := $(PROGS-yes:%=%$(EXESUF))
58OBJS = $(PROGS-yes:%=%.o) cmdutils.o
59TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws graph2dot lavfi-showfiltfmts pktdumper probetest qt-faststart trasher))
60TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
61HOSTPROGS := $(TESTTOOLS:%=tests/%)
62
63BASENAMES = ffmpeg ffplay ffprobe ffserver
64ALLPROGS = $(BASENAMES:%=%$(EXESUF))
65ALLMANPAGES = $(BASENAMES:%=%.1)
66
67ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
68
69FFLIBS-$(CONFIG_AVDEVICE) += avdevice
70FFLIBS-$(CONFIG_AVFILTER) += avfilter
71FFLIBS-$(CONFIG_AVFORMAT) += avformat
72FFLIBS-$(CONFIG_AVCODEC) += avcodec
73FFLIBS-$(CONFIG_POSTPROC) += postproc
74FFLIBS-$(CONFIG_SWSCALE) += swscale
75
76FFLIBS := avutil
77
78DATA_FILES := $(wildcard $(SRC_PATH)/ffpresets/*.ffpreset)
79
80SKIPHEADERS = cmdutils_common_opts.h
81
82include $(SRC_PATH)/common.mak
83
84FF_LDFLAGS := $(FFLDFLAGS)
85FF_EXTRALIBS := $(FFEXTRALIBS)
86FF_DEP_LIBS := $(DEP_LIBS)
87
88all: $(FF_DEP_LIBS) $(PROGS)
89
90config.h: .config
91.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
92 @-tput bold 2>/dev/null
93 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
94 @-tput sgr0 2>/dev/null
95
96SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
97 ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
98 HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS
99
100define RESET
101$(1) :=
102$(1)-yes :=
103endef
104
105define DOSUBDIR
106$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
107SUBDIR := $(1)/
108include $(SRC_PATH)/$(1)/Makefile
109endef
110
111$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
112
113ffplay.o: CFLAGS += $(SDL_CFLAGS)
114ffplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
115ffserver$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
116
117$(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
118 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
119
120alltools: $(TOOLS)
121
122tools/%$(EXESUF): tools/%.o
123 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
124
125tools/%.o: tools/%.c
126 $(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
127
128-include $(wildcard tools/*.d)
129
130VERSION_SH = $(SRC_PATH)/version.sh
131GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
132
133.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
134.version: M=@
135
136version.h .version:
137 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
138 $(Q)touch .version
139
140# force version.sh to run whenever version might have changed
141-include .version
142
143ifdef PROGS
144install: install-progs install-data
145endif
146
147install: install-libs install-headers
148
149install-libs: install-libs-yes
150
151install-progs-yes:
152install-progs-$(CONFIG_SHARED): install-libs
153
154install-progs: install-progs-yes $(PROGS)
155 $(Q)mkdir -p "$(BINDIR)"
156 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
157
158install-data: $(DATA_FILES)
159 $(Q)mkdir -p "$(DATADIR)"
160 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
161
162uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
163
164uninstall-progs:
165 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
166
167uninstall-data:
168 $(RM) -r "$(DATADIR)"
169
170clean::
171 $(RM) $(ALLPROGS)
172 $(RM) $(CLEANSUFFIXES)
173 $(RM) $(TOOLS)
174 $(RM) $(CLEANSUFFIXES:%=tools/%)
175
176distclean::
177 $(RM) $(DISTCLEANSUFFIXES)
178 $(RM) config.* .version version.h libavutil/avconfig.h
179
180config:
181 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
182
183check: test checkheaders
184
185include $(SRC_PATH)/doc/Makefile
186include $(SRC_PATH)/tests/Makefile
187
188# Dummy rule to stop make trying to rebuild removed or renamed headers
189%.h:
190 @:
191
192# Disable suffix rules. Most of the builtin rules are suffix rules,
193# so this saves some time on slow systems.
194.SUFFIXES:
195
196.PHONY: all alltools *clean check config examples install*
197.PHONY: testprogs uninstall*