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