Replace "signed short" typecast with "int16_t" as suggested by
[FFMpeg-mirror/DVCPRO-HD.git] / Makefile
blob2951ebc6c9210061d29f2cff6768d922efe52bd9
2 # Main ffmpeg Makefile
3 # (c) 2000-2004 Fabrice Bellard
5 include config.mak
7 VPATH=$(SRC_PATH_BARE)
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 -DHAVE_AV_CONFIG_H
12 LDFLAGS+= -g
14 PROGS-$(CONFIG_FFMPEG) += ffmpeg
15 PROGS-$(CONFIG_FFPLAY) += ffplay
16 PROGS-$(CONFIG_FFSERVER) += ffserver
18 PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
19 PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
20 MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
22 BASENAMES = ffmpeg ffplay ffserver
23 ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
24 ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
25 ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
27 ifeq ($(BUILD_SHARED),yes)
28 DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
29 else
30 DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
31 endif
33 ALL_TARGETS-$(CONFIG_VHOOK) += videohook
34 ALL_TARGETS-$(BUILD_DOC) += documentation
36 INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
37 INSTALL_TARGETS-$(BUILD_DOC) += install-man
39 VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
41 BASEHOOKS = fish null watermark
42 ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
43 ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
45 HOOKS-$(HAVE_FORK) += ppm
46 HOOKS-$(HAVE_IMLIB2) += imlib2
47 HOOKS-$(HAVE_FREETYPE2) += drawtext
49 HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
51 VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
52 LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
54 VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
55 LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
57 VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
59 SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
60 LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
61 EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
63 ifeq ($(CONFIG_SWSCALER),yes)
64 LDFLAGS+=-L$(BUILD_ROOT)/libswscale
65 EXTRALIBS+=-lswscale$(BUILDSUF)
66 endif
68 all: lib $(PROGS) $(ALL_TARGETS-yes)
70 lib:
71 $(MAKE) -C libavutil all
72 $(MAKE) -C libavcodec all
73 $(MAKE) -C libavformat all
74 ifeq ($(CONFIG_PP),yes)
75 $(MAKE) -C libpostproc all
76 endif
77 ifeq ($(CONFIG_SWSCALER),yes)
78 $(MAKE) -C libswscale all
79 endif
81 ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
82 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
84 ffserver$(EXESUF): ffserver.o cmdutils.o .libs
85 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o cmdutils.o $(EXTRALIBS)
87 ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
88 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
90 %$(EXESUF): %_g$(EXESUF)
91 cp -p $< $@
92 $(STRIP) $@
94 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
95 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
96 version.h: $(SVN_ENTRIES)
97 endif
99 version.h:
100 $(SRC_PATH)/version.sh $(SRC_PATH)
102 output_example$(EXESUF): output_example.o .libs
103 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
105 tools/qt-faststart$(EXESUF): tools/qt-faststart.c
106 $(CC) $(CFLAGS) $< -o $@
108 tools/cws2fws$(EXESUF): tools/cws2fws.c
109 $(CC) $(CFLAGS) $< -o $@ -lz
111 ffplay.o: CFLAGS += $(SDL_CFLAGS)
113 ffmpeg.o ffplay.o ffserver.o: version.h
115 videohook: .libs $(HOOKS)
117 vhook/%$(SLIBSUF): vhook/%.o
118 $(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
120 vhook/%.o: vhook/%.c
121 $(CC) $(VHOOKCFLAGS) -c -o $@ $<
123 %.o: %.c
124 $(CC) $(CFLAGS) -c -o $@ $<
126 documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
127 ffplay-doc.html general.html hooks.html \
128 $(ALLMANPAGES))
130 doc/%.html: doc/%.texi
131 texi2html -monolithic -number $<
132 mv $(@F) $@
134 doc/%.pod: doc/%-doc.texi
135 doc/texi2pod.pl $< $@
137 doc/%.1: doc/%.pod
138 pod2man --section=1 --center=" " --release=" " $< > $@
140 install: install-progs install-libs install-headers $(INSTALL_TARGETS-yes)
142 ifeq ($(BUILD_SHARED),yes)
143 install-progs: $(PROGS) install-libs
144 else
145 install-progs: $(PROGS)
146 endif
147 install -d "$(BINDIR)"
148 install -c -m 755 $(PROGS) "$(BINDIR)"
150 # Create the Windows installer.
151 wininstaller: all install
152 makensis ffinstall.nsi
154 install-man:
155 install -d "$(MANDIR)/man1"
156 install -m 644 $(MANPAGES) "$(MANDIR)/man1"
158 install-vhook: videohook
159 install -d "$(SHLIBDIR)/vhook"
160 install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
162 install-libs:
163 $(MAKE) -C libavutil install-libs
164 $(MAKE) -C libavcodec install-libs
165 $(MAKE) -C libavformat install-libs
166 ifeq ($(CONFIG_PP),yes)
167 $(MAKE) -C libpostproc install-libs
168 endif
169 ifeq ($(CONFIG_SWSCALER),yes)
170 $(MAKE) -C libswscale install-libs
171 endif
173 ifeq ($(BUILD_SHARED),yes)
174 -$(LDCONFIG)
175 endif
177 install-headers:
178 $(MAKE) -C libavutil install-headers
179 $(MAKE) -C libavcodec install-headers
180 $(MAKE) -C libavformat install-headers
181 ifeq ($(CONFIG_PP),yes)
182 $(MAKE) -C libpostproc install-headers
183 endif
184 $(MAKE) -C libswscale install-headers
186 uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
188 uninstall-progs:
189 rm -f $(addprefix $(BINDIR)/, $(ALLPROGS))
191 uninstall-man:
192 rm -f $(addprefix $(MANDIR)/man1/,$(ALLMANPAGES))
194 uninstall-vhook:
195 rm -f $(addprefix $(SHLIBDIR)/vhook/,$(ALLHOOKS))
196 -rmdir "$(SHLIBDIR)/vhook/"
198 uninstall-libs:
199 $(MAKE) -C libavutil uninstall-libs
200 $(MAKE) -C libavcodec uninstall-libs
201 $(MAKE) -C libavformat uninstall-libs
202 $(MAKE) -C libpostproc uninstall-libs
203 $(MAKE) -C libswscale uninstall-libs
205 uninstall-headers:
206 $(MAKE) -C libavutil uninstall-headers
207 $(MAKE) -C libavcodec uninstall-headers
208 $(MAKE) -C libavformat uninstall-headers
209 $(MAKE) -C libpostproc uninstall-headers
210 $(MAKE) -C libswscale uninstall-headers
211 -rmdir "$(INCDIR)"
213 depend dep: .depend .vhookdep
214 $(MAKE) -C libavutil depend
215 $(MAKE) -C libavcodec depend
216 $(MAKE) -C libavformat depend
217 ifeq ($(CONFIG_PP),yes)
218 $(MAKE) -C libpostproc depend
219 endif
220 ifeq ($(CONFIG_SWSCALER),yes)
221 $(MAKE) -C libswscale depend
222 endif
224 .depend: $(SRCS) version.h
225 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
227 # gcc stupidly only outputs the basename of targets
228 .vhookdep: $(ALLHOOKS_SRCS)
229 $(CC) $(VHOOKCFLAGS) -MM $^ | sed 's,^\([a-z]\),vhook/\1,' > $@
231 $(DEP_LIBS): lib
233 .libs: $(DEP_LIBS)
234 touch $@
236 clean:
237 $(MAKE) -C libavutil clean
238 $(MAKE) -C libavcodec clean
239 $(MAKE) -C libavformat clean
240 $(MAKE) -C libpostproc clean
241 $(MAKE) -C libswscale clean
242 rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
243 output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
244 rm -f doc/*.html doc/*.pod doc/*.1
245 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
246 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
247 rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
249 distclean: clean
250 $(MAKE) -C libavutil distclean
251 $(MAKE) -C libavcodec distclean
252 $(MAKE) -C libavformat distclean
253 $(MAKE) -C libpostproc distclean
254 $(MAKE) -C libswscale distclean
255 rm -f .depend .vhookdep version.h config.* *.pc
257 TAGS:
258 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
260 # regression tests
262 fulltest test: codectest libavtest seektest
264 FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
265 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
266 LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
267 ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
268 SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
270 test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
271 @echo
272 @echo "Unfortunately ffserver is broken and therefore its regression"
273 @echo "test fails randomly. Treat the results accordingly."
274 @echo
275 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
277 codectest mpeg4 mpeg ac3 snow snowll: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw tests/tiny_psnr$(EXESUF)
278 $(SRC_PATH)/tests/regression.sh $@ $(FFMPEG_REFFILE) tests/vsynth1
279 $(SRC_PATH)/tests/regression.sh $@ $(ROTOZOOM_REFFILE) tests/vsynth2
281 libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
282 $(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1
284 seektest: tests/seek_test$(EXESUF)
285 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
287 ifeq ($(CONFIG_SWSCALER),yes)
288 test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error
289 swscale_error:
290 @echo
291 @echo "This regression test is incompatible with --enable-swscaler."
292 @echo
293 @exit 1
294 endif
296 tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
297 mkdir -p tests/vsynth1
298 $(BUILD_ROOT)/$< 'tests/vsynth1/'
300 tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
301 mkdir -p tests/vsynth2
302 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
304 tests/asynth1.sw: tests/audiogen$(EXESUF)
305 $(BUILD_ROOT)/$< $@
307 %$(EXESUF): %.c
308 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
310 tests/seek_test$(EXESUF): tests/seek_test.c .libs
311 $(CC) $(LDFLAGS) $(CFLAGS) -DHAVE_AV_CONFIG_H -o $@ $< $(EXTRALIBS)
314 .PHONY: all lib videohook documentation install* wininstaller uninstall*
315 .PHONY: dep depend clean distclean TAGS
316 .PHONY: codectest libavtest seektest test-server fulltest test
317 .PHONY: mpeg4 mpeg ac3 snow snowll swscale-error
319 -include .depend
320 -include .vhookdep