Makefile 5.71 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

Måns Rullgård's avatar
Måns Rullgård committed
43
SRCS = ffmpeg.c ffserver.c cmdutils.c ffplay.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
documentation:
	$(MAKE) -C doc all

Måns Rullgård's avatar
Måns Rullgård committed
109
install: install-progs install-libs install-headers
110

111
ifeq ($(BUILD_SHARED),yes)
112
install-progs: $(PROGS) install-libs
113
else
114
install-progs: $(PROGS)
115
endif
Fabrice Bellard's avatar
Fabrice Bellard committed
116
	install -d "$(bindir)"
117
	install -c -m 755 $(PROGS) "$(bindir)"
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
118

Diego Biurrun's avatar
Diego Biurrun committed
119
# Create the Windows installer.
Fabrice Bellard's avatar
Fabrice Bellard committed
120 121 122
wininstaller: all install
	makensis ffinstall.nsi

123
install-man:
124 125
	install -d "$(mandir)/man1"
	install -m 644 $(MANPAGES) "$(mandir)/man1"
126

127 128
install-vhook:
	$(MAKE) -C vhook install
129

130
install-libs:
131 132 133
	$(MAKE) -C libavutil   install-libs
	$(MAKE) -C libavcodec  install-libs
	$(MAKE) -C libavformat install-libs
134
ifeq ($(CONFIG_PP),yes)
135
	$(MAKE) -C libpostproc install-libs
136
endif
Luca Abeni's avatar
Luca Abeni committed
137 138 139 140
ifeq ($(CONFIG_SWSCALER),yes)
	$(MAKE) -C libswscale  install-libs
endif

141
ifeq ($(BUILD_SHARED),yes)
142
	-$(LDCONFIG)
143
endif
144

145 146 147 148
install-headers:
	$(MAKE) -C libavutil   install-headers
	$(MAKE) -C libavcodec  install-headers
	$(MAKE) -C libavformat install-headers
149
ifeq ($(CONFIG_PP),yes)
150
	$(MAKE) -C libpostproc install-headers
151
endif
Luca Abeni's avatar
Luca Abeni committed
152
	$(MAKE) -C libswscale  install-headers
153

Diego Biurrun's avatar
Diego Biurrun committed
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
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
169
	$(MAKE) -C libpostproc uninstall-libs
Diego Biurrun's avatar
Diego Biurrun committed
170 171 172 173 174

uninstall-headers:
	$(MAKE) -C libavutil   uninstall-headers
	$(MAKE) -C libavcodec  uninstall-headers
	$(MAKE) -C libavformat uninstall-headers
175
	$(MAKE) -C libpostproc uninstall-headers
Diego Biurrun's avatar
Diego Biurrun committed
176 177 178
	-rmdir "$(incdir)"
	-rmdir "$(prefix)/include/postproc"

Diego Biurrun's avatar
Diego Biurrun committed
179
depend dep: .depend
180
	$(MAKE) -C libavutil   depend
181
	$(MAKE) -C libavcodec  depend
182
	$(MAKE) -C libavformat depend
183 184 185
ifeq ($(CONFIG_PP),yes)
	$(MAKE) -C libpostproc depend
endif
186 187 188
ifeq ($(CONFIG_SWSCALER),yes)
	$(MAKE) -C libswscale  depend
endif
189
ifeq ($(CONFIG_VHOOK),yes)
190
	$(MAKE) -C vhook       depend
191
endif
192

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

196 197 198 199
$(DEP_LIBS): lib

.libs: $(DEP_LIBS)
	touch $@
200

201
clean:
202 203
	$(MAKE) -C libavutil   clean
	$(MAKE) -C libavcodec  clean
Fabrice Bellard's avatar
Fabrice Bellard committed
204
	$(MAKE) -C libavformat clean
205
	$(MAKE) -C libpostproc clean
Luca Abeni's avatar
Luca Abeni committed
206
	$(MAKE) -C libswscale  clean
207 208
	$(MAKE) -C tests       clean
	$(MAKE) -C vhook       clean
Luca Barbato's avatar
Luca Barbato committed
209
	$(MAKE) -C doc         clean
Diego Biurrun's avatar
Diego Biurrun committed
210 211
	rm -f *.o *.d *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
	   output_example$(EXESUF) qt-faststart$(EXESUF) cws2fws$(EXESUF)
212

Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
213
distclean: clean
214 215 216
	$(MAKE) -C libavutil   distclean
	$(MAKE) -C libavcodec  distclean
	$(MAKE) -C libavformat distclean
217
	$(MAKE) -C libpostproc distclean
Luca Abeni's avatar
Luca Abeni committed
218
	$(MAKE) -C libswscale  distclean
219 220
	$(MAKE) -C tests       distclean
	$(MAKE) -C vhook       distclean
Diego Biurrun's avatar
Diego Biurrun committed
221
	rm -f .depend version.h config.* *.pc
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
222 223

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

226 227
# regression tests

Diego Biurrun's avatar
Diego Biurrun committed
228
codectest libavtest test-server fulltest test mpeg4 mpeg: $(PROGS)
Fabrice Bellard's avatar
Fabrice Bellard committed
229
	$(MAKE) -C tests $@
230

231
.PHONY: all lib videohook documentation install* wininstaller uninstall*
232
.PHONY: dep depend clean distclean TAGS
233
.PHONY: codectest libavtest test-server fulltest test mpeg4 mpeg
234

235
-include .depend