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