sse2 16x16 sum squared diff (306=>268 cycles on a K8)
[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
dd9ca370
FB
7VPATH=$(SRC_PATH)
8
c11c2bc2 9CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavutil -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
4baca069 10LDFLAGS+= -g
37736979 11
980fc7b8 12ifeq ($(TARGET_GPROF),yes)
85f07f22
FB
13CFLAGS+=-p
14LDFLAGS+=-p
15endif
16
8b8e1c55 17MANPAGE=doc/ffmpeg.1
951bf3e6
FB
18PROG=ffmpeg$(EXESUF)
19PROGTEST=output_example$(EXESUF)
38100e8c 20QTFASTSTART=qt-faststart$(EXESUF)
01310af2
FB
21
22ifeq ($(CONFIG_FFSERVER),yes)
8b8e1c55 23MANPAGE+=doc/ffserver.1
951bf3e6 24PROG+=ffserver$(EXESUF)
01310af2
FB
25endif
26
27ifeq ($(CONFIG_FFPLAY),yes)
8b8e1c55 28MANPAGE+=doc/ffplay.1
951bf3e6 29PROG+=ffplay$(EXESUF)
426c31a1 30FFPLAY_O=ffplay.o
f3ec2d46 31endif
85f07f22 32
dfdfa47c
FR
33ifeq ($(CONFIG_AUDIO_BEOS),yes)
34EXTRALIBS+=-lmedia -lbe
35endif
a1b63811 36
0fd94442 37ifeq ($(BUILD_SHARED),yes)
6bc114b2 38DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
0fd94442 39else
f3ec2d46 40DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
a6741398
J
41ifeq ($(CONFIG_MP3LAME),yes)
42EXTRALIBS+=-lmp3lame
43endif
d1db8623
FR
44endif
45
5c5dea3f 46ifeq ($(CONFIG_LIBOGG),yes)
5c5dea3f 47ifeq ($(CONFIG_LIBVORBIS),yes)
078a8dd6 48EXTRALIBS+= -lvorbisenc -lvorbis
5c5dea3f
NB
49endif
50ifeq ($(CONFIG_LIBTHEORA),yes)
51EXTRALIBS+= -ltheora
52endif
078a8dd6 53EXTRALIBS+= -logg
81e0d0b4 54endif
0fd94442 55
445ad18d
ZK
56ifeq ($(CONFIG_FAAD),yes)
57ifeq ($(CONFIG_FAADBIN),yes)
58# no libs needed
59else
60EXTRALIBS += -lfaad
61endif
62endif
63
29d48296
MN
64ifeq ($(CONFIG_FAAC),yes)
65EXTRALIBS+=-lfaac
66endif
67
1ddadfa9
AT
68ifeq ($(CONFIG_XVID),yes)
69EXTRALIBS+=-lxvidcore
70endif
71
6870a440
JR
72ifeq ($(CONFIG_LIBGSM),yes)
73EXTRALIBS+=-lgsm
74endif
75
f02be79d
RS
76ifeq ($(CONFIG_DC1394),yes)
77EXTRALIBS+=-ldc1394_control -lraw1394
78endif
79
142fc6b9
PG
80ifeq ($(BUILD_VHOOK),yes)
81VHOOK=videohook
82INSTALLVHOOK=install-vhook
83CLEANVHOOK=clean-vhook
47930f09 84endif
142fc6b9 85
6e023978
RS
86ifeq ($(TARGET_OS), SunOS)
87TEST=/usr/bin/test
88else
89TEST=test
90endif
91
146ea952
NB
92ifeq ($(BUILD_DOC),yes)
93DOC=documentation
94endif
95
426c31a1 96OBJS = ffmpeg.o ffserver.o cmdutils.o $(FFPLAY_O)
57514323 97SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
c11c2bc2 98FFLIBS = -L./libavformat -lavformat$(BUILDSUF) -L./libavcodec -lavcodec$(BUILDSUF) -L./libavutil -lavutil$(BUILDSUF)
57514323 99
146ea952 100all: lib $(PROG) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
85f07f22 101
951bf3e6 102lib:
c11c2bc2 103 $(MAKE) -C libavutil all
2cc8ae96 104 $(MAKE) -C libavcodec all
abac6175 105 $(MAKE) -C libavformat all
85f07f22 106
951bf3e6 107ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
01310af2 108 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
85f07f22 109
951bf3e6 110ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
f3ec2d46
SG
111 cp -p $< $@
112 $(STRIP) $@
37736979 113
951bf3e6 114ffserver$(EXESUF): ffserver.o .libs
cf2818b0 115 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
85f07f22 116
951bf3e6 117ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
01310af2
FB
118 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
119
951bf3e6 120ffplay$(EXESUF): ffplay_g$(EXESUF)
01310af2
FB
121 cp -p $< $@
122 $(STRIP) $@
123
951bf3e6 124output_example$(EXESUF): output_example.o .libs
8de65d4f
FB
125 $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
126
38100e8c 127qt-faststart$(EXESUF): qt-faststart.c
426c31a1 128 $(CC) $(SRC_PATH)/qt-faststart.c -o qt-faststart$(EXESUF)
38100e8c 129
f7599d5f
AB
130cws2fws$(EXESUF): cws2fws.c
131 $(CC) $(SRC_PATH)/cws2fws.c -o cws2fws$(EXESUF) -lz
132
01310af2
FB
133ffplay.o: ffplay.c
134 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
2744a37f 135
85f07f22 136%.o: %.c
daf8e955 137 $(CC) $(CFLAGS) -c -o $@ $<
85f07f22 138
be12b2a4 139videohook: .libs
142fc6b9
PG
140 $(MAKE) -C vhook all
141
146ea952
NB
142documentation:
143 $(MAKE) -C doc all
144
d35ff76b
FB
145.PHONY: install
146
23a65308 147install: all install-man $(INSTALLVHOOK)
c11c2bc2 148 $(MAKE) -C libavutil install
0fd94442 149 $(MAKE) -C libavcodec install
6bc114b2 150 $(MAKE) -C libavformat install
951bf3e6 151 install -d "$(bindir)"
65d1bea2 152 install -c $(INSTALLSTRIP) -m 755 $(PROG) "$(bindir)"
85f07f22 153
d35ff76b
FB
154# create the window installer
155wininstaller: all install
156 makensis ffinstall.nsi
157
23a65308
FB
158# install man from source dir if available
159install-man:
951bf3e6 160ifneq ($(CONFIG_WIN32),yes)
8b8e1c55 161 if [ -f doc/ffmpeg.1 ] ; then \
aa99b8ff
MN
162 install -d "$(mandir)/man1" ; \
163 install -m 644 $(MANPAGE) "$(mandir)/man1" ; \
23a65308 164 fi
951bf3e6 165endif
23a65308 166
aa99b8ff
MN
167install-vhook:
168 $(MAKE) -C vhook install
142fc6b9 169
37736979 170installlib:
c11c2bc2 171 $(MAKE) -C libavutil installlib
37736979 172 $(MAKE) -C libavcodec installlib
abac6175 173 $(MAKE) -C libavformat installlib
37736979 174
57514323
ZK
175dep: depend
176
4b8b2edb 177depend: .depend
c80d990f
SS
178 $(MAKE) -C libavcodec depend
179 $(MAKE) -C libavformat depend
811b32ed 180ifeq ($(BUILD_VHOOK),yes)
c80d990f 181 $(MAKE) -C vhook depend
811b32ed 182endif
4b8b2edb
FB
183
184.depend: $(SRCS)
148beec7 185 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
57514323 186
cf2818b0 187.libs: lib
127d5c8d 188 @test -f .libs || touch .libs
6e023978 189 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
cf2818b0 190
bc634f6f 191clean: $(CLEANVHOOK)
c11c2bc2 192 $(MAKE) -C libavutil clean
2cc8ae96 193 $(MAKE) -C libavcodec clean
abac6175 194 $(MAKE) -C libavformat clean
dd9ca370 195 $(MAKE) -C tests clean
2c735779
ZK
196 rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXESUF) \
197 ffplay_g$(EXESUF) $(PROG) $(PROGTEST) $(QTFASTSTART)
85f07f22 198
142fc6b9
PG
199clean-vhook:
200 $(MAKE) -C vhook clean
201
f255e0ab 202# Note well: config.log is NOT removed.
85f07f22 203distclean: clean
c72c6d2d 204 $(MAKE) -C libavcodec distclean
980fc7b8 205 rm -f config.mak config.h
85f07f22
FB
206
207TAGS:
abac6175 208 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 209
dd9ca370
FB
210# regression tests
211
951bf3e6 212libavtest test mpeg4 mpeg test-server fulltest: ffmpeg$(EXESUF)
ec9fca31 213 $(MAKE) -C tests $@
dd9ca370 214
ac977341 215# tar release (use 'make -k tar' on a checkouted tree)
951bf3e6
FB
216FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
217 cut -d "\"" -f 2 )
ac977341
FB
218
219tar:
220 rm -rf /tmp/$(FILE)
221 cp -r . /tmp/$(FILE)
222 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
223 rm -rf /tmp/$(FILE)
224
cf2818b0
ZK
225.PHONY: lib
226
57514323
ZK
227ifneq ($(wildcard .depend),)
228include .depend
229endif