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