Makefile 4.2 KB
Newer Older
1
#
F
merge  
Fabrice Bellard 已提交
2
# Main ffmpeg Makefile
3
# (c) 2000-2004 Fabrice Bellard
F
merge  
Fabrice Bellard 已提交
4
#
5
include config.mak
F
merge  
Fabrice Bellard 已提交
6

7 8
VPATH=$(SRC_PATH)

9
CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -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)
F
merge  
Fabrice Bellard 已提交
13 14 15 16
CFLAGS+=-p
LDFLAGS+=-p
endif

17
MANPAGE=$(SRC_PATH)/doc/ffmpeg.1
F
Fabrice Bellard 已提交
18 19
PROG=ffmpeg$(EXESUF)
PROGTEST=output_example$(EXESUF)
20
QTFASTSTART=qt-faststart$(EXESUF)
F
Fabrice Bellard 已提交
21 22

ifeq ($(CONFIG_FFSERVER),yes)
23
MANPAGE+=$(SRC_PATH)/doc/ffserver.1
F
Fabrice Bellard 已提交
24
PROG+=ffserver$(EXESUF)
F
Fabrice Bellard 已提交
25 26 27
endif

ifeq ($(CONFIG_FFPLAY),yes)
28
MANPAGE+=$(SRC_PATH)/doc/ffplay.1
F
Fabrice Bellard 已提交
29
PROG+=ffplay$(EXESUF)
30
endif
F
merge  
Fabrice Bellard 已提交
31

32 33 34
ifeq ($(CONFIG_AUDIO_BEOS),yes)
EXTRALIBS+=-lmedia -lbe
endif
35

N
Nick Kurshev 已提交
36
ifeq ($(BUILD_SHARED),yes)
37
DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
N
Nick Kurshev 已提交
38
else
39
DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
40 41 42
ifeq ($(CONFIG_MP3LAME),yes)
EXTRALIBS+=-lmp3lame
endif
43 44
endif

45 46 47
ifeq ($(CONFIG_VORBIS),yes)
EXTRALIBS+=-logg -lvorbis -lvorbisenc
endif
N
Nick Kurshev 已提交
48

Z
Zdenek Kabelac 已提交
49 50 51 52 53 54 55 56
ifeq ($(CONFIG_FAAD),yes)
ifeq ($(CONFIG_FAADBIN),yes)
# no libs needed
else
EXTRALIBS += -lfaad
endif
endif

57 58 59 60
ifeq ($(CONFIG_FAAC),yes)
EXTRALIBS+=-lfaac
endif

61 62 63 64
ifeq ($(BUILD_VHOOK),yes)
VHOOK=videohook
INSTALLVHOOK=install-vhook
CLEANVHOOK=clean-vhook
65
endif
66

67 68 69 70 71 72
ifeq ($(TARGET_OS), SunOS)
TEST=/usr/bin/test
else
TEST=test
endif

73 74 75 76
ifeq ($(BUILD_DOC),yes)
DOC=documentation
endif

F
Fabrice Bellard 已提交
77
OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
Z
Zdenek Kabelac 已提交
78
SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
79
FFLIBS = -L./libavformat -lavformat -L./libavcodec -lavcodec
Z
Zdenek Kabelac 已提交
80

81
all: lib $(PROG) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
F
merge  
Fabrice Bellard 已提交
82

F
Fabrice Bellard 已提交
83
lib:
F
Fabrice Bellard 已提交
84
	$(MAKE) -C libavcodec all
F
Fabrice Bellard 已提交
85
	$(MAKE) -C libavformat all
F
merge  
Fabrice Bellard 已提交
86

