* 10000l (cut'n'paste is evil!)
[libav.git] / Makefile
CommitLineData
a1b63811 1#
85f07f22 2# Main ffmpeg Makefile
a1b63811 3# (c) 2000, 2001, 2002 Fabrice Bellard
85f07f22 4#
980fc7b8 5include config.mak
85f07f22 6
dd9ca370
FB
7VPATH=$(SRC_PATH)
8
fe0f2a97 9CFLAGS= -Wall $(OPTFLAGS) -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
4baca069 10LDFLAGS+= -g
37736979 11
980fc7b8 12ifeq ($(TARGET_GPROF),yes)
85f07f22
FB
13CFLAGS+=-p
14LDFLAGS+=-p
15endif
16
951bf3e6
FB
17PROG=ffmpeg$(EXESUF)
18PROGTEST=output_example$(EXESUF)
01310af2
FB
19
20ifeq ($(CONFIG_FFSERVER),yes)
951bf3e6 21PROG+=ffserver$(EXESUF)
01310af2
FB
22endif
23
24ifeq ($(CONFIG_FFPLAY),yes)
951bf3e6 25PROG+=ffplay$(EXESUF)
f3ec2d46 26endif
85f07f22 27
dfdfa47c
FR
28ifeq ($(CONFIG_AUDIO_BEOS),yes)
29EXTRALIBS+=-lmedia -lbe
30endif
a1b63811 31
0fd94442 32ifeq ($(BUILD_SHARED),yes)
6bc114b2 33DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
0fd94442 34else
f3ec2d46 35DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
a6741398
J
36ifeq ($(CONFIG_MP3LAME),yes)
37EXTRALIBS+=-lmp3lame
38endif
d1db8623
FR
39endif
40
81e0d0b4
MH
41ifeq ($(CONFIG_VORBIS),yes)
42EXTRALIBS+=-logg -lvorbis -lvorbisenc
43endif
0fd94442 44
445ad18d
ZK
45ifeq ($(CONFIG_FAAD),yes)
46ifeq ($(CONFIG_FAADBIN),yes)
47# no libs needed
48else
49EXTRALIBS += -lfaad
50endif
51endif
52
142fc6b9
PG
53ifeq ($(BUILD_VHOOK),yes)
54VHOOK=videohook
55INSTALLVHOOK=install-vhook
56CLEANVHOOK=clean-vhook
47930f09 57endif
142fc6b9 58
6e023978
RS
59ifeq ($(TARGET_OS), SunOS)
60TEST=/usr/bin/test
61else
62TEST=test
63endif
64
01310af2 65OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
57514323 66SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
cf2818b0 67FFLIBS = -L./libavformat -lavformat -L./libavcodec -lavcodec
57514323 68
8de65d4f 69all: lib $(PROG) $(PROGTEST) $(VHOOK)
85f07f22 70
951bf3e6 71lib:
2cc8ae96 72 $(MAKE) -C libavcodec all
abac6175 73 $(MAKE) -C libavformat all
85f07f22 74
951bf3e6 75ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
01310af2 76 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
85f07f22 77
951bf3e6 78ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
f3ec2d46
SG
79 cp -p $< $@
80 $(STRIP) $@
37736979 81
951bf3e6 82ffserver$(EXESUF): ffserver.o .libs
cf2818b0 83 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
85f07f22 84
951bf3e6 85ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
01310af2
FB
86 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
87
951bf3e6 88ffplay$(EXESUF): ffplay_g$(EXESUF)
01310af2
FB
89 cp -p $< $@
90 $(STRIP) $@
91
951bf3e6 92output_example$(EXESUF): output_example.o .libs
8de65d4f
FB
93 $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
94
01310af2
FB
95ffplay.o: ffplay.c
96 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
2744a37f 97
85f07f22 98%.o: %.c
daf8e955 99 $(CC) $(CFLAGS) -c -o $@ $<
85f07f22 100
be12b2a4 101videohook: .libs
142fc6b9
PG
102 $(MAKE) -C vhook all
103
d35ff76b
FB
104.PHONY: install
105
23a65308 106install: all install-man $(INSTALLVHOOK)
0fd94442 107 $(MAKE) -C libavcodec install
6bc114b2 108 $(MAKE) -C libavformat install
951bf3e6
FB
109 install -d "$(bindir)"
110 install -c -s -m 755 $(PROG) "$(bindir)"
85f07f22 111
d35ff76b
FB
112# create the window installer
113wininstaller: all install
114 makensis ffinstall.nsi
115
23a65308
FB
116# install man from source dir if available
117install-man:
951bf3e6 118ifneq ($(CONFIG_WIN32),yes)
23a65308
FB
119 if [ -f $(SRC_PATH)/doc/ffmpeg.1 ] ; then \
120 install -d $(mandir)/man1 ; \
121 install -m 644 $(SRC_PATH)/doc/ffmpeg.1 $(SRC_PATH)/doc/ffplay.1 \
122 $(SRC_PATH)/doc/ffserver.1 $(mandir)/man1 ; \
123 fi
951bf3e6 124endif
23a65308 125
142fc6b9
PG
126install-vhook: $(prefix)/lib/vhook
127 $(MAKE) -C vhook install INSTDIR=$(prefix)/lib/vhook
128
129$(prefix)/lib/vhook:
4baca069 130 install -d $@
142fc6b9 131
37736979
FB
132installlib:
133 $(MAKE) -C libavcodec installlib
abac6175 134 $(MAKE) -C libavformat installlib
37736979 135
57514323
ZK
136dep: depend
137
4b8b2edb 138depend: .depend
811b32ed
FB
139 make -C libavcodec depend
140 make -C libavformat depend
141ifeq ($(BUILD_VHOOK),yes)
142 make -C vhook depend
143endif
4b8b2edb
FB
144
145.depend: $(SRCS)
146 $(CC) -MM $(CFLAGS) $^ 1>.depend
57514323 147
cf2818b0 148.libs: lib
127d5c8d 149 @test -f .libs || touch .libs
6e023978 150 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
cf2818b0 151
bc634f6f 152clean: $(CLEANVHOOK)
2cc8ae96 153 $(MAKE) -C libavcodec clean
abac6175 154 $(MAKE) -C libavformat clean
dd9ca370 155 $(MAKE) -C tests clean
4c4b3fcd 156 rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXESUF) ffplay_g$(EXESUF) $(PROG) $(PROGTEST)
85f07f22 157
142fc6b9
PG
158clean-vhook:
159 $(MAKE) -C vhook clean
160
85f07f22 161distclean: clean
c72c6d2d 162 $(MAKE) -C libavcodec distclean
980fc7b8 163 rm -f config.mak config.h
85f07f22
FB
164
165TAGS:
abac6175 166 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
57514323 167
dd9ca370
FB
168# regression tests
169
951bf3e6 170libavtest test mpeg4 mpeg test-server fulltest: ffmpeg$(EXESUF)
ec9fca31 171 $(MAKE) -C tests $@
dd9ca370 172
ac977341 173# tar release (use 'make -k tar' on a checkouted tree)
951bf3e6
FB
174FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
175 cut -d "\"" -f 2 )
ac977341
FB
176
177tar:
178 rm -rf /tmp/$(FILE)
179 cp -r . /tmp/$(FILE)
180 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
181 rm -rf /tmp/$(FILE)
182
cf2818b0
ZK
183.PHONY: lib
184
57514323
ZK
185ifneq ($(wildcard .depend),)
186include .depend
187endif