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