update
[libav.git] / Makefile
CommitLineData
a1b63811 1#
85f07f22 2# Main ffmpeg Makefile
a1b63811 3# (c) 2000, 2001, 2002 Fabrice Bellard
85f07f22 4#
980fc7b8 5include config.mak
85f07f22 6
dd9ca370
FB
7VPATH=$(SRC_PATH)
8
abac6175 9CFLAGS= $(OPTFLAGS) -Wall -g -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
daf8e955
FB
17ifeq ($(CONFIG_WIN32),yes)
18EXE=.exe
daf8e955 19else
f3ec2d46
SG
20ifeq ($(CONFIG_OS2),yes)
21EXE=.exe
f3ec2d46
SG
22else
23EXE=
8154d2e0 24endif
daf8e955 25endif
01310af2
FB
26
27PROG=ffmpeg$(EXE)
8de65d4f 28PROGTEST=output_example$(EXE)
01310af2
FB
29
30ifeq ($(CONFIG_FFSERVER),yes)
31PROG+=ffserver$(EXE)
32endif
33
34ifeq ($(CONFIG_FFPLAY),yes)
35PROG+=ffplay$(EXE)
f3ec2d46 36endif
85f07f22 37
dfdfa47c
FR
38ifeq ($(CONFIG_AUDIO_BEOS),yes)
39EXTRALIBS+=-lmedia -lbe
40endif
a1b63811 41
0fd94442 42ifeq ($(BUILD_SHARED),yes)
6bc114b2 43DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
0fd94442 44else
f3ec2d46 45DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
a6741398
J
46ifeq ($(CONFIG_MP3LAME),yes)
47EXTRALIBS+=-lmp3lame
48endif
d1db8623
FR
49endif
50
81e0d0b4
MH
51ifeq ($(CONFIG_VORBIS),yes)
52EXTRALIBS+=-logg -lvorbis -lvorbisenc
53endif
0fd94442 54
445ad18d
ZK
55ifeq ($(CONFIG_FAAD),yes)
56ifeq ($(CONFIG_FAADBIN),yes)
57# no libs needed
58else
59EXTRALIBS += -lfaad
60endif
61endif
62
142fc6b9
PG
63ifeq ($(BUILD_VHOOK),yes)
64VHOOK=videohook
65INSTALLVHOOK=install-vhook
66CLEANVHOOK=clean-vhook
47930f09 67endif
142fc6b9 68
6e023978
RS
69ifeq ($(TARGET_OS), SunOS)
70TEST=/usr/bin/test
71else
72TEST=test
73endif
74
01310af2 75OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
57514323 76SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
cf2818b0 77FFLIBS = -L./libavformat -lavformat -L./libavcodec -lavcodec
57514323 78
8de65d4f 79all: lib $(PROG) $(PROGTEST) $(VHOOK)
85f07f22 80
891f64b3 81lib: $(AMRLIBS)
2cc8ae96 82 $(MAKE) -C libavcodec all
abac6175 83 $(MAKE) -C libavformat all
85f07f22 84
01310af2
FB
85ffmpeg_g$(EXE): ffmpeg.o cmdutils.o .libs
86 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
85f07f22 87
37736979 88ffmpeg$(EXE): ffmpeg_g$(EXE)
f3ec2d46
SG
89 cp -p $< $@
90 $(STRIP) $@
37736979 91
cf2818b0
ZK
92ffserver$(EXE): ffserver.o .libs
93 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
85f07f22 94
01310af2
FB
95ffplay_g$(EXE): ffplay.o cmdutils.o .libs
96 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
97
98ffplay$(EXE): ffplay_g$(EXE)
99 cp -p $< $@
100 $(STRIP) $@
101
8de65d4f
FB
102output_example$(EXE): output_example.o .libs
103 $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
104
01310af2
FB
105ffplay.o: ffplay.c
106 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
2744a37f 107
85f07f22 108%.o: %.c
daf8e955 109 $(CC) $(CFLAGS) -c -o $@ $<
85f07f22 110
be12b2a4 111videohook: .libs
142fc6b9
PG
112 $(MAKE) -C vhook all
113
d35ff76b
FB
114.PHONY: install
115
23a65308 116install: all install-man $(INSTALLVHOOK)
0fd94442 117 $(MAKE) -C libavcodec install
6bc114b2 118 $(MAKE) -C libavformat install
c1325d18 119 install -d $(prefix)/bin
fbd8bb7e 120 install -c -s -m 755 $(PROG) $(prefix)/bin
85f07f22 121
d35ff76b
FB
122# create the window installer
123wininstaller: all install
124 makensis ffinstall.nsi
125
23a65308
FB
126# install man from source dir if available
127install-man:
128 if [ -f $(SRC_PATH)/doc/ffmpeg.1 ] ; then \
129 install -d $(mandir)/man1 ; \
130 install -m 644 $(SRC_PATH)/doc/ffmpeg.1 $(SRC_PATH)/doc/ffplay.1 \
131 $(SRC_PATH)/doc/ffserver.1 $(mandir)/man1 ; \
132 fi
133
142fc6b9
PG
134install-vhook: $(prefix)/lib/vhook
135 $(MAKE) -C vhook install INSTDIR=$(prefix)/lib/vhook
136
137$(prefix)/lib/vhook:
4baca069 138 install -d $@
142fc6b9 139
37736979
FB
140installlib:
141 $(MAKE) -C libavcodec installlib
abac6175 142 $(MAKE) -C libavformat installlib
37736979 143
57514323
ZK
144dep: depend
145
4b8b2edb 146depend: .depend
811b32ed
FB
147 make -C libavcodec depend
148 make -C libavformat depend
149ifeq ($(BUILD_VHOOK),yes)
150 make -C vhook depend
151endif
4b8b2edb
FB
152
153.depend: $(SRCS)
154 $(CC) -MM $(CFLAGS) $^ 1>.depend
57514323 155
cf2818b0 156.libs: lib
127d5c8d 157 @test -f .libs || touch .libs
6e023978 158 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
cf2818b0 159
bc634f6f 160clean: $(CLEANVHOOK)
2cc8ae96 161 $(MAKE) -C libavcodec clean
abac6175 162 $(MAKE) -C libavformat clean
dd9ca370 163 $(MAKE) -C tests clean
01310af2 164 rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXE) ffplay_g$(EXE) $(PROG)
85f07f22 165
142fc6b9
PG
166clean-vhook:
167 $(MAKE) -C vhook clean
168
85f07f22 169distclean: clean
c72c6d2d 170 $(MAKE) -C libavcodec distclean
980fc7b8 171 rm -f config.mak config.h
85f07f22
FB
172
173TAGS:
abac6175 174 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 175
dd9ca370
FB
176# regression tests
177
ec9fca31
FB
178libavtest test mpeg4 mpeg test-server fulltest: ffmpeg$(EXE)
179 $(MAKE) -C tests $@
dd9ca370 180
ac977341
FB
181# tar release (use 'make -k tar' on a checkouted tree)
182FILE=ffmpeg-$(shell cat VERSION)
183
184tar:
185 rm -rf /tmp/$(FILE)
186 cp -r . /tmp/$(FILE)
187 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
188 rm -rf /tmp/$(FILE)
189
cf2818b0
ZK
190.PHONY: lib
191
57514323
ZK
192ifneq ($(wildcard .depend),)
193include .depend
194endif