Statistics
| Branch: | Revision:

ffmpeg / Makefile @ fd071c26

History | View | Annotate | Download (5.93 KB)

1
#
2
# Main ffmpeg Makefile
3
# (c) 2000-2004 Fabrice Bellard
4
#
5
include config.mak
6

    
7
VPATH=$(SRC_PATH)
8

    
9
CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavutil -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
10
LDFLAGS+= -g
11

    
12
ifeq ($(TARGET_GPROF),yes)
13
CFLAGS+=-p
14
LDFLAGS+=-p
15
endif
16

    
17
MANPAGES=doc/ffmpeg.1
18
PROGS_G+=ffmpeg_g$(EXESUF)
19
PROGS+=ffmpeg$(EXESUF)
20
PROGTEST=output_example$(EXESUF)
21
QTFASTSTART=qt-faststart$(EXESUF)
22

    
23
ifeq ($(CONFIG_FFSERVER),yes)
24
MANPAGES+=doc/ffserver.1
25
PROGS+=ffserver$(EXESUF)
26
endif
27

    
28
ifeq ($(CONFIG_FFPLAY),yes)
29
MANPAGES+=doc/ffplay.1
30
PROGS_G+=ffplay_g$(EXESUF)
31
PROGS+=ffplay$(EXESUF)
32
FFPLAY_O=ffplay.o
33
endif
34

    
35
BASENAMES=ffmpeg ffplay ffserver
36
ALLPROGS=$(addsuffix $(EXESUF), $(BASENAMES))
37
ALLPROGS_G=$(addsuffix _g$(EXESUF), $(BASENAMES))
38
ALLMANPAGES=$(addsuffix .1, $(BASENAMES))
39

    
40
ifeq ($(CONFIG_AUDIO_BEOS),yes)
41
EXTRALIBS+=-lmedia -lbe
42
endif
43

    
44
ifeq ($(BUILD_SHARED),yes)
45
DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
46
else
47
DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
48
endif
49

    
50
ifeq ($(BUILD_VHOOK),yes)
51
VHOOK=videohook
52
INSTALLVHOOK=install-vhook
53
endif
54

    
55
ifeq ($(TARGET_OS), SunOS)
56
TEST=/usr/bin/test
57
else
58
TEST=test
59
endif
60

    
61
ifeq ($(BUILD_DOC),yes)
62
DOC=documentation
63
endif
64

    
65
OBJS = ffmpeg.o ffserver.o cmdutils.o $(FFPLAY_O)
66
SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
67
FFLIBDIRS = -L./libavformat -L./libavcodec -L./libavutil
68
FFLIBS = -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF)
69

    
70
all: version.h lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
71

    
72
lib:
73
	$(MAKE) -C libavutil   all
74
	$(MAKE) -C libavcodec  all
75
	$(MAKE) -C libavformat all
76
ifeq ($(CONFIG_PP),yes)
77
	$(MAKE) -C libpostproc all
