Makefile 8.03 KB
Newer Older
1
#
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
2
# Main ffmpeg Makefile
3
# (c) 2000-2004 Fabrice Bellard
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
4
#
5
include config.mak
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
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

Måns Rullgård's avatar
Måns Rullgård committed
14
15
16
PROGS-$(CONFIG_FFMPEG)   += ffmpeg
PROGS-$(CONFIG_FFPLAY)   += ffplay
PROGS-$(CONFIG_FFSERVER) += ffserver
Fabrice Bellard's avatar
Fabrice Bellard committed
17

Måns Rullgård's avatar
Måns Rullgård committed
18
19
20
PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
21

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

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

33
ifeq ($(CONFIG_VHOOK),yes)
Måns Rullgård's avatar
Måns Rullgård committed
34
35
all: videohook
install: install-vhook
36
endif
37

38
ifeq ($(BUILD_DOC),yes)
Måns Rullgård's avatar
Måns Rullgård committed
39
40
all: documentation
install: install-man
41
42
endif

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)
Zdenek Kabelac's avatar
Zdenek Kabelac committed
46

Luca Abeni's avatar
Luca Abeni committed
47
ifeq ($(CONFIG_SWSCALER),yes)
Diego Biurrun's avatar
Diego Biurrun committed
48
LDFLAGS+=-L./libswscale
Diego Biurrun's avatar
Diego Biurrun committed
49
EXTRALIBS+=-lswscale$(BUILDSUF)
Luca Abeni's avatar
Luca Abeni committed
50
51
endif

Måns Rullgård's avatar
Måns Rullgård committed
52
all: lib $(PROGS)
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
53

Fabrice Bellard's avatar
Fabrice Bellard committed
54
lib:
55
56
	$(MAKE) -C libavutil   all
	$(MAKE) -C libavcodec  all
Fabrice Bellard's avatar
Fabrice Bellard committed
57
	$(MAKE) -C libavformat all
58
ifeq ($(CONFIG_PP),yes)
59
	$(MAKE) -C libpostproc all
60
endif
Luca Abeni's avatar
Luca Abeni committed
61
62
63
ifeq ($(CONFIG_SWSCALER),yes)
	$(MAKE) -C libswscale  all
endif
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
64

