minor optimization
[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
cf9d24ad 9CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -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
bbec50d7 17MANPAGE=$(SRC_PATH)/doc/ffmpeg.1
951bf3e6
FB
18PROG=ffmpeg$(EXESUF)
19PROGTEST=output_example$(EXESUF)
38100e8c 20QTFASTSTART=qt-faststart$(EXESUF)
01310af2
FB
21
22ifeq ($(CONFIG_FFSERVER),yes)
bbec50d7 23MANPAGE+=$(SRC_PATH)/doc/ffserver.1
951bf3e6 24PROG+=ffserver$(EXESUF)
01310af2
FB
25endif
26
27ifeq ($(CONFIG_FFPLAY),yes)
bbec50d7 28MANPAGE+=$(SRC_PATH)/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
81e0d0b4
MH
46ifeq ($(CONFIG_VORBIS),yes)
47EXTRALIBS+=-logg -lvorbis -lvorbisenc
48endif
0fd94442 49
445ad18d
ZK
50ifeq ($(CONFIG_FAAD),yes)
51ifeq ($(CONFIG_FAADBIN),yes)
52# no libs needed
53else
54EXTRALIBS += -lfaad
55endif
56endif
57
29d48296
MN
58ifeq ($(CONFIG_FAAC),yes)
59EXTRALIBS+=-lfaac
60endif
61
1ddadfa9
AT
62ifeq ($(CONFIG_XVID),yes)
63EXTRALIBS+=-lxvidcore
64endif
65
142fc6b9
PG
66ifeq ($(BUILD_VHOOK),yes)
67VHOOK=videohook
68INSTALLVHOOK=install-vhook
69CLEANVHOOK=clean-vhook
47930f09 70endif
142fc6b9 71
6e023978
RS
72ifeq ($(TARGET_OS), SunOS)
73TEST=/usr/bin/test
74else
75TEST=test
76endif
77
146ea952
NB
78ifeq ($(BUILD_DOC),yes)
79DOC=documentation
80endif
81
426c31a1 82OBJS = ffmpeg.o ffserver.o cmdutils.o $(FFPLAY_O)
57514323 83SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
cf2818b0 84FFLIBS = -L./libavformat -lavformat -L./libavcodec -lavcodec
57514323 85
146ea952 86all: lib $(PROG) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
85f07f22 87
951bf3e6 88lib:
2cc8ae96 89 $(MAKE) -C libavcodec all
abac6175 90 $(MAKE) -C libavformat all
85f07f22 91
951bf3e6 92ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
01310af2 93 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
85f07f22 94
951bf3e6 95ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
f3ec2d46
SG
96 cp -p $< $@
97 $(STRIP) $@
37736979 98
951bf3e6 99ffserver$(EXESUF): ffserver.o .libs
cf2818b0 100 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
85f07f22 101
951bf3e6 102ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
01310af2
FB
103 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
104
951bf3e6 105ffplay$(EXESUF): ffplay_g$(EXESUF)
01310af2
FB
106 cp -p $< $@
107 $(STRIP) $@
108
951bf3e6 109output_example$(EXESUF): output_example.o .libs
8de65d4f
FB
110 $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
111
38100e8c 112qt-faststart$(EXESUF): qt-faststart.c
426c31a1 113 $(CC) $(SRC_PATH)/qt-faststart.c -o qt-faststart$(EXESUF)
38100e8c 114
01310af2
FB
115ffplay.o: ffplay.c
116 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
2744a37f 117
85f07f22 118%.o: %.c
daf8e955 119 $(CC) $(CFLAGS) -c -o $@ $<
85f07f22 120
be12b2a4 121videohook: .libs
142fc6b9
PG
122 $(MAKE) -C vhook all
123
146ea952
NB
124documentation:
125 $(MAKE) -C doc all
126
d35ff76b
FB
127.PHONY: install
128
23a65308 129install: all install-man $(INSTALLVHOOK)
0fd94442 130 $(MAKE) -C libavcodec install
6bc114b2 131 $(MAKE) -C libavformat install
951bf3e6
FB
132 install -d "$(bindir)"
133 install -c -s -m 755 $(PROG) "$(bindir)"
85f07f22 134
d35ff76b
FB
135# create the window installer
136wininstaller: all install
137 makensis ffinstall.nsi
138
23a65308
FB
139# install man from source dir if available
140install-man:
951bf3e6 141ifneq ($(CONFIG_WIN32),yes)
23a65308 142 if [ -f $(SRC_PATH)/doc/ffmpeg.1 ] ; then \
aa99b8ff
MN
143 install -d "$(mandir)/man1" ; \
144 install -m 644 $(MANPAGE) "$(mandir)/man1" ; \
23a65308 145 fi
951bf3e6 146endif
23a65308 147
aa99b8ff
MN
148install-vhook:
149 $(MAKE) -C vhook install
142fc6b9 150
37736979
FB
151installlib:
152 $(MAKE) -C libavcodec installlib
abac6175 153 $(MAKE) -C libavformat installlib
37736979 154
57514323
ZK
155dep: depend
156
4b8b2edb 157depend: .depend
811b32ed
FB
158 make -C libavcodec depend
159 make -C libavformat depend
160ifeq ($(BUILD_VHOOK),yes)
161 make -C vhook depend
162endif
4b8b2edb
FB
163
164.depend: $(SRCS)
148beec7 165 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
57514323 166
cf2818b0 167.libs: lib
127d5c8d 168 @test -f .libs || touch .libs
6e023978 169 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
cf2818b0 170
bc634f6f 171clean: $(CLEANVHOOK)
2cc8ae96 172 $(MAKE) -C libavcodec clean
abac6175 173 $(MAKE) -C libavformat clean
dd9ca370 174 $(MAKE) -C tests clean
4c4b3fcd 175 rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXESUF) ffplay_g$(EXESUF) $(PROG) $(PROGTEST)
85f07f22 176
142fc6b9
PG
177clean-vhook:
178 $(MAKE) -C vhook clean
179
85f07f22 180distclean: clean
c72c6d2d 181 $(MAKE) -C libavcodec distclean
980fc7b8 182 rm -f config.mak config.h
85f07f22
FB
183
184TAGS:
abac6175 185 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 186
dd9ca370
FB
187# regression tests
188
951bf3e6 189libavtest test mpeg4 mpeg test-server fulltest: ffmpeg$(EXESUF)
ec9fca31 190 $(MAKE) -C tests $@
dd9ca370 191
ac977341 192# tar release (use 'make -k tar' on a checkouted tree)
951bf3e6
FB
193FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
194 cut -d "\"" -f 2 )
ac977341
FB
195
196tar:
197 rm -rf /tmp/$(FILE)
198 cp -r . /tmp/$(FILE)
199 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
200 rm -rf /tmp/$(FILE)
201
cf2818b0
ZK
202.PHONY: lib
203
57514323
ZK
204ifneq ($(wildcard .depend),)
205include .depend
206endif