Makefile 8.02 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 -DHAVE_AV_CONFIG_H
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

Diego Biurrun's avatar
Diego Biurrun 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

Diego Biurrun's avatar
Diego Biurrun committed
22 23 24 25
BASENAMES   = ffmpeg ffplay ffserver
ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
26

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)
48
LDFLAGS+=-L$(BUILD_ROOT)/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
87
	$(CC) $(CFLAGS) $(LDFLAGS) -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
93
	$(CC) $(CFLAGS) $< -o $@ -lz
94

95
ffplay.o: CFLAGS += $(SDL_CFLAGS)
Fabrice Bellard's avatar
Fabrice Bellard committed
96

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

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

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

105 106 107 108 109 110 111 112 113 114 115 116
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=" " $< > $@
117

Måns Rullgård's avatar
Måns Rullgård committed
118
install: install-progs install-libs install-headers
119

120
ifeq ($(BUILD_SHARED),yes)
121
install-progs: $(PROGS) install-libs
122
else
123
install-progs: $(PROGS)
124
endif
Fabrice Bellard's avatar
Fabrice Bellard committed
125
	install -d "$(bindir)"
126
	install -c -m 755 $(PROGS) "$(bindir)"
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
127

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

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

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

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

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

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

Diego Biurrun's avatar
Diego Biurrun committed
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
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
178
	$(MAKE) -C libpostproc uninstall-libs
Diego Biurrun's avatar
Diego Biurrun committed
179 180 181 182 183

uninstall-headers:
	$(MAKE) -C libavutil   uninstall-headers
	$(MAKE) -C libavcodec  uninstall-headers
	$(MAKE) -C libavformat uninstall-headers
184
	$(MAKE) -C libpostproc uninstall-headers
Diego Biurrun's avatar
Diego Biurrun committed
185 186
	-rmdir "$(incdir)"

Diego Biurrun's avatar
Diego Biurrun committed
187
depend dep: .depend
188
	$(MAKE) -C libavutil   depend
189
	$(MAKE) -C libavcodec  depend
190
	$(MAKE) -C libavformat depend
191 192 193
ifeq ($(CONFIG_PP),yes)
	$(MAKE) -C libpostproc depend
endif
194 195 196
ifeq ($(CONFIG_SWSCALER),yes)
	$(MAKE) -C libswscale  depend
endif
197
ifeq ($(CONFIG_VHOOK),yes)
198
	$(MAKE) -C vhook       depend
199
endif
200

201
.depend: $(SRCS) version.h
202
	$(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(filter-out %.h,$^) 1>.depend
Zdenek Kabelac's avatar
Zdenek Kabelac committed
203

204 205 206 207
$(DEP_LIBS): lib

.libs: $(DEP_LIBS)
	touch $@
208

209
clean:
210 211
	$(MAKE) -C libavutil   clean
	$(MAKE) -C libavcodec  clean
Fabrice Bellard's avatar
Fabrice Bellard committed
212
	$(MAKE) -C libavformat clean
213
	$(MAKE) -C libpostproc clean
Luca Abeni's avatar
Luca Abeni committed
214
	$(MAKE) -C libswscale  clean
215
	$(MAKE) -C vhook       clean
216
	rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
Diego Biurrun's avatar
Diego Biurrun committed
217
	   output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
218
	rm -f doc/*.html doc/*.pod doc/*.1
219 220
	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))
221

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

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

234 235
# regression tests

236 237 238 239 240 241 242 243
fulltest test: codectest libavtest seektest

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

244
test-server: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
245 246 247 248 249 250
	@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

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

ifeq ($(CONFIG_GPL),yes)
256
libavtest: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/asynth1.sw
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
	$(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)

294

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

300
-include .depend