nut: Mark non-fatal errors as warnings
[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)
095792f2 13BRIEF = CC HOSTCC HOSTLD AS YASM AR LD
c7f25d4c 14SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM STRIP
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)
04581c8c 30YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
4cc4b33f 31HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
8db73c61 32LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(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)
ad477710 41COMPILE_HOSTC = $(call COMPILE,HOSTCC)
bc877faf 42
bb524924 43%.o: %.c
bc877faf 44 $(COMPILE_C)
bb524924
MR
45
46%.o: %.S
bc877faf 47 $(COMPILE_S)
bb524924 48
5a9fcc7d
DB
49%_host.o: %.c
50 $(COMPILE_HOSTC)
51
c2626492
MR
52%.i: %.c
53 $(CC) $(CCFLAGS) $(CC_E) $<
54
dfd9159f
MR
55%.h.c:
56 $(Q)echo '#include "$*.h"' >$@
bb524924
MR
57
58%.ver: %.v
c1aac39e
SM
59 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ | sed -e 's/:/:\
60/' -e 's/; /;\
61/g' > $@
bb524924
MR
62
63%.c %.h: TAG = GEN
64
14abeaa4
DB
65AVPROGS-$(CONFIG_AVCONV) += avconv
66AVPROGS-$(CONFIG_AVPLAY) += avplay
67AVPROGS-$(CONFIG_AVPROBE) += avprobe
bde51e6a 68
14abeaa4
DB
69AVPROGS := $(AVPROGS-yes:%=%$(EXESUF))
70PROGS += $(AVPROGS)
7671dd7c 71
894682a9 72AVBASENAMES = avconv avplay avprobe
14abeaa4
DB
73ALLAVPROGS = $(AVBASENAMES:%=%$(EXESUF))
74
dc80e2f7 75$(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o))
14abeaa4
DB
76
77OBJS-avconv += avconv_opt.o avconv_filter.o
7671dd7c 78OBJS-avconv-$(HAVE_VDPAU_X11) += avconv_vdpau.o
a61c2115 79OBJS-avconv-$(HAVE_DXVA2_LIB) += avconv_dxva2.o
1839fafa 80OBJS-avconv-$(CONFIG_VDA) += avconv_vda.o
fb472e1a 81OBJS-avconv-$(CONFIG_LIBMFX) += avconv_qsv.o
7671dd7c 82
3d157bf3 83TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
0d0b81f9 84HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
28e1c979
MR
85TOOLS = qt-faststart trasher
86TOOLS-$(CONFIG_ZLIB) += cws2fws
bde51e6a 87
5e2ba41d
JG
88# $(FFLIBS-yes) needs to be in linking order
89FFLIBS-$(CONFIG_AVDEVICE) += avdevice
90FFLIBS-$(CONFIG_AVFILTER) += avfilter
91FFLIBS-$(CONFIG_AVFORMAT) += avformat
92FFLIBS-$(CONFIG_AVCODEC) += avcodec
c8af852b 93FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
5e2ba41d 94FFLIBS-$(CONFIG_SWSCALE) += swscale
bde51e6a 95
5a0f7131 96FFLIBS := avutil
bde51e6a 97
8096fdf0 98DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
a1a84f69 99
90f9a583 100SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h
9b55e2e7 101
57b4a3dd 102include $(SRC_PATH)/common.mak
bde51e6a 103
bde51e6a
JR
104FF_EXTRALIBS := $(FFEXTRALIBS)
105FF_DEP_LIBS := $(DEP_LIBS)
3ae0e721 106FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
bde51e6a 107
14abeaa4 108all: $(AVPROGS)
bde51e6a 109
80521c19 110$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
bb0babd7 111 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS)
28e1c979 112
7baa115a 113tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
28e1c979 114
86601915 115config.h: .config
f038cf3c 116.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
9d0b3042
MR
117 @-tput bold 2>/dev/null
118 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
119 @-tput sgr0 2>/dev/null
86601915 120
e7e19b15 121SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
121604b0 122 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
8675bcb0 123 ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
b4dd424d 124 ALTIVEC-OBJS MMX-OBJS YASM-OBJS \
24d3796d 125 OBJS HOSTOBJS TESTOBJS
bde51e6a
JR
126
127define RESET
128$(1) :=
129$(1)-yes :=
130endef
131
132define DOSUBDIR
133$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
134SUBDIR := $(1)/
57b4a3dd 135include $(SRC_PATH)/$(1)/Makefile
07a873a2 136-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
d45ebd48 137-include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
144904e9 138include $(SRC_PATH)/library.mak
bde51e6a
JR
139endef
140
141$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
142
ab81f24a
DB
143include $(SRC_PATH)/doc/Makefile
144
baac24e6 145define DOPROG
14abeaa4 146OBJS-$(1) += $(1).o $(EXEOBJS) $(OBJS-$(1)-yes)
07b3790d 147$(1)$(EXESUF): $$(OBJS-$(1))
baac24e6
MR
148$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
149$(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
150$(1)$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
151-include $$(OBJS-$(1):.o=.d)
152endef
153
dc80e2f7 154$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(EXESUF)=))))
bde51e6a 155
07b3790d 156$(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
bb0babd7 157 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
bde51e6a 158
5e27ec28
MR
159OBJDIRS += tools
160
08df7f86 161-include $(wildcard tools/*.d)
bde51e6a 162
f038cf3c
MR
163VERSION_SH = $(SRC_PATH)/version.sh
164GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
6a53fffd 165
faa6f1c3 166.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
6a53fffd
MR
167.version: M=@
168
1316df7a 169avversion.h .version:
170 $(M)$(VERSION_SH) $(SRC_PATH) avversion.h $(EXTRA_VERSION)
6a53fffd
MR
171 $(Q)touch .version
172
173# force version.sh to run whenever version might have changed
174-include .version
36798f1b 175
14abeaa4 176ifdef AVPROGS
623ffe8c
MR
177install: install-progs install-data
178endif
179
180install: install-libs install-headers
d7a72d25
MR
181
182install-libs: install-libs-yes
bde51e6a 183
151c5841 184install-progs-yes:
623ffe8c
MR
185install-progs-$(CONFIG_SHARED): install-libs
186
14abeaa4 187install-progs: install-progs-yes $(AVPROGS)
63611f31 188 $(Q)mkdir -p "$(BINDIR)"
14abeaa4 189 $(INSTALL) -c -m 755 $(AVPROGS) "$(BINDIR)"
bde51e6a 190
a1a84f69 191install-data: $(DATA_FILES)
63611f31 192 $(Q)mkdir -p "$(DATADIR)"
fd676deb 193 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 194
f87b03b5 195uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
d3cb93b3
RP
196
197uninstall-progs:
14abeaa4 198 $(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
d3cb93b3
RP
199
200uninstall-data:
50e10cbd 201 $(RM) -r "$(DATADIR)"
d3cb93b3 202
698a183e 203clean::
14abeaa4 204 $(RM) $(ALLAVPROGS)
50e10cbd 205 $(RM) $(CLEANSUFFIXES)
40321376 206 $(RM) $(CLEANSUFFIXES:%=tools/%)
a862c7d3 207 $(RM) -rf coverage.info lcov
bde51e6a
JR
208
209distclean::
50e10cbd 210 $(RM) $(DISTCLEANSUFFIXES)
1316df7a 211 $(RM) config.* .config libavutil/avconfig.h .version avversion.h
bde51e6a 212
9d0b3042 213config:
29ba0911 214 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
0c3b2d65 215
4982e1dd
DB
216check: all alltools checkheaders examples testprogs fate
217
57b4a3dd 218include $(SRC_PATH)/tests/Makefile
d29d9ccc 219
5e27ec28
MR
220$(sort $(OBJDIRS)):
221 $(Q)mkdir -p $@
222
8d853efe
MR
223# Dummy rule to stop make trying to rebuild removed or renamed headers
224%.h:
225 @:
226
227# Disable suffix rules. Most of the builtin rules are suffix rules,
228# so this saves some time on slow systems.
229.SUFFIXES:
230
4982e1dd 231.PHONY: all all-yes alltools check *clean config examples install*
698a183e 232.PHONY: testprogs uninstall*