* Introducing IIDC1394 grabbing interface.
[libav.git] / Makefile
1 #
2 # Main ffmpeg Makefile
3 # (c) 2000-2004 Fabrice Bellard
4 #
5 include config.mak
6
7 VPATH=$(SRC_PATH)
8
9 CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
10 LDFLAGS+= -g
11
12 ifeq ($(TARGET_GPROF),yes)
13 CFLAGS+=-p
14 LDFLAGS+=-p
15 endif
16
17 MANPAGE=$(SRC_PATH)/doc/ffmpeg.1
18 PROG=ffmpeg$(EXESUF)
19 PROGTEST=output_example$(EXESUF)
20 QTFASTSTART=qt-faststart$(EXESUF)
21
22 ifeq ($(CONFIG_FFSERVER),yes)
23 MANPAGE+=$(SRC_PATH)/doc/ffserver.1
24 PROG+=ffserver$(EXESUF)
25 endif
26
27 ifeq ($(CONFIG_FFPLAY),yes)
28 MANPAGE+=$(SRC_PATH)/doc/ffplay.1
29 PROG+=ffplay$(EXESUF)
30 FFPLAY_O=ffplay.o
31 endif
32
33 ifeq ($(CONFIG_AUDIO_BEOS),yes)
34 EXTRALIBS+=-lmedia -lbe
35 endif
36
37 ifeq ($(BUILD_SHARED),yes)
38 DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
39 else
40 DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
41 ifeq ($(CONFIG_MP3LAME),yes)
42 EXTRALIBS+=-lmp3lame
43 endif
44 endif
45
46 ifeq ($(CONFIG_VORBIS),yes)
47 EXTRALIBS+=-lvorbis -lvorbisenc -logg
48 endif
49
50 ifeq ($(CONFIG_FAAD),yes)
51 ifeq ($(CONFIG_FAADBIN),yes)
52 # no libs needed
53 else
54 EXTRALIBS += -lfaad
55 endif
56 endif
57
58 ifeq ($(CONFIG_FAAC),yes)
59 EXTRALIBS+=-lfaac
60 endif
61
62 ifeq ($(CONFIG_XVID),yes)
63 EXTRALIBS+=-lxvidcore
64 endif
65
66 ifeq ($(CONFIG_DC1394),yes)
67 EXTRALIBS+=-ldc1394_control -lraw1394
68 endif
69
70 ifeq ($(BUILD_VHOOK),yes)
71 VHOOK=videohook
72 INSTALLVHOOK=install-vhook
73 CLEANVHOOK=clean-vhook
74 endif
75
76 ifeq ($(TARGET_OS), SunOS)
77 TEST=/usr/bin/test
78 else
79 TEST=test
80 endif
81
82 ifeq ($(BUILD_DOC),yes)
83 DOC=documentation
84 endif
85
86 OBJS = ffmpeg.o ffserver.o cmdutils.o $(FFPLAY_O)
87 SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
88 FFLIBS = -L./libavformat -lavformat -L./libavcodec -lavcodec
89
90 all: lib $(PROG) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
91
92 lib:
93 $(MAKE) -C libavcodec all
94 $(MAKE) -C libavformat all
95
96 ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
97 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
98
99 ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
100 cp -p $< $@
101 $(STRIP) $@
102
103 ffserver$(EXESUF): ffserver.o .libs
104 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
105
106 ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
107 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
108
109 ffplay$(EXESUF): ffplay_g$(EXESUF)
110 cp -p $< $@
111 $(STRIP) $@
112
113 output_example$(EXESUF): output_example.o .libs
114 $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
115
116 qt-faststart$(EXESUF): qt-faststart.c
117 $(CC) $(SRC_PATH)/qt-faststart.c -o qt-faststart$(EXESUF)
118
119 cws2fws$(EXESUF): cws2fws.c
120 $(CC) $(SRC_PATH)/cws2fws.c -o cws2fws$(EXESUF) -lz
121
122 ffplay.o: ffplay.c
123 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
124
125 %.o: %.c
126 $(CC) $(CFLAGS) -c -o $@ $<
127
128 videohook: .libs
129 $(MAKE) -C vhook all
130
131 documentation:
132 $(MAKE) -C doc all
133
134 .PHONY: install
135
136 install: all install-man $(INSTALLVHOOK)
137 $(MAKE) -C libavcodec install
138 $(MAKE) -C libavformat install
139 install -d "$(bindir)"
140 install -c $(INSTALLSTRIP) -m 755 $(PROG) "$(bindir)"
141
142 # create the window installer
143 wininstaller: all install
144 makensis ffinstall.nsi
145
146 # install man from source dir if available
147 install-man:
148 ifneq ($(CONFIG_WIN32),yes)
149 if [ -f $(SRC_PATH)/doc/ffmpeg.1 ] ; then \
150 install -d "$(mandir)/man1" ; \
151 install -m 644 $(MANPAGE) "$(mandir)/man1" ; \
152 fi
153 endif
154
155 install-vhook:
156 $(MAKE) -C vhook install
157
158 installlib:
159 $(MAKE) -C libavcodec installlib
160 $(MAKE) -C libavformat installlib
161
162 dep: depend
163
164 depend: .depend
165 make -C libavcodec depend
166 make -C libavformat depend
167 ifeq ($(BUILD_VHOOK),yes)
168 make -C vhook depend
169 endif
170
171 .depend: $(SRCS)
172 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
173
174 .libs: lib
175 @test -f .libs || touch .libs
176 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
177
178 clean: $(CLEANVHOOK)
179 $(MAKE) -C libavcodec clean
180 $(MAKE) -C libavformat clean
181 $(MAKE) -C tests clean
182 rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXESUF) \
183 ffplay_g$(EXESUF) $(PROG) $(PROGTEST) $(QTFASTSTART)
184
185 clean-vhook:
186 $(MAKE) -C vhook clean
187
188 # Note well: config.log is NOT removed.
189 distclean: clean
190 $(MAKE) -C libavcodec distclean
191 rm -f config.mak config.h
192
193 TAGS:
194 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
195
196 # regression tests
197
198 libavtest test mpeg4 mpeg test-server fulltest: ffmpeg$(EXESUF)
199 $(MAKE) -C tests $@
200
201 # tar release (use 'make -k tar' on a checkouted tree)
202 FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
203 cut -d "\"" -f 2 )
204
205 tar:
206 rm -rf /tmp/$(FILE)
207 cp -r . /tmp/$(FILE)
208 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
209 rm -rf /tmp/$(FILE)
210
211 .PHONY: lib
212
213 ifneq ($(wildcard .depend),)
214 include .depend
215 endif