remove some ifeq ($(CONFIG_FOO),yes)
[libav.git] / Makefile
CommitLineData
a1b63811 1#
85f07f22 2# Main ffmpeg Makefile
38100e8c 3# (c) 2000-2004 Fabrice Bellard
85f07f22 4#
980fc7b8 5include config.mak
85f07f22 6
997baf01 7VPATH=$(SRC_PATH_BARE)
dd9ca370 8
cbeee4d8 9CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
a163ed1a 10 -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
c721d803 11 -I$(SRC_PATH)/libavdevice \
364a9607 12 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H
115329f1 13LDFLAGS+= -g
37736979 14
0cb8579a
MR
15PROGS-$(CONFIG_FFMPEG) += ffmpeg
16PROGS-$(CONFIG_FFPLAY) += ffplay
17PROGS-$(CONFIG_FFSERVER) += ffserver
01310af2 18
bb8fe69a
DB
19PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
20PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
21MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
85f07f22 22
bb8fe69a
DB
23BASENAMES = ffmpeg ffplay ffserver
24ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
25ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
26ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
6b991cb2 27
0fd94442 28ifeq ($(BUILD_SHARED),yes)
c721d803 29DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavdevice/$(SLIBPREF)avdevice$(SLIBSUF)
0fd94442 30else
c721d803 31DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavdevice/$(LIBPREF)avdevice$(LIBSUF)
f02be79d
RS
32endif
33
7d6ac9a3
MR
34ALL_TARGETS-$(CONFIG_VHOOK) += videohook
35ALL_TARGETS-$(BUILD_DOC) += documentation
36
37INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
1217916b
DB
38ifneq ($(PROGS),)
39INSTALL_TARGETS-yes += install-progs
282db5fd 40INSTALL_TARGETS-$(BUILD_DOC) += install-man
1217916b 41endif
dd9f3d97 42
3b26ee47 43VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
dd9f3d97
MR
44
45BASEHOOKS = fish null watermark
46ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
47ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
48
49HOOKS-$(HAVE_FORK) += ppm
50HOOKS-$(HAVE_IMLIB2) += imlib2
51HOOKS-$(HAVE_FREETYPE2) += drawtext
52
53HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
54
55VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
cbefadbd 56LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
dd9f3d97
MR
57
58VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
cbefadbd 59LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
dd9f3d97
MR
60
61VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
142fc6b9 62
7f0f6e13 63SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
c721d803
LA
64LDFLAGS := -L$(BUILD_ROOT)/libavdevice -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
65EXTRALIBS := -lavdevice$(BUILDSUF) -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
57514323 66
790c9ca7 67ifeq ($(CONFIG_SWSCALER),yes)
06694949 68LDFLAGS+=-L$(BUILD_ROOT)/libswscale
6de9e506 69EXTRALIBS+=-lswscale$(BUILDSUF)
790c9ca7
LA
70endif
71
a11f43a4
MR
72MAKE-yes = $(MAKE)
73MAKE- = : $(MAKE)
74
7d6ac9a3 75all: lib $(PROGS) $(ALL_TARGETS-yes)
85f07f22 76
951bf3e6 77lib:
5d22ccf7
DB
78 $(MAKE) -C libavutil all
79 $(MAKE) -C libavcodec all
abac6175 80 $(MAKE) -C libavformat all
c721d803 81 $(MAKE) -C libavdevice all
a11f43a4
MR
82 $(MAKE-$(CONFIG_PP)) -C libpostproc all
83 $(MAKE-$(CONFIG_SWSCALER)) -C libswscale all
85f07f22 84
951bf3e6 85ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
6de9e506 86 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
85f07f22 87
4ce5df08
SS
88ffserver$(EXESUF): ffserver.o cmdutils.o .libs
89 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o cmdutils.o $(EXTRALIBS)
85f07f22 90
951bf3e6 91ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
6de9e506 92 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
01310af2 93
0cfd96cc 94%$(EXESUF): %_g$(EXESUF)
01310af2
FB
95 cp -p $< $@
96 $(STRIP) $@
97
a4da50e1
MR
98SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
99ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
100version.h: $(SVN_ENTRIES)
101endif
102
f1cc88a5 103version.h:
997baf01 104 $(SRC_PATH)/version.sh $(SRC_PATH)
f1cc88a5 105
951bf3e6 106output_example$(EXESUF): output_example.o .libs
18caf192 107 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
8de65d4f 108
1521c500
DB
109tools/%$(EXESUF): tools/%.c
110 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
6da7cc81 111
4566de57 112ffplay.o: CFLAGS += $(SDL_CFLAGS)
2744a37f 113
496cfa3c
MR
114ffmpeg.o ffplay.o ffserver.o: version.h
115
ed5614eb
DB
116videohook: .libs $(HOOKS)
117
118vhook/%$(SLIBSUF): vhook/%.o
3b26ee47 119 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
ed5614eb 120
3b26ee47
MR
121vhook/%.o: vhook/%.c
122 $(CC) $(VHOOKCFLAGS) -c -o $@ $<
123
124%.o: %.c
125 $(CC) $(CFLAGS) -c -o $@ $<
142fc6b9 126
e9b19db8 127documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
d0e1cd3d
DB
128 ffplay-doc.html general.html hooks.html \
129 $(ALLMANPAGES))
e9b19db8
DB
130
131doc/%.html: doc/%.texi
132 texi2html -monolithic -number $<
133 mv $(@F) $@
134
135doc/%.pod: doc/%-doc.texi
136 doc/texi2pod.pl $< $@
137
138doc/%.1: doc/%.pod
139 pod2man --section=1 --center=" " --release=" " $< > $@
146ea952 140
1217916b 141install: install-libs install-headers $(INSTALL_TARGETS-yes)
81dcdc53 142
a4848db6 143ifeq ($(BUILD_SHARED),yes)
e1a3a63f 144install-progs: install-libs
a4848db6 145endif
c4fa7ebc 146install-progs: $(PROGS)
22a324da
DB
147 install -d "$(BINDIR)"
148 install -c -m 755 $(PROGS) "$(BINDIR)"
85f07f22 149
7a7be126 150# Create the Windows installer.
d35ff76b
FB
151wininstaller: all install
152 makensis ffinstall.nsi
153
23a65308 154install-man:
22a324da
DB
155 install -d "$(MANDIR)/man1"
156 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
23a65308 157
ed5614eb 158install-vhook: videohook
22a324da
DB
159 install -d "$(SHLIBDIR)/vhook"
160 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
142fc6b9 161
b12f8273 162install-libs:
8b2121e3
MR
163 $(MAKE) -C libavutil install-libs
164 $(MAKE) -C libavcodec install-libs
165 $(MAKE) -C libavformat install-libs
c721d803 166 $(MAKE) -C libavdevice install-libs
a11f43a4
MR
167 $(MAKE-$(CONFIG_PP)) -C libpostproc install-libs
168 $(MAKE-$(CONFIG_SWSCALER)) -C libswscale install-libs
790c9ca7 169
8b2121e3 170ifeq ($(BUILD_SHARED),yes)
1e7ffa50 171 -$(LDCONFIG)
b12f8273 172endif
37736979 173
f29f3b5d
DB
174install-headers:
175 $(MAKE) -C libavutil install-headers
176 $(MAKE) -C libavcodec install-headers
177 $(MAKE) -C libavformat install-headers
c721d803 178 $(MAKE) -C libavdevice install-headers
a11f43a4 179 $(MAKE-$(CONFIG_PP)) -C libpostproc install-headers
790c9ca7 180 $(MAKE) -C libswscale install-headers
f29f3b5d 181
f9edb717
DB
182uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
183
f9edb717 184uninstall-progs:
1c2211bd 185 rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
f9edb717 186
f9edb717 187uninstall-man:
1c2211bd 188 rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
f9edb717
DB
189
190uninstall-vhook:
1c2211bd 191 rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
22a324da 192 -rmdir "$(SHLIBDIR)/vhook/"
f9edb717
DB
193
194uninstall-libs:
195 $(MAKE) -C libavutil uninstall-libs
196 $(MAKE) -C libavcodec uninstall-libs
197 $(MAKE) -C libavformat uninstall-libs
c721d803 198 $(MAKE) -C libavdevice uninstall-libs
6d9a2421 199 $(MAKE) -C libpostproc uninstall-libs
65f37992 200 $(MAKE) -C libswscale uninstall-libs
f9edb717
DB
201
202uninstall-headers:
203 $(MAKE) -C libavutil uninstall-headers
204 $(MAKE) -C libavcodec uninstall-headers
205 $(MAKE) -C libavformat uninstall-headers
c721d803 206 $(MAKE) -C libavdevice uninstall-headers
6d9a2421 207 $(MAKE) -C libpostproc uninstall-headers
65f37992 208 $(MAKE) -C libswscale uninstall-headers
22a324da 209 -rmdir "$(INCDIR)"
f9edb717 210
3b26ee47 211depend dep: .depend .vhookdep
ea0f0681 212 $(MAKE) -C libavutil depend
5d22ccf7 213 $(MAKE) -C libavcodec depend
c80d990f 214 $(MAKE) -C libavformat depend
c721d803 215 $(MAKE) -C libavdevice depend
a11f43a4
MR
216 $(MAKE-$(CONFIG_PP)) -C libpostproc depend
217 $(MAKE-$(CONFIG_SWSCALER)) -C libswscale depend
4b8b2edb 218
fd071c26 219.depend: $(SRCS) version.h
0032cac2 220 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
3b26ee47 221
2a4592fe 222# gcc stupidly only outputs the basename of targets with -MM
fc900b7b 223.vhookdep: $(ALLHOOKS_SRCS) version.h
3b26ee47 224 $(CC) $(VHOOKCFLAGS) -MM $^ | sed 's,^\([a-z]\),vhook/\1,' > $@
57514323 225
da34f7ac
MR
226$(DEP_LIBS): lib
227
228.libs: $(DEP_LIBS)
229 touch $@
cf2818b0 230
98013cc1 231clean:
5d22ccf7
DB
232 $(MAKE) -C libavutil clean
233 $(MAKE) -C libavcodec clean
abac6175 234 $(MAKE) -C libavformat clean
c721d803 235 $(MAKE) -C libavdevice clean
6d9a2421 236 $(MAKE) -C libpostproc clean
790c9ca7 237 $(MAKE) -C libswscale clean
b8d40825 238 rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
2b258bba 239 output_example$(EXESUF)
e9b19db8 240 rm -f doc/*.html doc/*.pod doc/*.1
4fbd52f0
DB
241 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
242 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
2b258bba 243 rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
ed5614eb 244 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
142fc6b9 245
85f07f22 246distclean: clean
98013cc1
DB
247 $(MAKE) -C libavutil distclean
248 $(MAKE) -C libavcodec distclean
249 $(MAKE) -C libavformat distclean
c721d803 250 $(MAKE) -C libavdevice distclean
6d9a2421 251 $(MAKE) -C libpostproc distclean
790c9ca7 252 $(MAKE) -C libswscale distclean
2c8c5021 253 rm -f .depend .vhookdep version.h config.* *.pc
85f07f22
FB
254
255TAGS:
abac6175 256 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 257
dd9ca370
FB
258# regression tests
259
4fbd52f0 260fulltest test: codectest libavtest seektest
4fbd52f0
DB
261
262FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
263FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
264LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
265ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
266SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
267
b13cdd33 268test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0
DB
269 @echo
270 @echo "Unfortunately ffserver is broken and therefore its regression"
271 @echo "test fails randomly. Treat the results accordingly."
272 @echo
273 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
274
b13cdd33 275codectest mpeg4 mpeg ac3 snow snowll: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw tests/tiny_psnr$(EXESUF)
4fbd52f0
DB
276 $(SRC_PATH)/tests/regression.sh $@ $(FFMPEG_REFFILE) tests/vsynth1
277 $(SRC_PATH)/tests/regression.sh $@ $(ROTOZOOM_REFFILE) tests/vsynth2
278
b13cdd33 279libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
4fbd52f0 280 $(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1
a5a5984a 281
06396e11 282seektest: tests/seek_test$(EXESUF)
4fbd52f0 283 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
4fbd52f0
DB
284
285ifeq ($(CONFIG_SWSCALER),yes)
286test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error
287swscale_error:
288 @echo
289 @echo "This regression test is incompatible with --enable-swscaler."
290 @echo
291 @exit 1
292endif
293
294tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
295 mkdir -p tests/vsynth1
296 $(BUILD_ROOT)/$< 'tests/vsynth1/'
297
298tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
299 mkdir -p tests/vsynth2
300 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
301
302tests/asynth1.sw: tests/audiogen$(EXESUF)
303 $(BUILD_ROOT)/$< $@
304
305%$(EXESUF): %.c
306 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
307
06396e11 308tests/seek_test$(EXESUF): tests/seek_test.c .libs
ff21c1b0 309 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(EXTRALIBS)
4fbd52f0 310
dd9ca370 311
3263626f 312.PHONY: all lib videohook documentation install* wininstaller uninstall*
bedb3550 313.PHONY: dep depend clean distclean TAGS
5e2dfd39 314.PHONY: codectest libavtest seektest test-server fulltest test
4fbd52f0 315.PHONY: mpeg4 mpeg ac3 snow snowll swscale-error
cf2818b0 316
6ca0c110 317-include .depend
3b26ee47 318-include .vhookdep