78
endif
79

    
80
ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
81
	$(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
82

    
83
ffserver$(EXESUF): ffserver.o .libs
84
	$(CC) $(FFLIBDIRS) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
85

    
86
ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
87
	$(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
88

    
89
%$(EXESUF): %_g$(EXESUF)
90
	cp -p $< $@
91
	$(STRIP) $@
92

    
93
.PHONY: version.h
94
version.h:
95
	$(SRC_PATH)/version.sh
96

    
97
output_example$(EXESUF): output_example.o .libs
98
	$(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
99

    
100
qt-faststart$(EXESUF): qt-faststart.c
101
	$(CC) $(CFLAGS) $(SRC_PATH)/qt-faststart.c -o qt-faststart$(EXESUF)
102

    
103
cws2fws$(EXESUF): cws2fws.c
104
	$(CC) $(SRC_PATH)/cws2fws.c -o cws2fws$(EXESUF) -lz
105

    
106
ffplay.o: ffplay.c
107
	$(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
108

    
109
%.o: %.c
110
	$(CC) $(CFLAGS) -c -o $@ $<
111

    
112
videohook: .libs
113
	$(MAKE) -C vhook all
114

    
115
documentation:
116
	$(MAKE) -C doc all
117

    
118
.PHONY: install
119

    
120
install: install-progs install-libs install-headers install-man $(INSTALLVHOOK)
121

    
122
ifeq ($(BUILD_SHARED),yes)
123
install-progs: $(PROGS) install-libs
124
else
125
install-progs: $(PROGS)
126
endif
127
	install -d "$(bindir)"
128
	install -c $(INSTALLSTRIP) -m 755 $(PROGS) "$(bindir)"
129

    
130
# create the window installer
131
wininstaller: all install
132
	makensis ffinstall.nsi
133

    
134
# install man from source dir if available
135
install-man:
136
ifneq ($(CONFIG_WIN32),yes)
137
	if [ -f doc/ffmpeg.1 ] ; then \
138
	    install -d "$(mandir)/man1" ; \
139
	    install -m 644 $(MANPAGES) "$(mandir)/man1" ; \
140
	fi
141
endif
142

    
143
install-vhook:
144
	$(MAKE) -C vhook install
145

    
146
install-libs:
147
	$(MAKE) -C libavutil   install-libs
148
	$(MAKE) -C libavcodec  install-libs
149
	$(MAKE) -C libavformat install-libs
150
ifeq ($(CONFIG_PP),yes)
151
	$(MAKE) -C libpostproc install-libs
152
endif
153
ifeq ($(BUILD_SHARED),yes)
154
	-$(LDCONFIG)
155
endif
156

    
157
install-headers:
158
	$(MAKE) -C libavutil   install-headers
159
	$(MAKE) -C libavcodec  install-headers
160
	$(MAKE) -C libavformat install-headers
161
ifeq ($(CONFIG_PP),yes)
162
	$(MAKE) -C libpostproc install-headers
163
endif
164

    
165
uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
166

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

    
170
uninstall-man:
171
ifneq ($(CONFIG_WIN32),yes)
172
	rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))
173
endif
174

    
175
uninstall-vhook:
176
	$(MAKE) -C vhook uninstall
177

    
178
uninstall-libs:
179
	$(MAKE) -C libavutil   uninstall-libs
180
	$(MAKE) -C libavcodec  uninstall-libs
181
	$(MAKE) -C libavformat uninstall-libs
182
	$(MAKE) -C libpostproc uninstall-libs
183

    
184
uninstall-headers:
185
	$(MAKE) -C libavutil   uninstall-headers
186
	$(MAKE) -C libavcodec  uninstall-headers
187
	$(MAKE) -C libavformat uninstall-headers
188
	$(MAKE) -C libpostproc uninstall-headers
189
	-rmdir "$(incdir)"
190
	-rmdir "$(prefix)/include/postproc"
191

    
192
dep:	depend
193

    
194
depend: .depend
195
	$(MAKE) -C libavutil   depend
196
	$(MAKE) -C libavcodec  depend
197
	$(MAKE) -C libavformat depend
198
ifeq ($(BUILD_VHOOK),yes)
199
	$(MAKE) -C vhook       depend
200
endif
201

    
202
.depend: $(SRCS) version.h
203
	$(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
204

    
205
.libs: lib
206
	@test -f .libs || touch .libs
207
	@for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
208

    
209
clean:
210
	$(MAKE) -C libavutil   clean
211
	$(MAKE) -C libavcodec  clean
212
	$(MAKE) -C libavformat clean
213
	$(MAKE) -C libpostproc clean
214
	$(MAKE) -C tests       clean
215
	$(MAKE) -C vhook       clean
216
	rm -f *.o *.d *~ .libs gmon.out TAGS \
217
	   $(ALLPROGS) $(ALLPROGS_G) $(PROGTEST) $(QTFASTSTART)
218

    
219
# Note well: config.log is NOT removed.
220
distclean: clean
221
	$(MAKE) -C libavutil   distclean
222
	$(MAKE) -C libavcodec  distclean
223
	$(MAKE) -C libavformat distclean
224
	$(MAKE) -C libpostproc distclean
225
	$(MAKE) -C tests       distclean
226
	$(MAKE) -C vhook       distclean
227
	rm -f .depend config.mak config.h version.h *.pc
228

    
229
TAGS:
230
	etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
231

    
232
# regression tests
233

    
234
libavtest test mpeg4 mpeg test-server fulltest: $(PROGS)
235
	$(MAKE) -C tests $@
236

    
237
# tar release (use 'make -k tar' on a checkouted tree)
238
FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
239
                    cut -d "\"" -f 2 )
240

    
241
tar:
242
	rm -rf /tmp/$(FILE)
243
	cp -r . /tmp/$(FILE)
244
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude .svn )
245
	rm -rf /tmp/$(FILE)
246

    
247
.PHONY: lib
248

    
249
ifneq ($(wildcard .depend),)
250
include .depend
251
endif