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

14
ifeq ($(CONFIG_FFMPEG),yes)
15
16
17
MANPAGES=doc/ffmpeg.1
PROGS_G+=ffmpeg_g$(EXESUF)
PROGS+=ffmpeg$(EXESUF)
18
endif
Fabrice Bellard's avatar
Fabrice Bellard committed
19
20

ifeq ($(CONFIG_FFSERVER),yes)
21
22
MANPAGES+=doc/ffserver.1
PROGS+=ffserver$(EXESUF)
Fabrice Bellard's avatar
Fabrice Bellard committed
23
24
25
endif

ifeq ($(CONFIG_FFPLAY),yes)
26
27
28
MANPAGES+=doc/ffplay.1
PROGS_G+=ffplay_g$(EXESUF)
PROGS+=ffplay$(EXESUF)
29
endif
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
30

31
32
33
34
35
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
36
ifeq ($(BUILD_SHARED),yes)
37
DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
Nick Kurshev's avatar
Nick Kurshev committed
38
else
39
DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
40
41
endif

42
ifeq ($(CONFIG_VHOOK),yes)
43
44
VHOOK=videohook
INSTALLVHOOK=install-vhook
45
endif
46

47
48
ifeq ($(BUILD_DOC),yes)
DOC=documentation
49
INSTALLMAN=install-man
50
51
endif

52
OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
Zdenek Kabelac's avatar
Zdenek Kabelac committed
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)
Zdenek Kabelac's avatar
Zdenek Kabelac committed
56

Luca Abeni's avatar
Luca Abeni committed
57
ifeq ($(CONFIG_SWSCALER),yes)
Diego Biurrun's avatar
Diego Biurrun committed
58
LDFLAGS+=-L./libswscale
Diego Biurrun's avatar
Diego Biurrun committed
59
EXTRALIBS+=-lswscale$(BUILDSUF)
Luca Abeni's avatar
Luca Abeni committed
60
61
endif

62
all: lib $(PROGS_G) $(PROGS) $(VHOOK) $(DOC)
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
63

Fabrice Bellard's avatar
Fabrice Bellard committed
64
lib:
65
66
	$(MAKE) -C libavutil   all
	$(MAKE) -C libavcodec  all
Fabrice Bellard's avatar
Fabrice Bellard committed
67
	$(MAKE) -C libavformat all
68
ifeq ($(CONFIG_PP),yes)
69
	$(MAKE) -C libpostproc all
70
endif
Luca Abeni's avatar
Luca Abeni committed
71
72
73
ifeq ($(CONFIG_SWSCALER),yes)
	$(MAKE) -C libswscale  all
endif
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
74

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

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

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

84
%$(EXESUF): %_g$(EXESUF)
Fabrice Bellard's avatar
Fabrice Bellard committed
85
86
87
	cp -p $< $@
	$(STRIP) $@

88
version.h:
89
	$(SRC_PATH)/version.sh $(SRC_PATH)
90

Fabrice Bellard's avatar
Fabrice Bellard committed
91
output_example$(EXESUF): output_example.o .libs
Diego Biurrun's avatar
Diego Biurrun committed
92
	$(CC) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
93

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

97
cws2fws$(EXESUF): cws2fws.c
Måns Rullgård's avatar
Måns Rullgård committed
98
	$(CC) $< -o $@ -lz
99

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

103
104
ffmpeg.o ffplay.o ffserver.o: version.h

Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
105
%.o: %.c
106
	$(CC) $(CFLAGS) -c -o $@ $<
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
107

François Revol's avatar
François Revol committed
108
videohook: .libs
109
110
	$(MAKE) -C vhook all

111
112
113
documentation:
	$(MAKE) -C doc all

114
install: install-progs install-libs install-headers $(INSTALLMAN) $(INSTALLVHOOK)
115

116
ifeq ($(BUILD_SHARED),yes)
117
install-progs: $(PROGS) install-libs
118
else
119
install-progs: $(PROGS)
120
endif
Fabrice Bellard's avatar
Fabrice Bellard committed
121
	install -d "$(bindir)"
122
	install -c $(INSTALLSTRIP) -m 755 $(PROGS) "$(bindir)"
Fabrice Bellard's avatar
merge    
Fabrice Bellard committed
123

Fabrice Bellard's avatar
Fabrice Bellard committed
124
125
126
127
# create the window installer
wininstaller: all install
	makensis ffinstall.nsi

128
install-man:
129
130
	install -d "$(mandir)/man1"
	install -m 644 $(MANPAGES) "$(mandir)/man1"
131

132
133
install-vhook:
	$(MAKE) -C vhook install
134

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

146
ifeq ($(BUILD_SHARED),yes)
147
	-$(LDCONFIG)
148
endif
149

150
151
152
153
install-headers:
	$(MAKE) -C libavutil   install-headers
	$(MAKE) -C libavcodec  install-headers
	$(MAKE) -C libavformat install-headers
154
ifeq ($(CONFIG_PP),yes)
155
	$(MAKE) -C libpostproc install-headers
156
endif
Luca Abeni's avatar
Luca Abeni committed
157
	$(MAKE) -C libswscale  install-headers
158

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

uninstall-headers:
	$(MAKE) -C libavutil   uninstall-headers
	$(MAKE) -C libavcodec  uninstall-headers
	$(MAKE) -C libavformat uninstall-headers
180
	$(MAKE) -C libpostproc uninstall-headers
Diego Biurrun's avatar
Diego Biurrun committed
181
182
183
	-rmdir "$(incdir)"
	-rmdir "$(prefix)/include/postproc"

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

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

201
.libs: lib
202
	@test -f .libs || touch .libs
203
	@for i in $(DEP_LIBS) ; do if test $$i -nt .libs ; then touch .libs; fi ; done
204

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

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

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

230
231
# regression tests

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

235
.PHONY: all lib videohook documentation install* wininstaller uninstall*
236
.PHONY: dep depend clean distclean TAGS
237
.PHONY: codectest libavtest test-server fulltest test mpeg4 mpeg
238

Zdenek Kabelac's avatar
Zdenek Kabelac committed
239
240
241
ifneq ($(wildcard .depend),)
include .depend
endif