cleanup; unused pipe() stuff removed.
[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 endif
45
46 ifeq ($(CONFIG_VORBIS),yes)
47 EXTRALIBS+=-logg -lvorbis -lvorbisenc
48 endif
49
50 ifeq ($(BUILD_VHOOK),yes)
51 VHOOK=videohook
52 INSTALLVHOOK=install-vhook
53 CLEANVHOOK=clean-vhook
54 endif
55
56 OBJS = ffmpeg.o ffserver.o
57 SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
58 FFLIBS = -L./libavformat -lavformat -L./libavcodec -lavcodec
59
60 all: lib $(PROG) $(VHOOK)
61
62 lib:
63 $(MAKE) -C libavcodec all
64 $(MAKE) -C libavformat all
65
66 ffmpeg_g$(EXE): ffmpeg.o .libs
67 $(CC) $(LDFLAGS) -o $@ ffmpeg.o $(FFLIBS) $(EXTRALIBS)
68
69 ffmpeg$(EXE): ffmpeg_g$(EXE)
70 cp -p $< $@
71 $(STRIP) $@
72
73 ffserver$(EXE): ffserver.o .libs
74 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
75
76 ffplay: ffmpeg$(EXE)
77 ln -sf $< $@
78
79 %.o: %.c
80 $(CC) $(CFLAGS) -c -o $@ $<
81
82 videohook: .libs
83 $(MAKE) -C vhook all
84
85 install: all $(INSTALLVHOOK)
86 $(MAKE) -C libavcodec install
87 install -d $(prefix)/bin
88 install -c -s -m 755 $(PROG) $(prefix)/bin
89 ln -sf ffmpeg $(prefix)/bin/ffplay
90
91 install-vhook: $(prefix)/lib/vhook
92 $(MAKE) -C vhook install INSTDIR=$(prefix)/lib/vhook
93
94 $(prefix)/lib/vhook:
95 install -d $@
96
97 installlib:
98 $(MAKE) -C libavcodec installlib
99 $(MAKE) -C libavformat installlib
100
101 dep: depend
102
103 depend: .depend
104 make -C libavcodec depend
105 make -C libavformat depend
106 ifeq ($(BUILD_VHOOK),yes)
107 make -C vhook depend
108 endif
109
110 .depend: $(SRCS)
111 $(CC) -MM $(CFLAGS) $^ 1>.depend
112
113 .libs: lib
114 @test -f .libs || touch .libs
115 @for i in $(DEP_LIBS) ; do if test $$i -nt .libs ; then touch .libs; fi ; done
116
117 clean: $(CLEANVHOOK)
118 $(MAKE) -C libavcodec clean
119 $(MAKE) -C libavformat clean
120 $(MAKE) -C tests clean
121 rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXE) $(PROG)
122
123 clean-vhook:
124 $(MAKE) -C vhook clean
125
126 distclean: clean
127 $(MAKE) -C libavcodec distclean
128 rm -f config.mak config.h
129
130 TAGS:
131 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
132
133 # regression tests
134
135 libavtest test mpeg4 mpeg: ffmpeg$(EXE)
136 $(MAKE) all -C tests $@
137
138 # tar release (use 'make -k tar' on a checkouted tree)
139 FILE=ffmpeg-$(shell cat VERSION)
140
141 tar:
142 rm -rf /tmp/$(FILE)
143 cp -r . /tmp/$(FILE)
144 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
145 rm -rf /tmp/$(FILE)
146
147 .PHONY: lib
148
149 ifneq ($(wildcard .depend),)
150 include .depend
151 endif