PowerPC warnings & optimisations patch by (Dan Christiansen <danchr at daimi dot...
[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= -Wall $(OPTFLAGS) -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 PROG=ffmpeg$(EXESUF)
18 PROGTEST=output_example$(EXESUF)
19
20 ifeq ($(CONFIG_FFSERVER),yes)
21 PROG+=ffserver$(EXESUF)
22 endif
23
24 ifeq ($(CONFIG_FFPLAY),yes)
25 PROG+=ffplay$(EXESUF)
26 endif
27
28 ifeq ($(CONFIG_AUDIO_BEOS),yes)
29 EXTRALIBS+=-lmedia -lbe
30 endif
31
32 ifeq ($(BUILD_SHARED),yes)
33 DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
34 else
35 DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
36 ifeq ($(CONFIG_MP3LAME),yes)
37 EXTRALIBS+=-lmp3lame
38 endif
39 endif
40
41 ifeq ($(CONFIG_VORBIS),yes)
42 EXTRALIBS+=-logg -lvorbis -lvorbisenc
43 endif
44
45 ifeq ($(CONFIG_FAAD),yes)
46 ifeq ($(CONFIG_FAADBIN),yes)
47 # no libs needed
48 else
49 EXTRALIBS += -lfaad
50 endif
51 endif
52
53 ifeq ($(BUILD_VHOOK),yes)
54 VHOOK=videohook
55 INSTALLVHOOK=install-vhook
56 CLEANVHOOK=clean-vhook
57 endif
58
59 ifeq ($(TARGET_OS), SunOS)
60 TEST=/usr/bin/test
61 else
62 TEST=test
63 endif
64
65 OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
66 SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
67 FFLIBS = -L./libavformat -lavformat -L./libavcodec -lavcodec
68
69 all: lib $(PROG) $(PROGTEST) $(VHOOK)
70
71 lib:
72 $(MAKE) -C libavcodec all
73 $(MAKE) -C libavformat all
74
75 ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
76 $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
77
78 ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
79 cp -p $< $@
80 $(STRIP) $@
81
82 ffserver$(EXESUF): ffserver.o .libs
83 $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
84
85 ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
86 $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
87
88 ffplay$(EXESUF): ffplay_g$(EXESUF)
89 cp -p $< $@
90 $(STRIP) $@
91
92 output_example$(EXESUF): output_example.o .libs
93 $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
94
95 ffplay.o: ffplay.c
96 $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
97
98 %.o: %.c
99 $(CC) $(CFLAGS) -c -o $@ $<
100
101 videohook: .libs
102 $(MAKE) -C vhook all
103
104 .PHONY: install
105
106 install: all install-man $(INSTALLVHOOK)
107 $(MAKE) -C libavcodec install
108 $(MAKE) -C libavformat install
109 install -d "$(bindir)"
110 install -c -s -m 755 $(PROG) "$(bindir)"
111
112 # create the window installer
113 wininstaller: all install
114 makensis ffinstall.nsi
115
116 # install man from source dir if available
117 install-man:
118 ifneq ($(CONFIG_WIN32),yes)
119 if [ -f $(SRC_PATH)/doc/ffmpeg.1 ] ; then \
120 install -d $(mandir)/man1 ; \
121 install -m 644 $(SRC_PATH)/doc/ffmpeg.1 $(SRC_PATH)/doc/ffplay.1 \
122 $(SRC_PATH)/doc/ffserver.1 $(mandir)/man1 ; \
123 fi
124 endif
125
126 install-vhook: $(prefix)/lib/vhook
127 $(MAKE) -C vhook install INSTDIR=$(prefix)/lib/vhook
128
129 $(prefix)/lib/vhook:
130 install -d $@
131
132 installlib:
133 $(MAKE) -C libavcodec installlib
134 $(MAKE) -C libavformat installlib
135
136 dep: depend
137
138 depend: .depend
139 make -C libavcodec depend
140 make -C libavformat depend
141 ifeq ($(BUILD_VHOOK),yes)
142 make -C vhook depend
143 endif
144
145 .depend: $(SRCS)
146 $(CC) -MM $(CFLAGS) $^ 1>.depend
147
148 .libs: lib
149 @test -f .libs || touch .libs
150 @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
151
152 clean: $(CLEANVHOOK)
153 $(MAKE) -C libavcodec clean
154 $(MAKE) -C libavformat clean
155 $(MAKE) -C tests clean
156 rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXESUF) ffplay_g$(EXESUF) $(PROG) $(PROGTEST)
157
158 clean-vhook:
159 $(MAKE) -C vhook clean
160
161 distclean: clean
162 $(MAKE) -C libavcodec distclean
163 rm -f config.mak config.h
164
165 TAGS:
166 etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
167
168 # regression tests
169
170 libavtest test mpeg4 mpeg test-server fulltest: ffmpeg$(EXESUF)
171 $(MAKE) -C tests $@
172
173 # tar release (use 'make -k tar' on a checkouted tree)
174 FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " libavcodec/avcodec.h | \
175 cut -d "\"" -f 2 )
176
177 tar:
178 rm -rf /tmp/$(FILE)
179 cp -r . /tmp/$(FILE)
180 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
181 rm -rf /tmp/$(FILE)
182
183 .PHONY: lib
184
185 ifneq ($(wildcard .depend),)
186 include .depend
187 endif