Add option to disable ffmpeg build.
[libav.git] / Makefile
1 #
2 # Main ffmpeg Makefile
3 # (c) 2000-2004 Fabrice Bellard
4 #
5 include config.mak
6
7 VPATH=$(SRC_PATH)
8
9 CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
10 -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
11 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE
12 LDFLAGS+= -g
13
14 ifeq ($(CONFIG_FFMPEG),yes)
15 MANPAGES=doc/ffmpeg.1
16 PROGS_G+=ffmpeg_g$(EXESUF)
17 PROGS+=ffmpeg$(EXESUF)
18 PROGTEST=output_example$(EXESUF)
19 QTFASTSTART=qt-faststart$(EXESUF)
20 endif
21
22 ifeq ($(CONFIG_FFSERVER),yes)
23 MANPAGES+=doc/ffserver.1
24 PROGS+=ffserver$(EXESUF)
25 endif
26
27 ifeq ($(CONFIG_FFPLAY),yes)
28 MANPAGES+=doc/ffplay.1
29 PROGS_G+=ffplay_g$(EXESUF)
30 PROGS+=ffplay$(EXESUF)
31 endif
32
33 BASENAMES=ffmpeg ffplay ffserver
34 ALLPROGS=$(addsuffix $(EXESUF), $(BASENAMES))
35 ALLPROGS_G=$(addsuffix _g$(EXESUF), $(BASENAMES))
36 ALLMANPAGES=$(addsuffix .1, $(BASENAMES))
37
38 ifeq ($(CONFIG_AUDIO_BEOS),yes)
39 EXTRALIBS+=-lmedia -lbe
40 endif
41
42 ifeq ($(BUILD_SHARED),yes)
43 DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
44 else
45 DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
46 endif
47
48 ifeq ($(BUILD_VHOOK),yes)
49 VHOOK=videohook
50 INSTALLVHOOK=install-vhook
51 endif
52
53 ifeq ($(BUILD_DOC),yes)
54 DOC=documentation
55 endif
56
57 OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
58 SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
59 LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
60 EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
61
62 ifeq ($(CONFIG_SWSCALER),yes)
63 LDFLAGS+=-L./libswscale
64 EXTRALIBS+=-lswscale$(BUILDSUF)
65 endif
66
67 all: lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
68
69 lib:
70 $(MAKE) -C libavutil all
71 $(MAKE) -C libavcodec all
72 $(MAKE) -C libavformat all
73 ifeq ($(CONFIG_PP),yes)
74 $(MAKE) -C libpostproc all
75 endif
76 ifeq ($(CONFIG_SWSCALER),yes)
77 $(MAKE) -C libswscale all
78 endif
79
80 ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
81 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
82
83 ffserver$(EXESUF): ffserver.o .libs
84 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
85
86 ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
87 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
88
89 %$(EXESUF): %_g$(EXESUF)
90 cp -p $< $@
91 $(STRIP) $@
92
93 version.h:
94 $(SRC_PATH)/version.sh "$(SRC_PATH)"
95
96 output_example$(EXESUF): output_example.o .libs
97 $(CC) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
98
99 qt-faststart$(EXESUF): qt-faststart.c
100 $(CC) $(CFLAGS) $< -o $@
101
102 cws2fws$(EXESUF): cws2fws.c
103 $(CC) $< -o $@ -lz
104
105 ffplay.o: ffplay.c
106 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
107
108 ffmpeg.o ffplay.o ffserver.o: version.h
109
110 %.o: %.c
111 $(CC) $(CFLAGS) -c -o $@ $<
112
113 videohook: .libs
114 $(MAKE) -C vhook all
115
116 documentation:
117 $(MAKE) -C doc all
118
119 install: install-progs install-libs install-headers install-man $(INSTALLVHOOK)
120
121 ifeq ($(BUILD_SHARED),yes)
122 install-progs: $(PROGS) install-libs
123 else
124 install-progs: $(PROGS)
125 endif
126 install -d "$(bindir)"
127 install -c $(INSTALLSTRIP) -m 755 $(PROGS) "$(bindir)"
128
129 # create the window installer
130 wininstaller: all install
131 makensis ffinstall.nsi
132
133 # install man from source dir if available
134 install-man:
135 ifneq ($(CONFIG_MINGW),yes)
136 if [ -f doc/ffmpeg.1 ] ; then \
137 install -d "$(mandir)/man1" ; \
138 install -m 644 $(MANPAGES) "$(mandir)/man1" ; \
139 fi
140 endif
141
142 install-vhook:
143 $(MAKE) -C vhook install
144
145 install-libs:
146 $(MAKE) -C libavutil install-libs
147 $(MAKE) -C libavcodec install-libs
148 $(MAKE) -C libavformat install-libs
149 ifeq ($(CONFIG_PP),yes)
150 $(MAKE) -C libpostproc install-libs
151 endif
152 ifeq ($(CONFIG_SWSCALER),yes)
153 $(MAKE) -C libswscale install-libs
154 endif
155
156 ifeq ($(BUILD_SHARED),yes)
157 -$(LDCONFIG)
158 endif
159
160 install-headers:
161 $(MAKE) -C libavutil install-headers
162 $(MAKE) -C libavcodec install-headers
163 $(MAKE) -C libavformat install-headers
164 ifeq ($(CONFIG_PP),yes)
165 $(MAKE) -C libpostproc install-headers
166 endif
167 $(MAKE) -C libswscale install-headers
168
169 uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
170
171 uninstall-progs:
172 rm -f $(addprefix $(bindir)/, $(ALLPROGS))
173
174 uninstall-man:
175 ifneq ($(CONFIG_MINGW),yes)
176 rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))
177 endif
178
179 uninstall-vhook:
180 $(MAKE) -C vhook uninstall
181
182 uninstall-libs:
183 $(MAKE) -C libavutil uninstall-libs
184 $(MAKE) -C libavcodec uninstall-libs
185 $(MAKE) -C libavformat uninstall-libs
186 $(MAKE) -C libpostproc uninstall-libs
187
188 uninstall-headers:
189 $(MAKE) -C libavutil uninstall-headers
190 $(MAKE) -C libavcodec uninstall-headers
191 $(MAKE) -C libavformat uninstall-headers
192 $(MAKE) -C libpostproc uninstall-headers
193 -rmdir "$(incdir)"
194 -rmdir "$(prefix)/include/postproc"
195
196 dep: depend
197
198 depend: .depend
199 $(MAKE) -C libavutil depend
200 $(MAKE) -C libavcodec depend
201 $(MAKE) -C libavformat depend
202 ifeq ($(CONFIG_PP),yes)
203 $(MAKE) -C libpostproc depend
204 endif
205 ifeq ($(CONFIG_SWSCALER),yes)
206 $(MAKE) -C libswscale depend
207 endif
208 ifeq ($(BUILD_VHOOK),yes)
209 $(MAKE) -C vhook depend
210 endif
211
212 .depend: $(SRCS) version.h
213 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(SRCS) 1>.depend
214
215 .libs: lib
216 @test -f .libs || touch .libs
217 @for i in $(DEP_LIBS) ; do if test $$i -nt .libs ; then touch .libs; fi ; done
218
219 clean:
220 $(MAKE) -C libavutil clean
221 $(MAKE) -C libavcodec clean
222 $(MAKE) -C libavformat clean
223 $(MAKE) -C libpostproc clean
224 $(MAKE) -C libswscale clean
225 $(MAKE) -C tests clean
226 $(MAKE) -C vhook clean
227 $(MAKE) -C doc clean
228 rm -f *.o *.d *~ .libs gmon.out TAGS \
229 $(ALLPROGS) $(ALLPROGS_G) $(PROGTEST) $(QTFASTSTART)
230
231 # Note well: config.log is NOT removed.
232 distclean: clean
233 $(MAKE) -C libavutil distclean
234 $(MAKE) -C libavcodec distclean
235 $(MAKE) -C libavformat distclean
236 $(MAKE) -C libpostproc distclean
237 $(MAKE) -C libswscale distclean
238 $(MAKE) -C tests distclean
239 $(MAKE) -C vhook distclean
240 rm -f .depend version.h config.* *.pc
241
242 TAGS:
243 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
244
245 # regression tests
246
247 codectest libavtest test-server fulltest test mpeg4 mpeg: $(PROGS)
248 $(MAKE) -C tests $@
249
250 # tar release (use 'make -k tar' on a checkouted tree)
251 FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " version.h | \
252 cut -d "\"" -f 2 )
253
254 tar:
255 rm -rf /tmp/$(FILE)
256 cp -r . /tmp/$(FILE)
257 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude .svn )
258 rm -rf /tmp/$(FILE)
259
260 .PHONY: all lib videohook documentation install* wininstaller uninstall*
261 .PHONY: dep depend clean distclean TAGS tar
262 .PHONY: codectest libavtest test-server fulltest test mpeg4 mpeg
263
264 ifneq ($(wildcard .depend),)
265 include .depend
266 endif