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