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 \ |
364a9607 | 11 | -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H |
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 | |
bb8fe69a DB |
18 | PROGS = $(addsuffix $(EXESUF), $(PROGS-yes)) |
19 | PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes)) | |
20 | MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes))) | |
85f07f22 | 21 | |
bb8fe69a DB |
22 | BASENAMES = ffmpeg ffplay ffserver |
23 | ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES)) | |
24 | ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES)) | |
25 | ALLMANPAGES = $(addsuffix .1, $(BASENAMES)) | |
6b991cb2 | 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) |
06694949 | 48 | LDFLAGS+=-L$(BUILD_ROOT)/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 |
18caf192 | 87 | $(CC) $(CFLAGS) $(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 |
18caf192 | 93 | $(CC) $(CFLAGS) $< -o $@ -lz |
f7599d5f | 94 | |
4566de57 | 95 | ffplay.o: CFLAGS += $(SDL_CFLAGS) |
2744a37f | 96 | |
496cfa3c MR |
97 | ffmpeg.o ffplay.o ffserver.o: version.h |
98 | ||
85f07f22 | 99 | %.o: %.c |
115329f1 | 100 | $(CC) $(CFLAGS) -c -o $@ $< |
85f07f22 | 101 | |
be12b2a4 | 102 | videohook: .libs |
142fc6b9 PG |
103 | $(MAKE) -C vhook all |
104 | ||
e9b19db8 DB |
105 | documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \ |
106 | ffplay-doc.html hooks.html $(ALLMANPAGES)) | |
107 | ||
108 | doc/%.html: doc/%.texi | |
109 | texi2html -monolithic -number $< | |
110 | mv $(@F) $@ | |
111 | ||
112 | doc/%.pod: doc/%-doc.texi | |
113 | doc/texi2pod.pl $< $@ | |
114 | ||
115 | doc/%.1: doc/%.pod | |
116 | pod2man --section=1 --center=" " --release=" " $< > $@ | |
146ea952 | 117 | |
4c9b0af5 | 118 | install: install-progs install-libs install-headers |
81dcdc53 | 119 | |
a4848db6 | 120 | ifeq ($(BUILD_SHARED),yes) |
7d2f4546 | 121 | install-progs: $(PROGS) install-libs |
a4848db6 | 122 | else |
7d2f4546 | 123 | install-progs: $(PROGS) |
a4848db6 | 124 | endif |
951bf3e6 | 125 | install -d "$(bindir)" |
ca3798dc | 126 | install -c -m 755 $(PROGS) "$(bindir)" |
85f07f22 | 127 | |
7a7be126 | 128 | # Create the Windows installer. |
d35ff76b FB |
129 | wininstaller: all install |
130 | makensis ffinstall.nsi | |
131 | ||
23a65308 | 132 | install-man: |
8233b750 DB |
133 | install -d "$(mandir)/man1" |
134 | install -m 644 $(MANPAGES) "$(mandir)/man1" | |
23a65308 | 135 | |
aa99b8ff MN |
136 | install-vhook: |
137 | $(MAKE) -C vhook install | |
142fc6b9 | 138 | |
b12f8273 | 139 | install-libs: |
8b2121e3 MR |
140 | $(MAKE) -C libavutil install-libs |
141 | $(MAKE) -C libavcodec install-libs | |
142 | $(MAKE) -C libavformat install-libs | |
1a9150b1 | 143 | ifeq ($(CONFIG_PP),yes) |
6d9a2421 | 144 | $(MAKE) -C libpostproc install-libs |
1a9150b1 | 145 | endif |
790c9ca7 LA |
146 | ifeq ($(CONFIG_SWSCALER),yes) |
147 | $(MAKE) -C libswscale install-libs | |
148 | endif | |
149 | ||
8b2121e3 | 150 | ifeq ($(BUILD_SHARED),yes) |
1e7ffa50 | 151 | -$(LDCONFIG) |
b12f8273 | 152 | endif |
37736979 | 153 | |
f29f3b5d DB |
154 | install-headers: |
155 | $(MAKE) -C libavutil install-headers | |
156 | $(MAKE) -C libavcodec install-headers | |
157 | $(MAKE) -C libavformat install-headers | |
1a9150b1 | 158 | ifeq ($(CONFIG_PP),yes) |
6d9a2421 | 159 | $(MAKE) -C libpostproc install-headers |
1a9150b1 | 160 | endif |
790c9ca7 | 161 | $(MAKE) -C libswscale install-headers |
f29f3b5d | 162 | |
f9edb717 DB |
163 | uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook |
164 | ||
f9edb717 DB |
165 | uninstall-progs: |
166 | rm -f $(addprefix $(bindir)/, $(ALLPROGS)) | |
167 | ||
f9edb717 | 168 | uninstall-man: |
f9edb717 | 169 | rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES)) |
f9edb717 DB |
170 | |
171 | uninstall-vhook: | |
172 | $(MAKE) -C vhook uninstall | |
173 | ||
174 | uninstall-libs: | |
175 | $(MAKE) -C libavutil uninstall-libs | |
176 | $(MAKE) -C libavcodec uninstall-libs | |
177 | $(MAKE) -C libavformat uninstall-libs | |
6d9a2421 | 178 | $(MAKE) -C libpostproc uninstall-libs |
f9edb717 DB |
179 | |
180 | uninstall-headers: | |
181 | $(MAKE) -C libavutil uninstall-headers | |
182 | $(MAKE) -C libavcodec uninstall-headers | |
183 | $(MAKE) -C libavformat uninstall-headers | |
6d9a2421 | 184 | $(MAKE) -C libpostproc uninstall-headers |
f9edb717 | 185 | -rmdir "$(incdir)" |
f9edb717 | 186 | |
354ca798 | 187 | depend dep: .depend |
ea0f0681 | 188 | $(MAKE) -C libavutil depend |
5d22ccf7 | 189 | $(MAKE) -C libavcodec depend |
c80d990f | 190 | $(MAKE) -C libavformat depend |
691c480e DB |
191 | ifeq ($(CONFIG_PP),yes) |
192 | $(MAKE) -C libpostproc depend | |
193 | endif | |
eaa6d7b6 DB |
194 | ifeq ($(CONFIG_SWSCALER),yes) |
195 | $(MAKE) -C libswscale depend | |
196 | endif | |
d226c750 | 197 | ifeq ($(CONFIG_VHOOK),yes) |
5d22ccf7 | 198 | $(MAKE) -C vhook depend |
811b32ed | 199 | endif |
4b8b2edb | 200 | |
fd071c26 | 201 | .depend: $(SRCS) version.h |
0032cac2 | 202 | $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend |
57514323 | 203 | |
da34f7ac MR |
204 | $(DEP_LIBS): lib |
205 | ||
206 | .libs: $(DEP_LIBS) | |
207 | touch $@ | |
cf2818b0 | 208 | |
98013cc1 | 209 | clean: |
5d22ccf7 DB |
210 | $(MAKE) -C libavutil clean |
211 | $(MAKE) -C libavcodec clean | |
abac6175 | 212 | $(MAKE) -C libavformat clean |
6d9a2421 | 213 | $(MAKE) -C libpostproc clean |
790c9ca7 | 214 | $(MAKE) -C libswscale clean |
5d22ccf7 | 215 | $(MAKE) -C vhook clean |
b8d40825 | 216 | rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \ |
3e4134f6 | 217 | output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF) |
e9b19db8 | 218 | rm -f doc/*.html doc/*.pod doc/*.1 |
4fbd52f0 DB |
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)) | |
142fc6b9 | 221 | |
85f07f22 | 222 | distclean: clean |
98013cc1 DB |
223 | $(MAKE) -C libavutil distclean |
224 | $(MAKE) -C libavcodec distclean | |
225 | $(MAKE) -C libavformat distclean | |
6d9a2421 | 226 | $(MAKE) -C libpostproc distclean |
790c9ca7 | 227 | $(MAKE) -C libswscale distclean |
98013cc1 | 228 | $(MAKE) -C vhook distclean |
5c6a5d58 | 229 | rm -f .depend version.h config.* *.pc |
85f07f22 FB |
230 | |
231 | TAGS: | |
abac6175 | 232 | etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch] |
57514323 | 233 | |
dd9ca370 FB |
234 | # regression tests |
235 | ||
4fbd52f0 | 236 | fulltest test: codectest libavtest seektest |
4fbd52f0 DB |
237 | |
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 | |
243 | ||
b13cdd33 | 244 | test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw |
4fbd52f0 DB |
245 | @echo |
246 | @echo "Unfortunately ffserver is broken and therefore its regression" | |
247 | @echo "test fails randomly. Treat the results accordingly." | |
248 | @echo | |
249 | $(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf | |
250 | ||
b13cdd33 | 251 | 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 |
252 | $(SRC_PATH)/tests/regression.sh $@ $(FFMPEG_REFFILE) tests/vsynth1 |
253 | $(SRC_PATH)/tests/regression.sh $@ $(ROTOZOOM_REFFILE) tests/vsynth2 | |
254 | ||
255 | ifeq ($(CONFIG_GPL),yes) | |
b13cdd33 | 256 | libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw |
4fbd52f0 DB |
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) | |
260 | else | |
261 | libavtest seektest: | |
262 | @echo | |
263 | @echo "This test requires FFmpeg to be compiled with --enable-gpl." | |
264 | @echo | |
265 | @exit 1 | |
266 | endif | |
267 | ||
268 | ifeq ($(CONFIG_SWSCALER),yes) | |
269 | test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error | |
270 | swscale_error: | |
271 | @echo | |
272 | @echo "This regression test is incompatible with --enable-swscaler." | |
273 | @echo | |
274 | @exit 1 | |
275 | endif | |
276 | ||
277 | tests/vsynth1/00.pgm: tests/videogen$(EXESUF) | |
278 | mkdir -p tests/vsynth1 | |
279 | $(BUILD_ROOT)/$< 'tests/vsynth1/' | |
280 | ||
281 | tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF) | |
282 | mkdir -p tests/vsynth2 | |
283 | $(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm | |
284 | ||
285 | tests/asynth1.sw: tests/audiogen$(EXESUF) | |
286 | $(BUILD_ROOT)/$< $@ | |
287 | ||
288 | %$(EXESUF): %.c | |
289 | $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< | |
290 | ||
291 | tests/seek_test$(EXESUF): tests/seek_test.c | |
292 | $(CC) $(LDFLAGS) $(CFLAGS) -DHAVE_AV_CONFIG_H -o $@ $< $(EXTRALIBS) | |
293 | ||
dd9ca370 | 294 | |
3263626f | 295 | .PHONY: all lib videohook documentation install* wininstaller uninstall* |
bedb3550 | 296 | .PHONY: dep depend clean distclean TAGS |
5e2dfd39 | 297 | .PHONY: codectest libavtest seektest test-server fulltest test |
4fbd52f0 | 298 | .PHONY: mpeg4 mpeg ac3 snow snowll swscale-error |
cf2818b0 | 299 | |
6ca0c110 | 300 | -include .depend |