Add new yuv444 pixfmts to avcodec_align_dimensions2
[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 IFLAGS := -I. -I$(SRC_PATH)
24 CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
25 CFLAGS += $(ECFLAGS)
26 CCFLAGS = $(CFLAGS)
27 YASMFLAGS += $(IFLAGS) -Pconfig.asm
28 HOSTCFLAGS += $(IFLAGS)
29
30 define COMPILE
31 $($(1)DEP)
32 $($(1)) $(CPPFLAGS) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $<
33 endef
34
35 COMPILE_C = $(call COMPILE,CC)
36 COMPILE_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
52 PROGS-$(CONFIG_FFMPEG) += ffmpeg
53 PROGS-$(CONFIG_FFPLAY) += ffplay
54 PROGS-$(CONFIG_FFPROBE) += ffprobe
55 PROGS-$(CONFIG_FFSERVER) += ffserver
56
57 PROGS := $(PROGS-yes:%=%$(EXESUF))
58 OBJS = $(PROGS-yes:%=%.o) cmdutils.o
59 TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws graph2dot lavfi-showfiltfmts pktdumper probetest qt-faststart trasher))
60 TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
61 HOSTPROGS := $(TESTTOOLS:%=tests/%)
62
63 BASENAMES = ffmpeg ffplay ffprobe ffserver
64 ALLPROGS = $(BASENAMES:%=%$(EXESUF))
65 ALLMANPAGES = $(BASENAMES:%=%.1)
66
67 ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
68
69 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
70 FFLIBS-$(CONFIG_AVFILTER) += avfilter
71 FFLIBS-$(CONFIG_AVFORMAT) += avformat
72 FFLIBS-$(CONFIG_AVCODEC) += avcodec
73 FFLIBS-$(CONFIG_POSTPROC) += postproc
74 FFLIBS-$(CONFIG_SWSCALE) += swscale
75
76 FFLIBS := avutil
77
78 DATA_FILES := $(wildcard $(SRC_PATH)/ffpresets/*.ffpreset)
79
80 SKIPHEADERS = cmdutils_common_opts.h
81
82 include $(SRC_PATH)/common.mak
83
84 FF_LDFLAGS := $(FFLDFLAGS)
85 FF_EXTRALIBS := $(FFEXTRALIBS)
86 FF_DEP_LIBS := $(DEP_LIBS)
87
88 all: $(FF_DEP_LIBS) $(PROGS)
89
90 config.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
96 SUBDIR_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
100 define RESET
101 $(1) :=
102 $(1)-yes :=
103 endef
104
105 define DOSUBDIR
106 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
107 SUBDIR := $(1)/
108 include $(SRC_PATH)/$(1)/Makefile
109 endef
110
111 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
112
113 ffplay.o: CFLAGS += $(SDL_CFLAGS)
114 ffplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
115 ffserver$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
116
117 $(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
118 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
119
120 alltools: $(TOOLS)
121
122 tools/%$(EXESUF): tools/%.o
123 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
124
125 tools/%.o: tools/%.c
126 $(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
127
128 -include $(wildcard tools/*.d)
129
130 VERSION_SH = $(SRC_PATH)/version.sh
131 GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
132
133 .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
134 .version: M=@
135
136 version.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
143 ifdef PROGS
144 install: install-progs install-data
145 endif
146
147 install: install-libs install-headers
148
149 install-libs: install-libs-yes
150
151 install-progs-yes:
152 install-progs-$(CONFIG_SHARED): install-libs
153
154 install-progs: install-progs-yes $(PROGS)
155 $(Q)mkdir -p "$(BINDIR)"
156 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
157
158 install-data: $(DATA_FILES)
159 $(Q)mkdir -p "$(DATADIR)"
160 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
161
162 uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
163
164 uninstall-progs:
165 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
166
167 uninstall-data:
168 $(RM) -r "$(DATADIR)"
169
170 clean::
171 $(RM) $(ALLPROGS)
172 $(RM) $(CLEANSUFFIXES)
173 $(RM) $(TOOLS)
174 $(RM) $(CLEANSUFFIXES:%=tools/%)
175
176 distclean::
177 $(RM) $(DISTCLEANSUFFIXES)
178 $(RM) config.* .version version.h libavutil/avconfig.h
179
180 config:
181 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
182
183 check: test checkheaders
184
185 include $(SRC_PATH)/doc/Makefile
186 include $(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*