Statistics
| Branch: | Revision:

ffmpeg / Makefile @ 18caf192

History | View | Annotate | Download (8.03 KB)

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
PROGS-$(CONFIG_FFMPEG)   += ffmpeg
15
PROGS-$(CONFIG_FFPLAY)   += ffplay
16
PROGS-$(CONFIG_FFSERVER) += ffserver
17

    
18
PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
19
PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
20
MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
21

    
22
BASENAMES=ffmpeg ffplay ffserver
23
ALLPROGS=$(addsuffix $(EXESUF), $(BASENAMES))
24
ALLPROGS_G=$(addsuffix _g$(EXESUF), $(BASENAMES))
25
ALLMANPAGES=$(addsuffix .1, $(BASENAMES))
26

    
27
ifeq ($(BUILD_SHARED),yes)
28
DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
29
else
30
DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
31
endif
32

    
33
ifeq ($(CONFIG_VHOOK),yes)
34
all: videohook
35
install: install-vhook
36
endif
37

    
38
ifeq ($(BUILD_DOC),yes)
39
all: documentation
40
install: install-man
41
endif
42

    
43
SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
44
LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
45
EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
46

    
47
ifeq ($(CONFIG_SWSCALER),yes)
48
LDFLAGS+=-L./libswscale
49
EXTRALIBS+=-lswscale$(BUILDSUF)
50
endif
51

    
52
all: lib $(PROGS)
53

    
54
lib:
55
	$(MAKE) -C libavutil   all
56
	$(MAKE) -C libavcodec  all
57
	$(MAKE) -C libavformat all
58
ifeq ($(CONFIG_PP),yes)
59
	$(MAKE) -C libpostproc all
60
endif
61
ifeq ($(CONFIG_SWSCALER),yes)
62
	$(MAKE) -C libswscale  all
63
endif
64

    
65
ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
66
	$(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
67

    
68
ffserver$(EXESUF): ffserver.o .libs
69
	$(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
70

    
71
ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
72
	$(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
73

    
74
%$(EXESUF): %_g$(EXESUF)
75
	cp -p $< $@
76
	$(STRIP) $@
77

    
78
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
79
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
80
version.h: $(SVN_ENTRIES)
81
endif
82

    
83
version.h:
84
	$(SRC_PATH)/version.sh $(SRC_PATH)
85

    
86
output_example$(EXESUF): output_example.o .libs
87
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(EXTRALIBS)
88

    
89
qt-faststart$(EXESUF): qt-faststart.c
90
	$(CC) $(CFLAGS) $< -o $@
91

    
92
cws2fws$(EXESUF): cws2fws.c
93
	$(CC) $(CFLAGS) $< -o $@ -lz
94

    
95
ffplay.o: ffplay.c
96
	$(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
97

    
98
ffmpeg.o ffplay.o ffserver.o: version.h
99

    
100
%.o: %.c
101
	$(CC) $(CFLAGS) -c -o $@ $<
102

    
103
videohook: .libs
104
	$(MAKE) -C vhook all
105

    
106
documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
107
                                 ffplay-doc.html hooks.html $(ALLMANPAGES))
108

    
109
doc/%.html: doc/%.texi
110
	texi2html -monolithic -number $<
111
	mv $(@F) $@
112

    
113
doc/%.pod: doc/%-doc.texi
114
	doc/texi2pod.pl $< $@
115

    
116
doc/%.1: doc/%.pod
117
	pod2man --section=1 --center=" " --release=" " $< > $@
118

    
119
install: install-progs install-libs install-headers
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 vhook       clean
218
	rm -f *.o *.d *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
219
	   output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
220
	rm -f doc/*.html doc/*.pod doc/*.1
221
	rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
222
	rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
223

    
224
distclean: clean
225
	$(MAKE) -C libavutil   distclean
226
	$(MAKE) -C libavcodec  distclean
227
	$(MAKE) -C libavformat distclean
228
	$(MAKE) -C libpostproc distclean
229
	$(MAKE) -C libswscale  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
fulltest test: codectest libavtest seektest
239

    
240
FFMPEG_REFFILE   = $(SRC_PATH)/tests/ffmpeg.regression.ref
241
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
242
LIBAV_REFFILE    = $(SRC_PATH)/tests/libav.regression.ref
243
ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
244
SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
245

    
246
test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
247
	@echo
248
	@echo "Unfortunately ffserver is broken and therefore its regression"
249
	@echo "test fails randomly. Treat the results accordingly."
250
	@echo
251
	$(SRC_PATH)/tests/server-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/test.conf
252

    
253
codectest mpeg4 mpeg ac3 snow snowll: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm tests/asynth1.sw tests/tiny_psnr$(EXESUF)
254
	$(SRC_PATH)/tests/regression.sh $@ $(FFMPEG_REFFILE)   tests/vsynth1
255
	$(SRC_PATH)/tests/regression.sh $@ $(ROTOZOOM_REFFILE) tests/vsynth2
256

    
257
ifeq ($(CONFIG_GPL),yes)
258
libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
259
	$(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1
260
seektest: tests/seek_test$(EXESUF)
261
	$(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
262
else
263
libavtest seektest:
264
	@echo
265
	@echo "This test requires FFmpeg to be compiled with --enable-gpl."
266
	@echo
267
	@exit 1
268
endif
269

    
270
ifeq ($(CONFIG_SWSCALER),yes)
271
test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error
272
swscale_error:
273
	@echo
274
	@echo "This regression test is incompatible with --enable-swscaler."
275
	@echo
276
	@exit 1
277
endif
278

    
279
tests/vsynth1/00.pgm: tests/videogen$(EXESUF)
280
	mkdir -p tests/vsynth1
281
	$(BUILD_ROOT)/$< 'tests/vsynth1/'
282

    
283
tests/vsynth2/00.pgm: tests/rotozoom$(EXESUF)
284
	mkdir -p tests/vsynth2
285
	$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
286

    
287
tests/asynth1.sw: tests/audiogen$(EXESUF)
288
	$(BUILD_ROOT)/$< $@
289

    
290
%$(EXESUF): %.c
291
	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
292

    
293
tests/seek_test$(EXESUF): tests/seek_test.c
294
	$(CC) $(LDFLAGS) $(CFLAGS) -DHAVE_AV_CONFIG_H -o $@ $< $(EXTRALIBS)
295

    
296

    
297
.PHONY: all lib videohook documentation install* wininstaller uninstall*
298
.PHONY: dep depend clean distclean TAGS
299
.PHONY: codectest libavtest seektest test-server fulltest test
300
.PHONY: mpeg4 mpeg ac3 snow snowll swscale-error
301

    
302
-include .depend