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