os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
[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 ifeq ($(CONFIG_OS2),yes)
22 EXE=.exe
23 PROG=ffmpeg$(EXE)
24 else
25 EXE=
26 PROG=ffmpeg ffplay
27 ifeq ($(CONFIG_FFSERVER),yes)
28 PROG+=ffserver
29 endif
30 endif
31 endif
32
33 ifeq ($(CONFIG_AUDIO_BEOS),yes)
34 EXTRALIBS+=-lmedia -lbe
35 endif
36
37 ifeq ($(BUILD_SHARED),yes)
38 DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
39 else
40 DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
41 ifeq ($(CONFIG_MP3LAME),yes)
42 EXTRALIBS+=-lmp3lame
43 endif
44 ifeq ($(CONFIG_VORBIS),yes)
45 EXTRALIBS+=-logg -lvorbis -lvorbisenc
46 endif
47 endif
48
49 ifeq ($(BUILD_VHOOK),yes)
50 VHOOK=videohook
51 INSTALLVHOOK=install-vhook
52 CLEANVHOOK=clean-vhook
53 endif
54
55 OBJS = ffmpeg.o ffserver.o
56 SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
57
58 all: lib $(PROG) $(VHOOK)
59
60 lib:
61 $(MAKE) -C libavcodec all
62 $(MAKE) -C libavformat all
63
64 ffmpeg_g$(EXE): ffmpeg.o $(DEP_LIBS)
65 $(CC) $(LDFLAGS) -o $@ ffmpeg.o -L./libavcodec -L./libavformat \
66 -lavformat -lavcodec $(EXTRALIBS)
67
68 ffmpeg$(EXE): ffmpeg_g$(EXE)
69 cp -p $< $@
70 $(STRIP) $@
71
72 ffserver$(EXE): ffserver.o $(DEP_LIBS)
73 $(CC) $(LDFLAGS) $(FFSLDFLAGS) \
74 -o $@ ffserver.o -L./libavcodec -L./libavformat \
75 -lavformat -lavcodec $(EXTRALIBS)
76
77 ffplay: ffmpeg$(EXE)
78 ln -sf $< $@
79
80 %.o: %.c
81 $(CC) $(CFLAGS) -c -o $@ $<
82
83 videohook:
84 $(MAKE) -C vhook all
85
86 install: all $(INSTALLVHOOK)
87 $(MAKE) -C libavcodec install
88 install -d $(prefix)/bin
89 install -c -s -m 755 $(PROG) $(prefix)/bin
90 ln -sf ffmpeg $(prefix)/bin/ffplay
91
92 install-vhook: $(prefix)/lib/vhook
93 $(MAKE) -C vhook install INSTDIR=$(prefix)/lib/vhook
94
95 $(prefix)/lib/vhook:
96 install -d $@
97
98 installlib:
99 $(MAKE) -C libavcodec installlib
100 $(MAKE) -C libavformat installlib
101
102 dep: depend
103
104 depend:
105 $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
106
107 clean: $(CLEANVHOOK)
108 $(MAKE) -C libavcodec clean
109 $(MAKE) -C libavformat clean
110 $(MAKE) -C tests clean
111 rm -f *.o *~ .depend gmon.out TAGS ffmpeg_g$(EXE) $(PROG)
112
113 clean-vhook:
114 $(MAKE) -C vhook clean
115
116 distclean: clean
117 $(MAKE) -C libavcodec distclean
118 rm -f config.mak config.h
119
120 TAGS:
121 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
122
123 # regression tests
124
125 libavtest test mpeg4 mpeg: ffmpeg$(EXE)
126 $(MAKE) -C tests $@
127
128 # tar release (use 'make -k tar' on a checkouted tree)
129 FILE=ffmpeg-$(shell cat VERSION)
130
131 tar:
132 rm -rf /tmp/$(FILE)
133 cp -r . /tmp/$(FILE)
134 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
135 rm -rf /tmp/$(FILE)
136
137 ifneq ($(wildcard .depend),)
138 include .depend
139 endif