Statistics
| Branch: | Revision:

ffmpeg / Makefile @ f63b6dc0

History | View | Annotate | Download (15.1 KB)

1
#
2
# Main ffmpeg Makefile
3
# (c) 2000-2004 Fabrice Bellard
4
#
5
include config.mak
6

    
7
vpath %.c    $(SRC_PATH_BARE)
8
vpath %.h    $(SRC_PATH_BARE)
9
vpath %.texi $(SRC_PATH_BARE)
10

    
11
CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
12
       -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
13
       -I$(SRC_PATH)/libavdevice -I$(SRC_PATH)/libavfilter \
14
       -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H
15
LDFLAGS+= -g
16

    
17
PROGS-$(CONFIG_FFMPEG)   += ffmpeg
18
PROGS-$(CONFIG_FFPLAY)   += ffplay
19
PROGS-$(CONFIG_FFSERVER) += ffserver
20

    
21
PROGS       = $(addsuffix   $(EXESUF), $(PROGS-yes))
22
PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
23
MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
24

    
25
BASENAMES   = ffmpeg ffplay ffserver
26
ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
27
ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
28
ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
29

    
30
ifeq ($(BUILD_SHARED),yes)
31
DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavdevice/$(SLIBPREF)avdevice$(SLIBSUF)
32
else
33
DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavdevice/$(LIBPREF)avdevice$(LIBSUF)
34
endif
35

    
36
ALL_TARGETS-$(CONFIG_VHOOK) += videohook
37
ALL_TARGETS-$(BUILD_DOC)    += documentation
38

    
39
INSTALL_TARGETS-$(CONFIG_VHOOK) += install-vhook
40
ifneq ($(PROGS),)
41
INSTALL_TARGETS-yes             += install-progs
42
INSTALL_TARGETS-$(BUILD_DOC)    += install-man
43
endif
44

    
45
VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
46

    
47
BASEHOOKS = fish null watermark
48
ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
49
ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
50

    
51
HOOKS-$(HAVE_FORK)      += ppm
52
HOOKS-$(HAVE_IMLIB2)    += imlib2
53
HOOKS-$(HAVE_FREETYPE2) += drawtext
54

    
55
HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
56

    
57
VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
58
LIBS_imlib2$(SLIBSUF)       = `imlib2-config --libs`
59

    
60
VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
61
LIBS_drawtext$(SLIBSUF)        = `freetype-config --libs`
62

    
63
VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
64

    
65
SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
66
LDFLAGS := -L$(BUILD_ROOT)/libavdevice -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
67
EXTRALIBS := -lavdevice$(BUILDSUF) -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
68

    
69
ifeq ($(CONFIG_SWSCALE),yes)
70
LDFLAGS+=-L$(BUILD_ROOT)/libswscale
71
EXTRALIBS+=-lswscale$(BUILDSUF)
72
endif
73

    
74
ifeq ($(CONFIG_AVFILTER),yes)
75
LDFLAGS+=-L$(BUILD_ROOT)/libavfilter
76
EXTRALIBS := -lavfilter$(BUILDSUF) $(EXTRALIBS)
77
endif
78

    
79
MAKE-yes = $(MAKE)
80
MAKE-    = : $(MAKE)
81

    
82
all: lib $(PROGS) $(ALL_TARGETS-yes)
83

    
84
lib:
85
	$(MAKE)                    -C libavutil   all
86
	$(MAKE)                    -C libavcodec  all
87
	$(MAKE)                    -C libavformat all
88
	$(MAKE)                    -C libavdevice all
89
	$(MAKE-$(CONFIG_POSTPROC)) -C libpostproc all
90
	$(MAKE-$(CONFIG_SWSCALE))  -C libswscale  all
91
	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter all
