Replace deprecated PIX_FMT names by the newer variants.
[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        -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE
12 LDFLAGS+= -g
13
14 ifeq ($(CONFIG_FFMPEG),yes)
15 MANPAGES=doc/ffmpeg.1
16 PROGS_G+=ffmpeg_g$(EXESUF)
17 PROGS+=ffmpeg$(EXESUF)
18 endif
19
20 ifeq ($(CONFIG_FFSERVER),yes)
21 MANPAGES+=doc/ffserver.1
22 PROGS+=ffserver$(EXESUF)
23 endif
24
25 ifeq ($(CONFIG_FFPLAY),yes)
26 MANPAGES+=doc/ffplay.1
27 PROGS_G+=ffplay_g$(EXESUF)
28 PROGS+=ffplay$(EXESUF)
29 endif
30
31 BASENAMES=ffmpeg ffplay ffserver
32 ALLPROGS=$(addsuffix $(EXESUF), $(BASENAMES))
33 ALLPROGS_G=$(addsuffix _g$(EXESUF), $(BASENAMES))
34 ALLMANPAGES=$(addsuffix .1, $(BASENAMES))
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 endif
41
42 ifeq ($(CONFIG_VHOOK),yes)
43 VHOOK=videohook
44 INSTALLVHOOK=install-vhook
45 endif
46
47 ifeq ($(BUILD_DOC),yes)
48 DOC=documentation
49 INSTALLMAN=install-man
50 endif
51
52 OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
53 SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
54 LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
55 EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
56
57 ifeq ($(CONFIG_SWSCALER),yes)
58 LDFLAGS+=-L./libswscale
59 EXTRALIBS+=-lswscale$(BUILDSUF)
60 endif
61
62 all: lib $(PROGS) $(VHOOK) $(DOC)
63
64 lib:
65         $(MAKE) -C libavutil   all
66         $(MAKE) -C libavcodec  all
67         $(MAKE) -C libavformat all
68 ifeq ($(CONFIG_PP),yes)
69         $(MAKE) -C libpostproc all
70 endif
71 ifeq ($(CONFIG_SWSCALER),yes)
72         $(MAKE) -C libswscale  all
73 endif
74
75 ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
76         $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
77
78 ffserver$(EXESUF): ffserver.o .libs
79         $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
80
81 ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
82         $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
83
84 %$(EXESUF): %_g$(EXESUF)
85         cp -p $< $@
86         $(STRIP) $@
87
88 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
89 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
90 version.h: $(SVN_ENTRIES)
91 endif
92
93 version.h:
94         $(SRC_PATH)/version.sh $(SRC_PATH)
95
96 output_example$(EXESUF): output_example.o .libs
97         $(CC) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
98
99 qt-faststart$(EXESUF): qt-faststart.c
100         $(CC) $(CFLAGS) $< -o $@
101
102 cws2fws$(EXESUF): cws2fws.c
103         $(CC) $< -o $@ -lz
104
105 ffplay.o: ffplay.c
106         $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
107
108 ffmpeg.o ffplay.o ffserver.o: version.h
109
110 %.o: %.c
111         $(CC) $(CFLAGS) -c -o $@ $<
112
113 videohook: .libs
114         $(MAKE) -C vhook all
115
116 documentation:
117         $(MAKE) -C doc all
118
119 install: install-progs install-libs install-headers $(INSTALLMAN) $(INSTALLVHOOK)
120
121 ifeq ($(BUILD_SHARED),yes)
122 install-progs: $(PROGS) install-libs
123 else
124 install-progs: $(PROGS)
125 endif
126         install -d "$(bindir)"
127         install -c -m 755 $(PROGS) "$(bindir)"
128
129 # Create the Windows installer.
130 wininstaller: all install
131         makensis ffinstall.nsi
132
133 install-man:
134         install -d "$(mandir)/man1"
135         install -m 644 $(MANPAGES) "$(mandir)/man1"
136
137 install-vhook:
138         $(MAKE) -C vhook install
139
140 install-libs:
141         $(MAKE) -C libavutil   install-libs
142         $(MAKE) -C libavcodec  install-libs
143         $(MAKE) -C libavformat install-libs
144 ifeq ($(CONFIG_PP),yes)
145         $(MAKE) -C libpostproc install-libs
146 endif
147 ifeq ($(CONFIG_SWSCALER),yes)
148         $(MAKE) -C libswscale  install-libs
149 endif
150
151 ifeq ($(BUILD_SHARED),yes)
152         -$(LDCONFIG)
153 endif
154
155 install-headers:
156         $(MAKE) -C libavutil   install-headers
157         $(MAKE) -C libavcodec  install-headers
158         $(MAKE) -C libavformat install-headers
159 ifeq ($(CONFIG_PP),yes)
160         $(MAKE) -C libpostproc install-headers
161 endif
162         $(MAKE) -C libswscale  install-headers
163
164 uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
165
166 uninstall-progs:
167         rm -f $(addprefix $(bindir)/, $(ALLPROGS))
168
169 uninstall-man:
170         rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))
171
172 uninstall-vhook:
173         $(MAKE) -C vhook uninstall
174
175 uninstall-libs:
176         $(MAKE) -C libavutil   uninstall-libs
177         $(MAKE) -C libavcodec  uninstall-libs
178         $(MAKE) -C libavformat uninstall-libs
179         $(MAKE) -C libpostproc uninstall-libs
180
181 uninstall-headers:
182         $(MAKE) -C libavutil   uninstall-headers
183         $(MAKE) -C libavcodec  uninstall-headers
184         $(MAKE) -C libavformat uninstall-headers
185         $(MAKE) -C libpostproc uninstall-headers
186         -rmdir "$(incdir)"
187         -rmdir "$(prefix)/include/postproc"
188
189 depend dep: .depend
190         $(MAKE) -C libavutil   depend
191         $(MAKE) -C libavcodec  depend
192         $(MAKE) -C libavformat depend
193 ifeq ($(CONFIG_PP),yes)
194         $(MAKE) -C libpostproc depend
195 endif
196 ifeq ($(CONFIG_SWSCALER),yes)
197         $(MAKE) -C libswscale  depend
198 endif
199 ifeq ($(CONFIG_VHOOK),yes)
200         $(MAKE) -C vhook       depend
201 endif
202
203 .depend: $(SRCS) version.h
204         $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
205
206 $(DEP_LIBS): lib
207
208 .libs: $(DEP_LIBS)
209         touch $@
210
211 clean:
212         $(MAKE) -C libavutil   clean
213         $(MAKE) -C libavcodec  clean
214         $(MAKE) -C libavformat clean
215         $(MAKE) -C libpostproc clean
216         $(MAKE) -C libswscale  clean
217         $(MAKE) -C tests       clean
218         $(MAKE) -C vhook       clean
219         $(MAKE) -C doc         clean
220         rm -f *.o *.d *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
221            output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
222
223 distclean: clean
224         $(MAKE) -C libavutil   distclean
225         $(MAKE) -C libavcodec  distclean
226         $(MAKE) -C libavformat distclean
227         $(MAKE) -C libpostproc distclean
228         $(MAKE) -C libswscale  distclean
229         $(MAKE) -C tests       distclean
230         $(MAKE) -C vhook       distclean
231         rm -f .depend version.h config.* *.pc
232
233 TAGS:
234         etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
235
236 # regression tests
237
238 codectest libavtest test-server fulltest test mpeg4 mpeg: $(PROGS)
239         $(MAKE) -C tests $@
240
241 .PHONY: all lib videohook documentation install* wininstaller uninstall*
242 .PHONY: dep depend clean distclean TAGS
243 .PHONY: codectest libavtest test-server fulltest test mpeg4 mpeg
244
245 ifneq ($(wildcard .depend),)
246 include .depend
247 endif