3 # (c) 2000-2004 Fabrice Bellard
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
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)
30 DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
33 ifeq ($(CONFIG_VHOOK),yes)
35 install: install-vhook
38 ifeq ($(BUILD_DOC),yes)
43 SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
44 LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
45 EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
47 ifeq ($(CONFIG_SWSCALER),yes)
48 LDFLAGS+=-L$(BUILD_ROOT)/libswscale
49 EXTRALIBS+=-lswscale$(BUILDSUF)
55 $(MAKE) -C libavutil all
56 $(MAKE) -C libavcodec all
57 $(MAKE) -C libavformat all
58 ifeq ($(CONFIG_PP),yes)
59 $(MAKE) -C libpostproc all
61 ifeq ($(CONFIG_SWSCALER),yes)
62 $(MAKE) -C libswscale all
65 ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
66 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
68 ffserver$(EXESUF): ffserver.o .libs
69 $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
71 ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
72 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
74 %$(EXESUF): %_g$(EXESUF)
78 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
79 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
80 version.h: $(SVN_ENTRIES)
84 $(SRC_PATH)/version.sh $(SRC_PATH)
86 output_example$(EXESUF): output_example.o .libs
87 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
89 qt-faststart$(EXESUF): qt-faststart.c
90 $(CC) $(CFLAGS) $< -o $@
92 cws2fws$(EXESUF): cws2fws.c
93 $(CC) $(CFLAGS) $< -o $@ -lz
95 ffplay.o: CFLAGS += $(SDL_CFLAGS)
97 ffmpeg.o ffplay.o ffserver.o: version.h
100 $(CC) $(CFLAGS) -c -o $@ $<
105 documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
106 ffplay-doc.html hooks.html $(ALLMANPAGES))
108 doc/%.html: doc/%.texi
109 texi2html -monolithic -number $<
112 doc/%.pod: doc/%-doc.texi
113 doc/texi2pod.pl $< $@
116 pod2man --section=1 --center=" " --release=" " $< > $@
118 install: install-progs install-libs install-headers
120 ifeq ($(BUILD_SHARED),yes)
121 install-progs: $(PROGS) install-libs
123 install-progs: $(PROGS)
125 install -d "$(bindir)"
126 install -c -m 755 $(PROGS) "$(bindir)"
128 # Create the Windows installer.
129 wininstaller: all install
130 makensis ffinstall.nsi
133 install -d "$(mandir)/man1"
134 install -m 644 $(MANPAGES) "$(mandir)/man1"
137 $(MAKE) -C vhook install
140 $(MAKE) -C libavutil install-libs
141 $(MAKE) -C libavcodec install-libs
142 $(MAKE) -C libavformat install-libs
143 ifeq ($(CONFIG_PP),yes)
144 $(MAKE) -C libpostproc install-libs
146 ifeq ($(CONFIG_SWSCALER),yes)
147 $(MAKE) -C libswscale install-libs
150 ifeq ($(BUILD_SHARED),yes)
155 $(MAKE) -C libavutil install-headers
156 $(MAKE) -C libavcodec install-headers
157 $(MAKE) -C libavformat install-headers
158 ifeq ($(CONFIG_PP),yes)
159 $(MAKE) -C libpostproc install-headers
161 $(MAKE) -C libswscale install-headers
163 uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
166 rm -f $(addprefix $(bindir)/, $(ALLPROGS))
169 rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))
172 $(MAKE) -C vhook uninstall
175 $(MAKE) -C libavutil uninstall-libs
176 $(MAKE) -C libavcodec uninstall-libs
177 $(MAKE) -C libavformat uninstall-libs
178 $(MAKE) -C libpostproc uninstall-libs
181 $(MAKE) -C libavutil uninstall-headers
182 $(MAKE) -C libavcodec uninstall-headers
183 $(MAKE) -C libavformat uninstall-headers
184 $(MAKE) -C libpostproc uninstall-headers
188 $(MAKE) -C libavutil depend
189 $(MAKE) -C libavcodec depend
190 $(MAKE) -C libavformat depend
191 ifeq ($(CONFIG_PP),yes)
192 $(MAKE) -C libpostproc depend
194 ifeq ($(CONFIG_SWSCALER),yes)
195 $(MAKE) -C libswscale depend
197 ifeq ($(CONFIG_VHOOK),yes)
198 $(MAKE) -C vhook depend
201 .depend: $(SRCS) version.h
202 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
210 $(MAKE) -C libavutil clean
211 $(MAKE) -C libavcodec clean
212 $(MAKE) -C libavformat clean
213 $(MAKE) -C libpostproc clean
214 $(MAKE) -C libswscale clean
215 $(MAKE) -C vhook clean
216 rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
217 output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
218 rm -f doc/*.html doc/*.pod doc/*.1
219 rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
220 rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
223 $(MAKE) -C libavutil distclean
224 $(MAKE) -C libavcodec distclean
225 $(MAKE) -C libavformat distclean
226 $(MAKE) -C libpostproc distclean
227 $(MAKE) -C libswscale distclean
228 $(MAKE) -C vhook distclean
229 rm -f .depend version.h config.* *.pc
232 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
236 fulltest test: codectest libavtest seektest
238 FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref
239 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
240 LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref
241 ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
242 SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
244 test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
246 @echo "Unfortunately ffserver is broken and therefore its regression"
247 @echo "test fails randomly. Treat the results accordingly."
249 $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
251 codectest mpeg4 mpeg ac3 snow snowll: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw tests/tiny_psnr$(EXESUF)
252 $(SRC_PATH)/tests/regression.sh $@ $(FFMPEG_REFFILE) tests/vsynth1
253 $(SRC_PATH)/tests/regression.sh $@ $(ROTOZOOM_REFFILE) tests/vsynth2
255 ifeq ($(CONFIG_GPL),yes)
256 libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
257 $(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1
258 seektest: tests/seek_test$(EXESUF)
259 $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
263 @echo "This test requires FFmpeg to be compiled with --enable-gpl."
268 ifeq ($(CONFIG_SWSCALER),yes)
269 test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error
272 @echo "This regression test is incompatible with --enable-swscaler."
277 tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
278 mkdir -p tests/vsynth1
279 $(BUILD_ROOT)/$< 'tests/vsynth1/'
281 tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
282 mkdir -p tests/vsynth2
283 $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
285 tests/asynth1.sw: tests/audiogen$(EXESUF)
289 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
291 tests/seek_test$(EXESUF): tests/seek_test.c
292 $(CC) $(LDFLAGS) $(CFLAGS) -DHAVE_AV_CONFIG_H -o $@ $< $(EXTRALIBS)
295 .PHONY: all lib videohook documentation install* wininstaller uninstall*
296 .PHONY: dep depend clean distclean TAGS
297 .PHONY: codectest libavtest seektest test-server fulltest test
298 .PHONY: mpeg4 mpeg ac3 snow snowll swscale-error