92

    
93
ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
94
	$(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
95

    
96
ffserver$(EXESUF): ffserver.o cmdutils.o .libs
97
	$(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o cmdutils.o $(EXTRALIBS)
98

    
99
ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
100
	$(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
101

    
102
%$(EXESUF): %_g$(EXESUF)
103
	cp -p $< $@
104
	$(STRIP) $@
105

    
106
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
107
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
108
version.h: $(SVN_ENTRIES)
109
endif
110

    
111
version.h:
112
	$(SRC_PATH)/version.sh $(SRC_PATH)
113

    
114
output_example$(EXESUF): output_example.o .libs
115
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
116

    
117
tools/%$(EXESUF): tools/%.c
118
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
119

    
120
ffplay.o .depend: CFLAGS += $(SDL_CFLAGS)
121

    
122
ffmpeg.o ffplay.o ffserver.o: version.h
123

    
124
# vhooks compile fine without libav*, but need them nonetheless.
125
videohook: .libs $(HOOKS)
126

    
127
vhook/%$(SLIBSUF): vhook/%.o
128
	$(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
129

    
130
vhook/%.o: vhook/%.c
131
	$(CC) $(VHOOKCFLAGS) -c -o $@ $<
132

    
133
%.o: %.c
134
	$(CC) $(CFLAGS) -c -o $@ $<
135

    
136
documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
137
                                 ffplay-doc.html general.html hooks.html \
138
                                 $(ALLMANPAGES))
139

    
140
doc/%.html: doc/%.texi
141
	texi2html -monolithic -number $<
142
	mv $(@F) $@
143

    
144
doc/%.pod: doc/%-doc.texi
145
	doc/texi2pod.pl $< $@
146

    
147
doc/%.1: doc/%.pod
148
	pod2man --section=1 --center=" " --release=" " $< > $@
149

    
150
install: install-libs install-headers $(INSTALL_TARGETS-yes)
151

    
152
ifeq ($(BUILD_SHARED),yes)
153
install-progs: install-libs
154
endif
155
install-progs: $(PROGS)
156
	install -d "$(BINDIR)"
157
	install -c -m 755 $(PROGS) "$(BINDIR)"
158

    
159
install-man:
160
	install -d "$(MANDIR)/man1"
161
	install -m 644 $(MANPAGES) "$(MANDIR)/man1"
162

    
163
install-vhook: videohook
164
	install -d "$(SHLIBDIR)/vhook"
165
	install -m 755 $(HOOKS) "$(SHLIBDIR)/vhook"
166

    
167
install-libs:
168
	$(MAKE)                    -C libavutil   install-libs
169
	$(MAKE)                    -C libavcodec  install-libs
170
	$(MAKE)                    -C libavformat install-libs
171
	$(MAKE)                    -C libavdevice install-libs
172
	$(MAKE-$(CONFIG_POSTPROC)) -C libpostproc install-libs
173
	$(MAKE-$(CONFIG_SWSCALE))  -C libswscale  install-libs
174
	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter install-libs
175

    
176
install-headers:
177
	$(MAKE)                    -C libavutil   install-headers
178
	$(MAKE)                    -C libavcodec  install-headers
179
	$(MAKE)                    -C libavformat install-headers
180
	$(MAKE)                    -C libavdevice install-headers
181
	$(MAKE-$(CONFIG_POSTPROC)) -C libpostproc install-headers
182
	$(MAKE)                    -C libswscale  install-headers
183
	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter install-headers
184

    
185
uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
186

    
187
uninstall-progs:
188
	rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
189

    
190
uninstall-man:
191
	rm -f $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
192

    
193
uninstall-vhook:
194
	rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
195
	-rmdir "$(SHLIBDIR)/vhook/"
196

    
197
uninstall-libs:
198
	$(MAKE) -C libavutil   uninstall-libs
199
	$(MAKE) -C libavcodec  uninstall-libs
200
	$(MAKE) -C libavformat uninstall-libs
201
	$(MAKE) -C libavdevice uninstall-libs
202
	$(MAKE) -C libpostproc uninstall-libs
203
	$(MAKE) -C libswscale  uninstall-libs
204
	$(MAKE) -C libavfilter uninstall-libs
205

    
206
uninstall-headers:
207
	$(MAKE) -C libavutil   uninstall-headers
208
	$(MAKE) -C libavcodec  uninstall-headers
209
	$(MAKE) -C libavformat uninstall-headers
210
	$(MAKE) -C libavdevice uninstall-headers
211
	$(MAKE) -C libpostproc uninstall-headers
212
	$(MAKE) -C libswscale  uninstall-headers
213
	$(MAKE) -C libavfilter uninstall-headers
214
	-rmdir "$(INCDIR)"
215

    
216
depend dep: .depend .vhookdep
217
	$(MAKE)                    -C libavutil   depend
218
	$(MAKE)                    -C libavcodec  depend
219
	$(MAKE)                    -C libavformat depend
220
	$(MAKE)                    -C libavdevice depend
221
	$(MAKE-$(CONFIG_POSTPROC)) -C libpostproc depend
222
	$(MAKE-$(CONFIG_SWSCALE))  -C libswscale  depend
223
	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter depend
224

    
225
.depend: $(SRCS) version.h
226
	$(CC) -MM $(CFLAGS) $(filter-out %.h,$^) > $@
227

    
228
# gcc stupidly only outputs the basename of targets with -MM
229
.vhookdep: $(ALLHOOKS_SRCS) version.h
230
	$(CC) -MM $(VHOOKCFLAGS) $(filter-out %.h,$^) | sed 's,^\([a-z]\),vhook/\1,' > $@
231

    
232
$(DEP_LIBS): lib
233

    
234
.libs: $(DEP_LIBS)
235
	touch $@
236

    
237
clean:
238
	$(MAKE) -C libavutil   clean
239
	$(MAKE) -C libavcodec  clean
240
	$(MAKE) -C libavformat clean
241
	$(MAKE) -C libavdevice clean
242
	$(MAKE) -C libpostproc clean
243
	$(MAKE) -C libswscale  clean
244
	$(MAKE) -C libavfilter clean
245
	rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
246
	   output_example$(EXESUF)
247
	rm -f doc/*.html doc/*.pod doc/*.1
248
	rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
249
	rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
250
	rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
251
	rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
252

    
253
distclean: clean
254
	$(MAKE) -C libavutil   distclean
255
	$(MAKE) -C libavcodec  distclean
256
	$(MAKE) -C libavformat distclean
257
	$(MAKE) -C libavdevice distclean
258
	$(MAKE) -C libpostproc distclean
259
	$(MAKE) -C libswscale  distclean
260
	$(MAKE) -C libavfilter distclean
261
	rm -f .depend .vhookdep version.h config.* *.pc
262

    
263
TAGS:
264
	etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
265

    
266
# regression tests
267

    
268
fulltest test: codectest libavtest seektest
269

    
270
FFMPEG_REFFILE   = $(SRC_PATH)/tests/ffmpeg.regression.ref
271
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
272
LIBAV_REFFILE    = $(SRC_PATH)/tests/libav.regression.ref
273
ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
274
SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
275

    
276
CODEC_TESTS = $(addprefix regtest-,             \
277
        mpeg                                    \
278
        mpeg2                                   \
279
        mpeg2thread                             \
280
        msmpeg4v2                               \
281
        msmpeg4                                 \
282
        wmv1                                    \
283
        wmv2                                    \
284
        h261                                    \
285
        h263                                    \
286
        h263p                                   \
287
        mpeg4                                   \
288
        huffyuv                                 \
289
        rc                                      \
290
        mpeg4adv                                \
291
        mpeg4thread                             \
292
        error                                   \
293
        mpeg4nr                                 \
294
        mpeg1b                                  \
295
        mjpeg                                   \
296
        ljpeg                                   \
297
        jpegls                                  \
298
        rv10                                    \
299
        rv20                                    \
300
        asv1                                    \
301
        asv2                                    \
302
        flv                                     \
303
        ffv1                                    \
304
        snow                                    \
305
        snowll                                  \
306
        dv                                      \
307
        dv50                                    \
308
        svq1                                    \
309
        flashsv                                 \
310
        mp2                                     \
311
        ac3                                     \
312
        g726                                    \
313
        adpcm_ima_wav                           \
314
        adpcm_ima_qt                            \
315
        adpcm_ms                                \
316
        adpcm_yam                               \
317
        adpcm_swf                               \
318
        flac                                    \
319
        wma                                     \
320
    )
321

    
322
LAVF_TESTS = $(addprefix regtest-,              \
323
        avi                                     \
324
        asf                                     \
325
        rm                                      \
326
        mpg                                     \
327
        ts                                      \
328
        swf                                     \
329
        ffm                                     \
330
        flv_fmt                                 \
331
        mov                                     \
332
        dv_fmt                                  \
333
        gxf                                     \
334
        nut                                     \
335
        mkv                                     \
336
        pbmpipe                                 \
337
        pgmpipe                                 \
338
        ppmpipe                                 \
339
        gif                                     \
340
        yuv4mpeg                                \
341
        pgm                                     \
342
        ppm                                     \
343
        bmp                                     \
344
        tga                                     \
345
        tiff                                    \
346
        sgi                                     \
347
        jpg                                     \
348
        wav                                     \
349
        alaw                                    \
350
        mulaw                                   \
351
        au                                      \
352
        mmf                                     \
353
        aiff                                    \
354
        voc                                     \
355
        ogg                                     \
356
        pixfmt                                  \
357
    )
358

    
359
REGFILES = $(addprefix tests/data/,$(addsuffix .$(1),$(2:regtest-%=%)))
360

    
361
CODEC_ROTOZOOM = $(call REGFILES,rotozoom.regression,$(CODEC_TESTS))
362
CODEC_VSYNTH   = $(call REGFILES,vsynth.regression,$(CODEC_TESTS))
363

    
364
LAVF_REGFILES = $(call REGFILES,lavf.regression,$(LAVF_TESTS))
365

    
366
LAVF_REG     = tests/data/lavf.regression
367
ROTOZOOM_REG = tests/data/rotozoom.regression
368
VSYNTH_REG   = tests/data/vsynth.regression
369

    
370
codectest: $(VSYNTH_REG) $(ROTOZOOM_REG)
371
	diff -u -w $(FFMPEG_REFFILE)   $(VSYNTH_REG)
372
	diff -u -w $(ROTOZOOM_REFFILE) $(ROTOZOOM_REG)
373

    
374
libavtest: $(LAVF_REG)
375
	diff -u -w $(LIBAV_REFFILE) $(LAVF_REG)
376

    
377
$(VSYNTH_REG) $(ROTOZOOM_REG) $(LAVF_REG):
378
	cat $^ > $@
379

    
380
$(LAVF_REG):     $(LAVF_REGFILES)
381
$(ROTOZOOM_REG): $(CODEC_ROTOZOOM)
382
$(VSYNTH_REG):   $(CODEC_VSYNTH)
383

    
384
$(CODEC_VSYNTH) $(CODEC_ROTOZOOM): $(CODEC_TESTS)
385

    
386
$(LAVF_REGFILES): $(LAVF_TESTS)
387

    
388
$(CODEC_TESTS) $(LAVF_TESTS): regtest-ref
389

    
390
regtest-ref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw
391

    
392
$(CODEC_TESTS) regtest-ref: tests/tiny_psnr$(EXESUF)
393
	$(SRC_PATH)/tests/regression.sh $@ vsynth   tests/vsynth1 a
394
	$(SRC_PATH)/tests/regression.sh $@ rotozoom tests/vsynth2 a
395

    
396
$(LAVF_TESTS):
397
	$(SRC_PATH)/tests/regression.sh $@ lavf tests/vsynth1 b
398

    
399
seektest: codectest libavtest tests/seek_test$(EXESUF)
400
	$(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
401

    
402
test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
403
	@echo
404
	@echo "Unfortunately ffserver is broken and therefore its regression"
405
	@echo "test fails randomly. Treat the results accordingly."
406
	@echo
407
	$(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
408

    
409
ifeq ($(CONFIG_SWSCALE),yes)
410
test-server codectest $(CODEC_TESTS) libavtest: swscale_error
411
swscale_error:
412
	@echo
413
	@echo "This regression test is incompatible with --enable-swscale."
414
	@echo
415
	@exit 1
416
endif
417

    
418
tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
419
	mkdir -p tests/vsynth1
420
	$(BUILD_ROOT)/$< 'tests/vsynth1/'
421

    
422
tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
423
	mkdir -p tests/vsynth2
424
	$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
425

    
426
tests/asynth1.sw: tests/audiogen$(EXESUF)
427
	$(BUILD_ROOT)/$< $@
428

    
429
%$(EXESUF): %.c
430
	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
431

    
432
tests/seek_test$(EXESUF): tests/seek_test.c .libs
433
	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(EXTRALIBS)
434

    
435

    
436
.PHONY: all lib videohook documentation install* uninstall*
437
.PHONY: dep depend clean distclean TAGS
438
.PHONY: codectest libavtest seektest test-server fulltest test
439
.PHONY: $(CODEC_TESTS) $(LAVF_TESTS) regtest-ref swscale-error
440

    
441
-include .depend
442
-include .vhookdep