F
Fabrice Bellard 已提交
87
ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
F
Fabrice Bellard 已提交
88
	$(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
F
merge  
Fabrice Bellard 已提交
89

F
Fabrice Bellard 已提交
90
ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
91 92
	cp -p $< $@
	$(STRIP) $@
93

F
Fabrice Bellard 已提交
94
ffserver$(EXESUF): ffserver.o .libs
95
	$(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS) 
F
merge  
Fabrice Bellard 已提交
96

F
Fabrice Bellard 已提交
97
ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
F
Fabrice Bellard 已提交
98 99
	$(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)

F
Fabrice Bellard 已提交
100
ffplay$(EXESUF): ffplay_g$(EXESUF)
F
Fabrice Bellard 已提交
101 102 103
	cp -p $< $@
	$(STRIP) $@

F
Fabrice Bellard 已提交
104
output_example$(EXESUF): output_example.o .libs
105 106
	$(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)

107 108 109
qt-faststart$(EXESUF): qt-faststart.c
	$(CC) qt-faststart.c -o qt-faststart$(EXESUF)

F
Fabrice Bellard 已提交
110 111
ffplay.o: ffplay.c
	$(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $< 
F
Fabrice Bellard 已提交
112

F
merge  
Fabrice Bellard 已提交
113
%.o: %.c
114
	$(CC) $(CFLAGS) -c -o $@ $< 
F
merge  
Fabrice Bellard 已提交
115

F
François Revol 已提交
116
videohook: .libs
117 118
	$(MAKE) -C vhook all

119 120 121
documentation:
	$(MAKE) -C doc all

F
Fabrice Bellard 已提交
122 123
.PHONY: install

F
Fabrice Bellard 已提交
124
install: all install-man $(INSTALLVHOOK)
N
Nick Kurshev 已提交
125
	$(MAKE) -C libavcodec install
126
	$(MAKE) -C libavformat install
F
Fabrice Bellard 已提交
127 128
	install -d "$(bindir)"
	install -c -s -m 755 $(PROG) "$(bindir)"
F
merge  
Fabrice Bellard 已提交
129

F
Fabrice Bellard 已提交
130 131 132 133
# create the window installer
wininstaller: all install
	makensis ffinstall.nsi

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

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

146 147
installlib:
	$(MAKE) -C libavcodec installlib
F
Fabrice Bellard 已提交
148
	$(MAKE) -C libavformat installlib
149

Z
Zdenek Kabelac 已提交
150 151
dep:	depend

152
depend: .depend
153 154 155 156 157
	make -C libavcodec depend
	make -C libavformat depend
ifeq ($(BUILD_VHOOK),yes)
	make -C vhook depend
endif
158 159

.depend: $(SRCS)
Z
Zdenek Kabelac 已提交
160
	$(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
Z
Zdenek Kabelac 已提交
161

162
.libs: lib
163
	@test -f .libs || touch .libs
164
	@for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
165

Z
Zdenek Kabelac 已提交
166
clean: $(CLEANVHOOK)
F
Fabrice Bellard 已提交
167
	$(MAKE) -C libavcodec clean
F
Fabrice Bellard 已提交
168
	$(MAKE) -C libavformat clean
169
	$(MAKE) -C tests clean
170
	rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXESUF) ffplay_g$(EXESUF) $(PROG) $(PROGTEST)
F
merge  
Fabrice Bellard 已提交
171

172 173 174
clean-vhook:
	$(MAKE) -C vhook clean

F
merge  
Fabrice Bellard 已提交
175
distclean: clean
F
Fabrice Bellard 已提交
176
	$(MAKE) -C libavcodec distclean
177
	rm -f config.mak config.h
F
merge  
Fabrice Bellard 已提交
178 179

TAGS:
F
Fabrice Bellard 已提交
180
	etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
Z
Zdenek Kabelac 已提交
181

182 183
# regression tests

F
Fabrice Bellard 已提交
184
libavtest test mpeg4 mpeg test-server fulltest: ffmpeg$(EXESUF)
F
Fabrice Bellard 已提交
185
	$(MAKE) -C tests $@
186

F
Fabrice Bellard 已提交
187
# tar release (use 'make -k tar' on a checkouted tree)
F
Fabrice Bellard 已提交
188 189
FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
                    cut -d "\"" -f 2 )
F
Fabrice Bellard 已提交
190 191 192 193 194 195 196

tar:
	rm -rf /tmp/$(FILE)
	cp -r . /tmp/$(FILE)
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
	rm -rf /tmp/$(FILE)

197 198
.PHONY: lib

Z
Zdenek Kabelac 已提交
199 200 201
ifneq ($(wildcard .depend),)
include .depend
endif