Fabrice Bellard's avatar
Fabrice Bellard committed
65
ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
Diego Biurrun's avatar
Diego Biurrun committed
66
	$(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
67

Fabrice Bellard's avatar
Fabrice Bellard committed
68
ffserver$(EXESUF): ffserver.o .libs
Diego Biurrun's avatar
Diego Biurrun committed
69
	$(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
70

Fabrice Bellard's avatar
Fabrice Bellard committed
71
ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
Diego Biurrun's avatar
Diego Biurrun committed
72
	$(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
Fabrice Bellard's avatar
Fabrice Bellard committed
73

74
%$(EXESUF): %_g$(EXESUF)
Fabrice Bellard's avatar
Fabrice Bellard committed
75
76
77
	cp -p $< $@
	$(STRIP) $@

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

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

Fabrice Bellard's avatar
Fabrice Bellard committed
86
output_example$(EXESUF): output_example.o .libs
Diego Biurrun's avatar
Diego Biurrun committed
87
	$(CC) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
88

89
qt-faststart$(EXESUF): qt-faststart.c
Måns Rullgård's avatar
Måns Rullgård committed
90
	$(CC) $(CFLAGS) $< -o $@
91

92
cws2fws$(EXESUF): cws2fws.c
Måns Rullgård's avatar
Måns Rullgård committed
93
	$(CC) $< -o $@ -lz
94

Fabrice Bellard's avatar
Fabrice Bellard committed
95
ffplay.o: ffplay.c
96
	$(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
Fabrice Bellard's avatar
Fabrice Bellard committed
97

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

Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
100
%.o: %.c
101
	$(CC) $(CFLAGS) -c -o $@ $<
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
102

François Revol's avatar
François Revol committed
103
videohook: .libs
104
105
	$(MAKE) -C vhook all

106
107
108
109
110
111
112
113
114
115
116
117
documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
                                 ffplay-doc.html hooks.html $(ALLMANPAGES))

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

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

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

Måns Rullgård's avatar
Måns Rullgård committed
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
Fabrice Bellard's avatar
Fabrice Bellard committed
126
	install -d "$(bindir)"
127
	install -c -m 755 $(PROGS) "$(bindir)"
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
128

Diego Biurrun's avatar
Diego Biurrun committed
129
# Create the Windows installer.
Fabrice Bellard's avatar
Fabrice Bellard committed
130
131
132
wininstaller: all install
	makensis ffinstall.nsi

133
install-man:
134
135
	install -d "$(mandir)/man1"
	install -m 644 $(MANPAGES) "$(mandir)/man1"
136

137
138
install-vhook:
	$(MAKE) -C vhook install
139

140
install-libs:
141
142
143
	$(MAKE) -C libavutil   install-libs
	$(MAKE) -C libavcodec  install-libs
	$(MAKE) -C libavformat install-libs
144
ifeq ($(CONFIG_PP),yes)
145
	$(MAKE) -C libpostproc install-libs
146
endif
Luca Abeni's avatar
Luca Abeni committed
147
148
149
150
ifeq ($(CONFIG_SWSCALER),yes)
	$(MAKE) -C libswscale  install-libs
endif

151
ifeq ($(BUILD_SHARED),yes)
152
	-$(LDCONFIG)
153
endif
154

155
156
157
158
install-headers:
	$(MAKE) -C libavutil   install-headers
	$(MAKE) -C libavcodec  install-headers
	$(MAKE) -C libavformat install-headers
159
ifeq ($(CONFIG_PP),yes)
160
	$(MAKE) -C libpostproc install-headers
161
endif
Luca Abeni's avatar
Luca Abeni committed
162
	$(MAKE) -C libswscale  install-headers
163

Diego Biurrun's avatar
Diego Biurrun committed
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook

uninstall-progs:
	rm -f $(addprefix $(bindir)/, $(ALLPROGS))

uninstall-man:
	rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))

uninstall-vhook:
	$(MAKE) -C vhook uninstall

uninstall-libs:
	$(MAKE) -C libavutil   uninstall-libs
	$(MAKE) -C libavcodec  uninstall-libs
	$(MAKE) -C libavformat uninstall-libs
179
	$(MAKE) -C libpostproc uninstall-libs
Diego Biurrun's avatar
Diego Biurrun committed
180
181
182
183
184

uninstall-headers:
	$(MAKE) -C libavutil   uninstall-headers
	$(MAKE) -C libavcodec  uninstall-headers
	$(MAKE) -C libavformat uninstall-headers
185
	$(MAKE) -C libpostproc uninstall-headers
Diego Biurrun's avatar
Diego Biurrun committed
186
187
188
	-rmdir "$(incdir)"
	-rmdir "$(prefix)/include/postproc"

Diego Biurrun's avatar
Diego Biurrun committed
189
depend dep: .depend
190
	$(MAKE) -C libavutil   depend
191
	$(MAKE) -C libavcodec  depend
192
	$(MAKE) -C libavformat depend
193
194
195
ifeq ($(CONFIG_PP),yes)
	$(MAKE) -C libpostproc depend
endif
196
197
198
ifeq ($(CONFIG_SWSCALER),yes)
	$(MAKE) -C libswscale  depend
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
Zdenek Kabelac's avatar
Zdenek Kabelac committed
205

206
207
208
209
$(DEP_LIBS): lib

.libs: $(DEP_LIBS)
	touch $@
210

211
clean:
212
213
	$(MAKE) -C libavutil   clean
	$(MAKE) -C libavcodec  clean
Fabrice Bellard's avatar
Fabrice Bellard committed
214
	$(MAKE) -C libavformat clean
215
	$(MAKE) -C libpostproc clean
Luca Abeni's avatar
Luca Abeni committed
216
	$(MAKE) -C libswscale  clean
217
	$(MAKE) -C vhook       clean
Diego Biurrun's avatar
Diego Biurrun committed
218
219
	rm -f *.o *.d *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
	   output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
220
	rm -f doc/*.html doc/*.pod doc/*.1
221
222
	rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
	rm -f $(addprefix tests/,$(addsuffix $(EXESUF),audiogen videogen rotozoom seek_test tiny_psnr))
223

Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
224
distclean: clean
225
226
227
	$(MAKE) -C libavutil   distclean
	$(MAKE) -C libavcodec  distclean
	$(MAKE) -C libavformat distclean
228
	$(MAKE) -C libpostproc distclean
Luca Abeni's avatar
Luca Abeni committed
229
	$(MAKE) -C libswscale  distclean
230
	$(MAKE) -C vhook       distclean
Diego Biurrun's avatar
Diego Biurrun committed
231
	rm -f .depend version.h config.* *.pc
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
232
233

TAGS:
Fabrice Bellard's avatar
Fabrice Bellard committed
234
	etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
Zdenek Kabelac's avatar
Zdenek Kabelac committed
235

236
237
# regression tests

238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
fulltest test: codectest libavtest seektest
#codectest libavtest seektest test-server: $(PROGS)

FFMPEG_REFFILE   = $(SRC_PATH)/tests/ffmpeg.regression.ref
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
LIBAV_REFFILE    = $(SRC_PATH)/tests/libav.regression.ref
ROTOZOOM_REFFILE = $(SRC_PATH)/tests/rotozoom.regression.ref
SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref

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

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

ifeq ($(CONFIG_GPL),yes)
libavtest: tests/vsynth1/00.pgm tests/asynth1.sw
	$(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) tests/vsynth1
seektest: tests/seek_test$(EXESUF)
	$(SRC_PATH)/tests/seek_test.sh $(SEEK_REFFILE)
else
libavtest seektest:
	@echo
	@echo "This test requires FFmpeg to be compiled with --enable-gpl."
	@echo
	@exit 1
endif

ifeq ($(CONFIG_SWSCALER),yes)
test-server codectest mpeg4 mpeg ac3 snow snowll libavtest: swscale_error
swscale_error:
	@echo
	@echo "This regression test is incompatible with --enable-swscaler."
	@echo
	@exit 1
endif

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

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

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

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

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

297

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

303
-include .depend