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