Commit | Line | Data |
---|---|---|
a1b63811 | 1 | # |
85f07f22 | 2 | # Main ffmpeg Makefile |
38100e8c | 3 | # (c) 2000-2004 Fabrice Bellard |
85f07f22 | 4 | # |
980fc7b8 | 5 | include config.mak |
85f07f22 | 6 | |
997baf01 | 7 | VPATH=$(SRC_PATH_BARE) |
dd9ca370 | 8 | |
cbeee4d8 | 9 | CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \ |
a163ed1a | 10 | -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \ |
4b65d88f | 11 | -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE |
115329f1 | 12 | LDFLAGS+= -g |
37736979 | 13 | |
0cb8579a MR |
14 | PROGS-$(CONFIG_FFMPEG) += ffmpeg |
15 | PROGS-$(CONFIG_FFPLAY) += ffplay | |
16 | PROGS-$(CONFIG_FFSERVER) += ffserver | |
01310af2 | 17 | |
0cb8579a MR |
18 | PROGS = $(addsuffix $(EXESUF), $(PROGS-yes)) |
19 | PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes)) | |
20 | MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes))) | |
85f07f22 | 21 | |
6b991cb2 DB |
22 | BASENAMES=ffmpeg ffplay ffserver |
23 | ALLPROGS=$(addsuffix $(EXESUF), $(BASENAMES)) | |
24 | ALLPROGS_G=$(addsuffix _g$(EXESUF), $(BASENAMES)) | |
25 | ALLMANPAGES=$(addsuffix .1, $(BASENAMES)) | |
26 | ||
0fd94442 | 27 | ifeq ($(BUILD_SHARED),yes) |
6bc114b2 | 28 | DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) |
0fd94442 | 29 | else |
f3ec2d46 | 30 | DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) |
f02be79d RS |
31 | endif |
32 | ||
d226c750 | 33 | ifeq ($(CONFIG_VHOOK),yes) |
4c9b0af5 MR |
34 | all: videohook |
35 | install: install-vhook | |
47930f09 | 36 | endif |
142fc6b9 | 37 | |
146ea952 | 38 | ifeq ($(BUILD_DOC),yes) |
4c9b0af5 MR |
39 | all: documentation |
40 | install: install-man | |
146ea952 NB |
41 | endif |
42 | ||
7f0f6e13 | 43 | SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c |
84471efd | 44 | LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS) |
8dc6f118 | 45 | EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS) |
57514323 | 46 | |
790c9ca7 | 47 | ifeq ($(CONFIG_SWSCALER),yes) |
cc654dd7 | 48 | LDFLAGS+=-L./libswscale |
6de9e506 | 49 | EXTRALIBS+=-lswscale$(BUILDSUF) |
790c9ca7 LA |
50 | endif |
51 | ||
4c9b0af5 | 52 | all: lib $(PROGS) |
85f07f22 | 53 | |
951bf3e6 | 54 | lib: |
5d22ccf7 DB |
55 | $(MAKE) -C libavutil all |
56 | $(MAKE) -C libavcodec all | |
abac6175 | 57 | $(MAKE) -C libavformat all |
1a9150b1 | 58 | ifeq ($(CONFIG_PP),yes) |
6d9a2421 | 59 | $(MAKE) -C libpostproc all |
1a9150b1 | 60 | endif |
790c9ca7 LA |
61 | ifeq ($(CONFIG_SWSCALER),yes) |
62 | $(MAKE) -C libswscale all | |
63 | endif | |
85f07f22 | 64 | |
951bf3e6 | 65 | ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs |
6de9e506 | 66 | $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS) |
85f07f22 | 67 | |
951bf3e6 | 68 | ffserver$(EXESUF): ffserver.o .libs |
6de9e506 | 69 | $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(EXTRALIBS) |
85f07f22 | 70 | |
951bf3e6 | 71 | ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs |
6de9e506 | 72 | $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS) |
01310af2 | 73 | |
0cfd96cc | 74 | %$(EXESUF): %_g$(EXESUF) |
01310af2 FB |
75 | cp -p $< $@ |
76 | $(STRIP) $@ | |
77 | ||
a4da50e1 MR |
78 | SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries |
79 | ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES)) | |
80 | version.h: $(SVN_ENTRIES) | |
81 | endif | |
82 | ||
f1cc88a5 | 83 | version.h: |
997baf01 | 84 | $(SRC_PATH)/version.sh $(SRC_PATH) |
f1cc88a5 | 85 | |
951bf3e6 | 86 | output_example$(EXESUF): output_example.o .libs |
ed7bf3c3 | 87 | $(CC) $(LDFLAGS) -o $@ $< $(EXTRALIBS) |
8de65d4f | 88 | |
38100e8c | 89 | qt-faststart$(EXESUF): qt-faststart.c |
3acc68b4 | 90 | $(CC) $(CFLAGS) $< -o $@ |
38100e8c | 91 | |
f7599d5f | 92 | cws2fws$(EXESUF): cws2fws.c |
3acc68b4 | 93 | $(CC) $< -o $@ -lz |
f7599d5f | 94 | |
01310af2 | 95 | ffplay.o: ffplay.c |
115329f1 | 96 | $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $< |
2744a37f | 97 | |
496cfa3c MR |
98 | ffmpeg.o ffplay.o ffserver.o: version.h |
99 | ||
85f07f22 | 100 | %.o: %.c |
115329f1 | 101 | $(CC) $(CFLAGS) -c -o $@ $< |
85f07f22 | 102 | |
be12b2a4 | 103 | videohook: .libs |
142fc6b9 PG |
104 | $(MAKE) -C vhook all |
105 | ||
e9b19db8 DB |
106 | documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \ |
107 | ffplay-doc.html hooks.html $(ALLMANPAGES)) | |
108 | ||
109 | doc/%.html: doc/%.texi | |
110 | texi2html -monolithic -number $< | |
111 | mv $(@F) $@ | |
112 | ||
113 | doc/%.pod: doc/%-doc.texi | |
114 | doc/texi2pod.pl $< $@ | |
115 | ||
116 | doc/%.1: doc/%.pod | |
117 | pod2man --section=1 --center=" " --release=" " $< > $@ | |
146ea952 | 118 | |
4c9b0af5 | 119 | install: install-progs install-libs install-headers |
81dcdc53 | 120 | |
a4848db6 | 121 | ifeq ($(BUILD_SHARED),yes) |
7d2f4546 | 122 | install-progs: $(PROGS) install-libs |
a4848db6 | 123 | else |
7d2f4546 | 124 | install-progs: $(PROGS) |
a4848db6 | 125 | endif |
951bf3e6 | 126 | install -d "$(bindir)" |
ca3798dc | 127 | install -c -m 755 $(PROGS) "$(bindir)" |
85f07f22 | 128 | |
7a7be126 | 129 | # Create the Windows installer. |
d35ff76b FB |
130 | wininstaller: all install |
131 | makensis ffinstall.nsi | |
132 | ||
23a65308 | 133 | install-man: |
8233b750 DB |
134 | install -d "$(mandir)/man1" |
135 | install -m 644 $(MANPAGES) "$(mandir)/man1" | |
23a65308 | 136 | |
aa99b8ff MN |
137 | install-vhook: |
138 | $(MAKE) -C vhook install | |
142fc6b9 | 139 | |
b12f8273 | 140 | install-libs: |
8b2121e3 MR |
141 | $(MAKE) -C libavutil install-libs |
142 | $(MAKE) -C libavcodec install-libs | |
143 | $(MAKE) -C libavformat install-libs | |
1a9150b1 | 144 | ifeq ($(CONFIG_PP),yes) |
6d9a2421 | 145 | $(MAKE) -C libpostproc install-libs |
1a9150b1 | 146 | endif |
790c9ca7 LA |
147 | ifeq ($(CONFIG_SWSCALER),yes) |
148 | $(MAKE) -C libswscale install-libs | |
149 | endif | |
150 | ||
8b2121e3 | 151 | ifeq ($(BUILD_SHARED),yes) |
1e7ffa50 | 152 | -$(LDCONFIG) |
b12f8273 | 153 | endif |
37736979 | 154 | |
f29f3b5d DB |
155 | install-headers: |
156 | $(MAKE) -C libavutil install-headers | |
157 | $(MAKE) -C libavcodec install-headers | |
158 | $(MAKE) -C libavformat install-headers | |
1a9150b1 | 159 | ifeq ($(CONFIG_PP),yes) |
6d9a2421 | 160 | $(MAKE) -C libpostproc install-headers |
1a9150b1 | 161 | endif |
790c9ca7 | 162 | $(MAKE) -C libswscale install-headers |
f29f3b5d | 163 | |
f9edb717 DB |
164 | uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook |
165 | ||
f9edb717 DB |
166 | uninstall-progs: |
167 | rm -f $(addprefix $(bindir)/, $(ALLPROGS)) | |
168 | ||
f9edb717 | 169 | uninstall-man: |
f9edb717 | 170 | rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES)) |
f9edb717 DB |
171 | |
172 | uninstall-vhook: | |
173 | $(MAKE) -C vhook uninstall | |
174 | ||
175 | uninstall-libs: | |
176 | $(MAKE) -C libavutil uninstall-libs | |
177 | $(MAKE) -C libavcodec uninstall-libs | |
178 | $(MAKE) -C libavformat uninstall-libs | |
6d9a2421 | 179 | $(MAKE) -C libpostproc uninstall-libs |
f9edb717 DB |
180 | |
181 | uninstall-headers: | |
182 | $(MAKE) -C libavutil uninstall-headers | |
183 | $(MAKE) -C libavcodec uninstall-headers | |
184 | $(MAKE) -C libavformat uninstall-headers | |
6d9a2421 | 185 | $(MAKE) -C libpostproc uninstall-headers |
f9edb717 DB |
186 | -rmdir "$(incdir)" |
187 | -rmdir "$(prefix)/include/postproc" | |
188 | ||
354ca798 | 189 | depend dep: .depend |
ea0f0681 | 190 | $(MAKE) -C libavutil depend |
5d22ccf7 | 191 | $(MAKE) -C libavcodec depend |
c80d990f | 192 | $(MAKE) -C libavformat depend |
691c480e DB |
193 | ifeq ($(CONFIG_PP),yes) |
194 | $(MAKE) -C libpostproc depend | |
195 | endif | |
eaa6d7b6 DB |
196 | ifeq ($(CONFIG_SWSCALER),yes) |
197 | $(MAKE) -C libswscale depend | |
198 | endif | |
d226c750 | 199 | ifeq ($(CONFIG_VHOOK),yes) |
5d22ccf7 | 200 | $(MAKE) -C vhook depend |
811b32ed | 201 | endif |
4b8b2edb | 202 | |
fd071c26 | 203 | .depend: $(SRCS) version.h |
0032cac2 | 204 | $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend |
57514323 | 205 | |
da34f7ac MR |
206 | $(DEP_LIBS): lib |
207 | ||
208 | .libs: $(DEP_LIBS) | |
209 | touch $@ | |
cf2818b0 | 210 | |
98013cc1 | 211 | clean: |
5d22ccf7 DB |
212 | $(MAKE) -C libavutil clean |
213 | $(MAKE) -C libavcodec clean | |
abac6175 | 214 | $(MAKE) -C libavformat clean |
6d9a2421 | 215 | $(MAKE) -C libpostproc clean |
790c9ca7 | 216 | $(MAKE) -C libswscale clean |
5d22ccf7 | 217 | $(MAKE) -C vhook clean |
3e4134f6 DB |
218 | rm -f *.o *.d *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \ |
219 | output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF) | |
e9b19db8 | 220 | rm -f doc/*.html doc/*.pod doc/*.1 |
4fbd52f0 DB |
221 | rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~ |
222 | rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr)) | |
142fc6b9 | 223 | |
85f07f22 | 224 | distclean: clean |
98013cc1 DB |
225 | $(MAKE) -C libavutil distclean |
226 | $(MAKE) -C libavcodec distclean | |
227 | $(MAKE) -C libavformat distclean | |
6d9a2421 | 228 | $(MAKE) -C libpostproc distclean |
790c9ca7 | 229 | $(MAKE) -C libswscale distclean |
98013cc1 | 230 | $(MAKE) -C vhook distclean |
5c6a5d58 | 231 | rm -f .depend version.h config.* *.pc |
85f07f22 FB |
232 | |
233 | TAGS: | |
abac6175 | 234 | etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch] |
57514323 | 235 | |
dd9ca370 FB |
236 | # regression tests |
237 | ||
4fbd52f0 | 238 | fulltest test: codectest libavtest seektest |
4fbd52f0 DB |
239 | |
240 | FFMPEG_REFFILE = $(SRC_PATH)/tests/ffmpeg.regression.ref | |
241 | FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref | |
242 | LIBAV_REFFILE = $(SRC_PATH)/tests/libav.regression.ref | |
243 | ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref | |
244 | SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref | |
245 | ||
b13cdd33 | 246 | test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw |
4fbd52f0 DB |
247 | @echo |
248 | @echo "Unfortunately ffserver is broken and therefore its regression" | |
249 | @echo "test fails randomly. Treat the results accordingly." | |
250 | @echo | |
251 | $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf | |
252 | ||
b13cdd33 | 253 | codectest mpeg4 mpeg ac3 snow snowll: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw tests/tiny_psnr$(EXESUF) |
4fbd52f0 DB |
254 | $(SRC_PATH)/tests/regression.sh $@ $(FFMPEG_REFFILE) tests/vsynth1 |
255 | $(SRC_PATH)/tests/regression.sh $@ $(ROTOZOOM_REFFILE) tests/vsynth2 | |
256 | ||
257 | ifeq ($(CONFIG_GPL),yes) | |
b13cdd33 | 258 | libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw |
4fbd52f0 DB |
259 | $(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1 |
260 | seektest: tests/seek_test$(EXESUF) | |
261 | $(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE) | |
262 | else | |
263 | libavtest seektest: | |
264 | @echo | |
265 | @echo "This test requires FFmpeg to be compiled with --enable-gpl." | |
266 | @echo | |
267 | @exit 1 | |
268 | endif | |
269 | ||
270 | ifeq ($(CONFIG_SWSCALER),yes) | |
271 | test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error | |
272 | swscale_error: | |
273 | @echo | |
274 | @echo "This regression test is incompatible with --enable-swscaler." | |
275 | @echo | |
276 | @exit 1 | |
277 | endif | |
278 | ||
279 | tests/vsynth1/00.pgm: tests/videogen$(EXESUF) | |
280 | mkdir -p tests/vsynth1 | |
281 | $(BUILD_ROOT)/$< 'tests/vsynth1/' | |
282 | ||
283 | tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF) | |
284 | mkdir -p tests/vsynth2 | |
285 | $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm | |
286 | ||
287 | tests/asynth1.sw: tests/audiogen$(EXESUF) | |
288 | $(BUILD_ROOT)/$< $@ | |
289 | ||
290 | %$(EXESUF): %.c | |
291 | $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< | |
292 | ||
293 | tests/seek_test$(EXESUF): tests/seek_test.c | |
294 | $(CC) $(LDFLAGS) $(CFLAGS) -DHAVE_AV_CONFIG_H -o $@ $< $(EXTRALIBS) | |
295 | ||
dd9ca370 | 296 | |
3263626f | 297 | .PHONY: all lib videohook documentation install* wininstaller uninstall* |
bedb3550 | 298 | .PHONY: dep depend clean distclean TAGS |
5e2dfd39 | 299 | .PHONY: codectest libavtest seektest test-server fulltest test |
4fbd52f0 | 300 | .PHONY: mpeg4 mpeg ac3 snow snowll swscale-error |
cf2818b0 | 301 | |
6ca0c110 | 302 | -include .depend |