10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and...
[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+=-logg -lvorbis -lvorbisenc
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 ($(BUILD_VHOOK),yes)
67 VHOOK=videohook
68 INSTALLVHOOK=install-vhook
69 CLEANVHOOK=clean-vhook
70 endif
71
72 ifeq ($(TARGET_OS), SunOS)
73 TEST=/usr/bin/test
74 else
75 TEST=test
76 endif
77
78 ifeq ($(BUILD_DOC),yes)
79 DOC=documentation
80 endif
81
82 OBJS = ffmpeg.o ffserver.o cmdutils.o $(FFPLAY_O)
83 SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
84 FFLIBS = -L./libavformat -lavformat -L./libavcodec -lavcodec
85
86 all: lib $(PROG) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
87
88 lib:
89 $(MAKE) -C libavcodec all
90 $(MAKE) -C libavformat all
91
92 ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
93 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
94
95 ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
96 cp -p $< $@
97 $(STRIP) $@
98
99 ffserver$(EXESUF): ffserver.o .libs
100 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
101
102 ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
103 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
104
105 ffplay$(EXESUF): ffplay_g$(EXESUF)
106 cp -p $< $@
107 $(STRIP) $@
108
109 output_example$(EXESUF): output_example.o .libs
110 $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
111
112 qt-faststart$(EXESUF): qt-faststart.c
113 $(CC) $(SRC_PATH)/qt-faststart.c -o qt-faststart$(EXESUF)
114
115 ffplay.o: ffplay.c
116 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
117
118 %.o: %.c
119 $(CC) $(CFLAGS) -c -o $@ $<
120
121 videohook: .libs
122 $(MAKE) -C vhook all
123
124 documentation:
125 $(MAKE) -C doc all
126
127 .PHONY: install
128
129 install: all install-man $(INSTALLVHOOK)
130 $(MAKE) -C libavcodec install
131 $(MAKE) -C libavformat install
132 install -d "$(bindir)"
133 install -c -s -m 755 $(PROG) "$(bindir)"
134
135 # create the window installer
136 wininstaller: all install
137 makensis ffinstall.nsi
138
139 # install man from source dir if available
140 install-man:
141 ifneq ($(CONFIG_WIN32),yes)
142 if [ -f $(SRC_PATH)/doc/ffmpeg.1 ] ; then \
143 install -d "$(mandir)/man1" ; \
144 install -m 644 $(MANPAGE) "$(mandir)/man1" ; \
145 fi
146 endif
147
148 install-vhook:
149 $(MAKE) -C vhook install
150
151 installlib:
152 $(MAKE) -C libavcodec installlib
153 $(MAKE) -C libavformat installlib
154
155 dep: depend
156
157 depend: .depend
158 make -C libavcodec depend
159 make -C libavformat depend
160 ifeq ($(BUILD_VHOOK),yes)
161 make -C vhook depend
162 endif
163
164 .depend: $(SRCS)
165 $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
166
167 .libs: lib
168 @test -f .libs || touch .libs
169 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
170
171 clean: $(CLEANVHOOK)
172 $(MAKE) -C libavcodec clean
173 $(MAKE) -C libavformat clean
174 $(MAKE) -C tests clean
175 rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXESUF) ffplay_g$(EXESUF) $(PROG) $(PROGTEST)
176
177 clean-vhook:
178 $(MAKE) -C vhook clean
179
180 distclean: clean
181 $(MAKE) -C libavcodec distclean
182 rm -f config.mak config.h
183
184 TAGS:
185 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
186
187 # regression tests
188
189 libavtest test mpeg4 mpeg test-server fulltest: ffmpeg$(EXESUF)
190 $(MAKE) -C tests $@
191
192 # tar release (use 'make -k tar' on a checkouted tree)
193 FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
194 cut -d "\"" -f 2 )
195
196 tar:
197 rm -rf /tmp/$(FILE)
198 cp -r . /tmp/$(FILE)
199 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
200 rm -rf /tmp/$(FILE)
201
202 .PHONY: lib
203
204 ifneq ($(wildcard .depend),)
205 include .depend
206 endif