Makefile 3.43 KB
Newer Older
1
#
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
2
# Main ffmpeg Makefile
3
# (c) 2000, 2001, 2002 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 8
VPATH=$(SRC_PATH)

Fabrice Bellard's avatar
Fabrice Bellard committed
9
CFLAGS= $(OPTFLAGS) -Wall -g -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)
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
13 14 15 16
CFLAGS+=-p
LDFLAGS+=-p
endif

17 18 19
ifeq ($(CONFIG_WIN32),yes)
EXE=.exe
else
20 21 22 23
ifeq ($(CONFIG_OS2),yes)
EXE=.exe
else
EXE=
24
endif
25
endif
Fabrice Bellard's avatar
Fabrice Bellard committed
26 27 28 29 30 31 32 33 34

PROG=ffmpeg$(EXE)

ifeq ($(CONFIG_FFSERVER),yes)
PROG+=ffserver$(EXE)
endif

ifeq ($(CONFIG_FFPLAY),yes)
PROG+=ffplay$(EXE)
35
endif
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
36

37 38 39
ifeq ($(CONFIG_AUDIO_BEOS),yes)
EXTRALIBS+=-lmedia -lbe
endif
40

Nick Kurshev's avatar
Nick Kurshev committed
41
ifeq ($(BUILD_SHARED),yes)
42
DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
Nick Kurshev's avatar
Nick Kurshev committed
43
else
44
DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
45 46 47
ifeq ($(CONFIG_MP3LAME),yes)
EXTRALIBS+=-lmp3lame
endif
48 49
endif

50 51 52
ifeq ($(CONFIG_VORBIS),yes)
EXTRALIBS+=-logg -lvorbis -lvorbisenc
endif
Nick Kurshev's avatar
Nick Kurshev committed
53

Zdenek Kabelac's avatar
Zdenek Kabelac committed
54 55 56 57 58 59 60 61
ifeq ($(CONFIG_FAAD),yes)
ifeq ($(CONFIG_FAADBIN),yes)
# no libs needed
else
EXTRALIBS += -lfaad
endif
endif

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

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

Fabrice Bellard's avatar
Fabrice Bellard committed
74
OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
Zdenek Kabelac's avatar
Zdenek Kabelac committed
75
SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
76
FFLIBS = -L./libavformat -lavformat -L./libavcodec -lavcodec
Zdenek Kabelac's avatar
Zdenek Kabelac committed
77

78
all: lib $(PROG) $(VHOOK)
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
79

80
lib: $(AMRLIBS)
Fabrice Bellard's avatar
Fabrice Bellard committed
81
	$(MAKE) -C libavcodec all
Fabrice Bellard's avatar
Fabrice Bellard committed
82
	$(MAKE) -C libavformat all
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
83

Fabrice Bellard's avatar
Fabrice Bellard committed
84 85
ffmpeg_g$(EXE): ffmpeg.o cmdutils.o .libs
	$(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
86

87
ffmpeg$(EXE): ffmpeg_g$(EXE)
88 89
	cp -p $< $@
	$(STRIP) $@
90

91 92
ffserver$(EXE): ffserver.o .libs
	$(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS) 
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
93

Fabrice Bellard's avatar
Fabrice Bellard committed
94 95 96 97 98 99 100 101 102
ffplay_g$(EXE): ffplay.o cmdutils.o .libs
	$(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)

ffplay$(EXE): ffplay_g$(EXE)
	cp -p $< $@
	$(STRIP) $@

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

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

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

install: all $(INSTALLVHOOK)
Nick Kurshev's avatar
Nick Kurshev committed
111
	$(MAKE) -C libavcodec install
112
	$(MAKE) -C libavformat install
113
	install -d $(prefix)/bin
114
	install -c -s -m 755 $(PROG) $(prefix)/bin
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
115

116 117 118 119
install-vhook: $(prefix)/lib/vhook
	$(MAKE) -C vhook install INSTDIR=$(prefix)/lib/vhook

$(prefix)/lib/vhook:
120
	install -d $@
121

122 123
installlib:
	$(MAKE) -C libavcodec installlib
Fabrice Bellard's avatar
Fabrice Bellard committed
124
	$(MAKE) -C libavformat installlib
125

Zdenek Kabelac's avatar
Zdenek Kabelac committed
126 127
dep:	depend

128
depend: .depend
129 130 131 132 133
	make -C libavcodec depend
	make -C libavformat depend
ifeq ($(BUILD_VHOOK),yes)
	make -C vhook depend
endif
134 135 136

.depend: $(SRCS)
	$(CC) -MM $(CFLAGS) $^ 1>.depend
Zdenek Kabelac's avatar
Zdenek Kabelac committed
137

138
.libs: lib
139
	@test -f .libs || touch .libs
140
	@for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
141

Zdenek Kabelac's avatar
Zdenek Kabelac committed
142
clean: $(CLEANVHOOK)
Fabrice Bellard's avatar
Fabrice Bellard committed
143
	$(MAKE) -C libavcodec clean
Fabrice Bellard's avatar
Fabrice Bellard committed
144
	$(MAKE) -C libavformat clean
145
	$(MAKE) -C tests clean
Fabrice Bellard's avatar
Fabrice Bellard committed
146
	rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXE) ffplay_g$(EXE) $(PROG) 
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
147

148 149 150
clean-vhook:
	$(MAKE) -C vhook clean

Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
151
distclean: clean
Fabrice Bellard's avatar
Fabrice Bellard committed
152
	$(MAKE) -C libavcodec distclean
153
	rm -f config.mak config.h
Fabrice Bellard's avatar
merge  
Fabrice Bellard committed
154 155

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

158 159
# regression tests

Fabrice Bellard's avatar
Fabrice Bellard committed
160
libavtest test mpeg4 mpeg: ffmpeg$(EXE)
161
	$(MAKE) all -C tests $@
162

Fabrice Bellard's avatar
Fabrice Bellard committed
163 164 165 166 167 168 169 170 171
# tar release (use 'make -k tar' on a checkouted tree)
FILE=ffmpeg-$(shell cat VERSION)

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

172 173
.PHONY: lib

Zdenek Kabelac's avatar
Zdenek Kabelac committed
174 175 176
ifneq ($(wildcard .depend),)
include .depend
endif