afa613c1d1250bfa92e4616065272e95e42a81ca
[libav.git] / Makefile
1 #
2 # Main ffmpeg Makefile
3 # (c) 2000, 2001, 2002 Fabrice Bellard
4 #
5 include config.mak
6
7 VPATH=$(SRC_PATH)
8
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)
13 CFLAGS+=-p
14 LDFLAGS+=-p
15 endif
16
17 ifeq ($(CONFIG_WIN32),yes)
18 EXE=.exe
19 PROG=ffmpeg$(EXE)
20 else
21 EXT=
22 PROG=ffmpeg ffplay ffserver
23 endif
24
25 ifeq ($(CONFIG_AUDIO_BEOS),yes)
26 EXTRALIBS+=-lmedia -lbe
27 endif
28
29 ifeq ($(BUILD_SHARED),yes)
30 DEP_LIBS=libavcodec/libavcodec.so libavformat/libavformat.a
31 else
32 DEP_LIBS=libavcodec/libavcodec.a libavformat/libavformat.a
33 ifeq ($(CONFIG_MP3LAME),yes)
34 EXTRALIBS+=-lmp3lame
35 endif
36 ifeq ($(CONFIG_VORBIS),yes)
37 EXTRALIBS+=-logg -lvorbis -lvorbisenc
38 endif
39 endif
40
41 ifeq ($(BUILD_VHOOK),yes)
42 VHOOK=videohook
43 INSTALLVHOOK=install-vhook
44 CLEANVHOOK=clean-vhook
45 endif
46
47 OBJS = ffmpeg.o ffserver.o
48 SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
49
50 all: lib $(PROG) $(VHOOK)
51
52 lib:
53 $(MAKE) -C libavcodec all
54 $(MAKE) -C libavformat all
55
56 ffmpeg_g$(EXE): ffmpeg.o $(DEP_LIBS)
57 $(CC) $(LDFLAGS) -o $@ ffmpeg.o -L./libavcodec -L./libavformat \
58 -lavformat -lavcodec $(EXTRALIBS)
59
60 ffmpeg$(EXE): ffmpeg_g$(EXE)
61 cp -p $< $@ ; $(STRIP) $@
62
63 ffserver$(EXE): ffserver.o $(DEP_LIBS)
64 $(CC) $(LDFLAGS) $(FFSLDFLAGS) \
65 -o $@ ffserver.o -L./libavcodec -L./libavformat \
66 -lavformat -lavcodec $(EXTRALIBS)
67
68 ffplay: ffmpeg$(EXE)
69 ln -sf $< $@
70
71 %.o: %.c
72 $(CC) $(CFLAGS) -c -o $@ $<
73
74 videohook:
75 $(MAKE) -C vhook all
76
77 install: all $(INSTALLVHOOK)
78 $(MAKE) -C libavcodec install
79 install -d $(prefix)/bin
80 install -s -m 755 $(PROG) $(prefix)/bin
81 ln -sf ffmpeg $(prefix)/bin/ffplay
82
83 install-vhook: $(prefix)/lib/vhook
84 $(MAKE) -C vhook install INSTDIR=$(prefix)/lib/vhook
85
86 $(prefix)/lib/vhook:
87 install -d $@
88
89 installlib:
90 $(MAKE) -C libavcodec installlib
91 $(MAKE) -C libavformat installlib
92
93 dep: depend
94
95 depend:
96 $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
97
98 clean: $(CLEANVHOOK)
99 $(MAKE) -C libavcodec clean
100 $(MAKE) -C libavformat clean
101 $(MAKE) -C tests clean
102 rm -f *.o *~ .depend gmon.out TAGS ffmpeg_g$(EXE) $(PROG)
103
104 clean-vhook:
105 $(MAKE) -C vhook clean
106
107 distclean: clean
108 $(MAKE) -C libavcodec distclean
109 rm -f config.mak config.h
110
111 TAGS:
112 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
113
114 # regression tests
115
116 libavtest test mpeg4 mpeg: ffmpeg$(EXE)
117 $(MAKE) -C tests $@
118
119 ifneq ($(wildcard .depend),)
120 include .depend
121 endif