doc: Add the host executable suffix for the print_options dependency
[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)
41
bb524924 42%.o: %.c
bc877faf 43 $(COMPILE_C)
bb524924
MR
44
45%.o: %.S
bc877faf 46 $(COMPILE_S)
bb524924 47
c2626492
MR
48%.i: %.c
49 $(CC) $(CCFLAGS) $(CC_E) $<
50
dfd9159f
MR
51%.h.c:
52 $(Q)echo '#include "$*.h"' >$@
bb524924
MR
53
54%.ver: %.v
55 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
56
57%.c %.h: TAG = GEN
58
6291d7e4 59PROGS-$(CONFIG_AVCONV) += avconv
266463da 60PROGS-$(CONFIG_AVPLAY) += avplay
9e12f0bf 61PROGS-$(CONFIG_AVPROBE) += avprobe
4d58e4cb 62PROGS-$(CONFIG_AVSERVER) += avserver
bde51e6a 63
583fcb52 64PROGS := $(PROGS-yes:%=%$(EXESUF))
7671dd7c 65
fe2147e9 66OBJS-avconv = avconv_opt.o avconv_filter.o
7671dd7c
AK
67OBJS-avconv-$(HAVE_VDPAU_X11) += avconv_vdpau.o
68
3d157bf3 69TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
0d0b81f9 70HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
28e1c979
MR
71TOOLS = qt-faststart trasher
72TOOLS-$(CONFIG_ZLIB) += cws2fws
bde51e6a 73
0fec2cb1 74BASENAMES = avconv avplay avprobe avserver
583fcb52 75ALLPROGS = $(BASENAMES:%=%$(EXESUF))
583fcb52 76ALLMANPAGES = $(BASENAMES:%=%.1)
bde51e6a 77
5a0f7131 78FFLIBS-$(CONFIG_AVDEVICE) += avdevice
bde51e6a 79FFLIBS-$(CONFIG_AVFILTER) += avfilter
5a0f7131 80FFLIBS-$(CONFIG_AVFORMAT) += avformat
c8af852b 81FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
97d5fa38 82FFLIBS-$(CONFIG_AVCODEC) += avcodec
5a0f7131 83FFLIBS-$(CONFIG_SWSCALE) += swscale
bde51e6a 84
5a0f7131 85FFLIBS := avutil
bde51e6a 86
8096fdf0 87DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
a1a84f69 88
90f9a583 89SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h
9b55e2e7 90
57b4a3dd 91include $(SRC_PATH)/common.mak
bde51e6a 92
bde51e6a
JR
93FF_EXTRALIBS := $(FFEXTRALIBS)
94FF_DEP_LIBS := $(DEP_LIBS)
95
1fef92fd 96all: $(PROGS)
bde51e6a 97
80521c19
MR
98$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
99 $(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
28e1c979 100
7baa115a 101tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
28e1c979 102
86601915 103config.h: .config
f038cf3c 104.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
9d0b3042
MR
105 @-tput bold 2>/dev/null
106 @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
107 @-tput sgr0 2>/dev/null
86601915 108
e7e19b15 109SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
121604b0 110 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
b3267559 111 ARMV5TE-OBJS ARMV6-OBJS VFP-OBJS NEON-OBJS \
ca411fc1 112 ALTIVEC-OBJS VIS-OBJS \
5864eb42 113 MMX-OBJS YASM-OBJS \
24d3796d 114 OBJS HOSTOBJS TESTOBJS
bde51e6a
JR
115
116define RESET
117$(1) :=
118$(1)-yes :=
119endef
120
121define DOSUBDIR
122$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
123SUBDIR := $(1)/
57b4a3dd 124include $(SRC_PATH)/$(1)/Makefile
07a873a2 125-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
144904e9 126include $(SRC_PATH)/library.mak
bde51e6a
JR
127endef
128
129$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
130
baac24e6 131define DOPROG
7671dd7c 132OBJS-$(1) += $(1).o cmdutils.o $(EXEOBJS) $(OBJS-$(1)-yes)
07b3790d 133$(1)$(EXESUF): $$(OBJS-$(1))
baac24e6
MR
134$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
135$(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
136$(1)$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
137-include $$(OBJS-$(1):.o=.d)
138endef
139
140$(foreach P,$(PROGS-yes),$(eval $(call DOPROG,$(P))))
bde51e6a 141
07b3790d
MR
142$(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
143 $(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
bde51e6a 144
5e27ec28
MR
145OBJDIRS += tools
146
08df7f86 147-include $(wildcard tools/*.d)
bde51e6a 148
f038cf3c
MR
149VERSION_SH = $(SRC_PATH)/version.sh
150GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
6a53fffd 151
faa6f1c3 152.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
6a53fffd
MR
153.version: M=@
154
155version.h .version:
0853a2b4 156 $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
6a53fffd
MR
157 $(Q)touch .version
158
159# force version.sh to run whenever version might have changed
160-include .version
36798f1b 161
623ffe8c
MR
162ifdef PROGS
163install: install-progs install-data
164endif
165
166install: install-libs install-headers
d7a72d25
MR
167
168install-libs: install-libs-yes
bde51e6a 169
151c5841 170install-progs-yes:
623ffe8c
MR
171install-progs-$(CONFIG_SHARED): install-libs
172
173install-progs: install-progs-yes $(PROGS)
63611f31 174 $(Q)mkdir -p "$(BINDIR)"
fd676deb 175 $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
bde51e6a 176
a1a84f69 177install-data: $(DATA_FILES)
63611f31 178 $(Q)mkdir -p "$(DATADIR)"
fd676deb 179 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
a1a84f69 180
f87b03b5 181uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
d3cb93b3
RP
182
183uninstall-progs:
50e10cbd 184 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
d3cb93b3
RP
185
186uninstall-data:
50e10cbd 187 $(RM) -r "$(DATADIR)"
d3cb93b3 188
698a183e 189clean::
e0be794a 190 $(RM) $(ALLPROGS)
50e10cbd 191 $(RM) $(CLEANSUFFIXES)
40321376 192 $(RM) $(CLEANSUFFIXES:%=tools/%)
a862c7d3 193 $(RM) -rf coverage.info lcov
bde51e6a
JR
194
195distclean::
50e10cbd 196 $(RM) $(DISTCLEANSUFFIXES)
b4d24b47 197 $(RM) config.* .config libavutil/avconfig.h .version version.h
bde51e6a 198
9d0b3042 199config:
29ba0911 200 $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
0c3b2d65 201
4982e1dd
DB
202check: all alltools checkheaders examples testprogs fate
203
57b4a3dd
MR
204include $(SRC_PATH)/doc/Makefile
205include $(SRC_PATH)/tests/Makefile
d29d9ccc 206
5e27ec28
MR
207$(sort $(OBJDIRS)):
208 $(Q)mkdir -p $@
209
8d853efe
MR
210# Dummy rule to stop make trying to rebuild removed or renamed headers
211%.h:
212 @:
213
214# Disable suffix rules. Most of the builtin rules are suffix rules,
215# so this saves some time on slow systems.
216.SUFFIXES:
217
4982e1dd 218.PHONY: all all-yes alltools check *clean config examples install*
698a183e 219.PHONY: testprogs uninstall*