AMR-NB audio support patch by (<joca at rixmail dot se>)
[libav.git] / libavcodec / Makefile
CommitLineData
4cc281d9
FB
1#
2# libavcodec Makefile
ff4ec49e 3# (c) 2000, 2001, 2002 Fabrice Bellard
4cc281d9 4#
980fc7b8
FB
5include ../config.mak
6
4cc281d9
FB
7VPATH=$(SRC_PATH)/libavcodec
8
ff4ec49e 9# NOTE: -I.. is needed to include config.h
eddbd7e5 10CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
de6d9b64
FB
11LDFLAGS= -g
12
773cefc6 13OBJS= common.o utils.o mem.o allcodecs.o \
1d0d55da 14 mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
10b7b472 15 mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
1d0d55da
MN
16 motion_est.o imgconvert.o imgresample.o \
17 mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
6d2abd6b 18 ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
d86053a4
MM
19 fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
20 vp3.o
891f64b3 21
22ifeq ($(AMR_NB),yes)
23OBJS+= amr.o
24endif
25
980fc7b8 26ASM_OBJS=
de6d9b64 27
1d0d55da
MN
28# codecs which are patented in some non free countries like the us
29ifeq ($(CONFIG_RISKY),yes)
deabd4fd 30OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
1d0d55da
MN
31endif
32
57514323 33# currently using liba52 for ac3 decoding
d771bcae 34ifeq ($(CONFIG_AC3),yes)
57514323 35OBJS+= a52dec.o
57514323
ZK
36
37# using builtin liba52 or runtime linked liba52.so.0
ff4ec49e 38ifneq ($(CONFIG_A52BIN),yes)
57514323 39OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
521221cf 40 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
d771bcae 41endif
ff4ec49e 42endif
de6d9b64 43
280bd7b7
ZK
44ifeq ($(CONFIG_FAAD),yes)
45OBJS+= faad.o
445ad18d
ZK
46ifeq ($(CONFIG_FAADBIN),yes)
47# no libs needed
48else
49EXTRALIBS += -lfaad
50endif
280bd7b7
ZK
51endif
52
bba9b16c
MN
53ifeq ($(CONFIG_PP),yes)
54ifeq ($(SHARED_PP),yes)
55EXTRALIBS += -lpostproc
56else
57# LIBS += libpostproc/libpostproc.a ... should be fixed
58OBJS += libpostproc/postprocess.o
59endif
60endif
61
5798368b
J
62ifeq ($(CONFIG_MP3LAME),yes)
63OBJS += mp3lameaudio.o
2a2a98c0 64EXTRALIBS += -lmp3lame
5798368b
J
65endif
66
81e0d0b4
MH
67ifeq ($(CONFIG_VORBIS),yes)
68OBJS += oggvorbis.o
69EXTRALIBS += -lvorbis -lvorbisenc
70endif
71
43f1708f
J
72ifeq ($(TARGET_GPROF),yes)
73CFLAGS+=-p
74LDFLAGS+=-p
75endif
76
de6d9b64 77# i386 mmx specific stuff
980fc7b8 78ifeq ($(TARGET_MMX),yes)
4300403e 79OBJS += i386/fdct_mmx.o i386/cputest.o \
de1ee36a 80 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
57514323 81 i386/idct_mmx.o i386/motion_est_mmx.o \
923ceff8 82 i386/simple_idct_mmx.o i386/fft_sse.o
a968e365
FB
83ifdef TARGET_BUILTIN_VECTOR
84i386/fft_sse.o: CFLAGS+= -msse
85endif
de6d9b64
FB
86endif
87
3d03c0a2
FB
88# armv4l specific stuff
89ifeq ($(TARGET_ARCH_ARMV4L),yes)
90ASM_OBJS += armv4l/jrevdct_arm.o
676e200c 91OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
3d03c0a2
FB
92endif
93
c34270f5
FB
94# sun mediaLib specific stuff
95# currently only works when libavcodec is used in mplayer
96ifeq ($(HAVE_MLIB),yes)
97OBJS += mlib/dsputil_mlib.o
98CFLAGS += $(MLIB_INC)
99endif
100
1e98dffb
NK
101# alpha specific stuff
102ifeq ($(TARGET_ARCH_ALPHA),yes)
8b313a47
FH
103OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
104 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
f9bb4bdf 105ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
0af65aac 106CFLAGS += -fforce-addr -freduce-all-givs
1e98dffb
NK
107endif
108
59925ef2 109ifeq ($(TARGET_ARCH_POWERPC),yes)
05c4072b 110OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
ab6c65f6
BF
111endif
112
d46aba26 113ifeq ($(TARGET_MMI),yes)
5917d17c 114OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
d46aba26
LS
115endif
116
ab6c65f6 117ifeq ($(TARGET_ALTIVEC),yes)
3b991c54 118ifeq ($(TARGET_OS),Darwin)
59925ef2 119CFLAGS += -faltivec
3b991c54
RD
120else
121CFLAGS += -maltivec -mabi=altivec
122endif
8d268a7d 123OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
e629ab68 124 ppc/fft_altivec.o ppc/gmc_altivec.o
59925ef2
BF
125endif
126
bb7d4939 127SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
ff4ec49e 128OBJS := $(OBJS) $(ASM_OBJS)
980fc7b8 129
f3ec2d46 130LIB= $(LIBPREF)avcodec$(LIBSUF)
0fd94442 131ifeq ($(BUILD_SHARED),yes)
f3ec2d46 132SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
0fd94442 133endif
6d2abd6b 134TESTS= imgresample-test dct-test motion-test fft-test
de6d9b64 135
0fd94442 136all: $(LIB) $(SLIB)
ff4ec49e 137
c10e9f70 138tests: apiexample cpuid_test $(TESTS)
de6d9b64 139
811b32ed 140$(LIB): $(OBJS)
de6d9b64 141 rm -f $@
be7109c1
MN
142 $(AR) rc $@ $(OBJS)
143 $(RANLIB) $@
ff4ec49e 144
811b32ed 145$(SLIB): $(OBJS)
e1707f52 146 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
de6d9b64
FB
147
148dsputil.o: dsputil.c dsputil.h
149
bba9b16c
MN
150libpostproc/libpostproc.a:
151 $(MAKE) -C libpostproc
152
de6d9b64
FB
153%.o: %.c
154 $(CC) $(CFLAGS) -c -o $@ $<
155
3d03c0a2
FB
156%.o: %.S
157 $(CC) $(CFLAGS) -c -o $@ $<
158
0af65aac
FH
159# motion_est_alpha uses the MVI extension, which is not available with
160# -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those
161# cases.
162ifeq ($(TARGET_ARCH_ALPHA),yes)
163alpha/motion_est_alpha.o: alpha/motion_est_alpha.c
164 cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \
165 case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \
166 echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\
167 $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<
168endif
169
811b32ed 170depend: $(SRCS)
a968e365 171 $(CC) -MM $(CFLAGS) $^ 1>.depend
e51d4def 172
980fc7b8
FB
173dep: depend
174
de6d9b64 175clean:
77b71ddc 176 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
3d03c0a2 177 armv4l/*.o armv4l/*~ \
c34270f5 178 mlib/*.o mlib/*~ \
1e98dffb 179 alpha/*.o alpha/*~ \
59925ef2 180 ppc/*.o ppc/*~ \
d46aba26 181 ps2/*.o ps2/*~ \
57514323
ZK
182 liba52/*.o liba52/*~ \
183 apiexample $(TESTS)
64094f37 184 $(MAKE) -C libpostproc clean
de6d9b64 185
800d7ceb 186distclean: clean
980fc7b8
FB
187 rm -f Makefile.bak .depend
188
de6d9b64
FB
189# api example program
190apiexample: apiexample.c $(LIB)
cfda33cb 191 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
de6d9b64 192
c10e9f70
NK
193# cpuid test
194cpuid_test: i386/cputest.c
195 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
196
de6d9b64
FB
197# testing progs
198
199imgresample-test: imgresample.c
6acce86b 200 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
de6d9b64 201
9ebc63a9 202dct-test: dct-test.o fdctref.o $(LIB)
90cee0c3 203 $(CC) -o $@ $^ -lm
d771bcae 204
4300403e 205motion-test: motion_test.o $(LIB)
6acce86b 206 $(CC) -o $@ $^ -lm
4300403e 207
923ceff8 208fft-test: fft-test.o $(LIB)
6d2abd6b
FB
209 $(CC) -o $@ $^ -lm
210
0fd94442 211install: all
0fd94442 212ifeq ($(BUILD_SHARED),yes)
c1325d18 213 install -d $(prefix)/lib
ff4ec49e 214 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
c1325d18
VM
215 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
216 ldconfig || true
ff4ec49e 217 mkdir -p $(prefix)/include/ffmpeg
3565eeaa
FH
218 install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
219 install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
0fd94442 220endif
773cefc6
FB
221
222installlib: all
223 install -m 644 $(LIB) $(prefix)/lib
224 mkdir -p $(prefix)/include/ffmpeg
225 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
226 $(prefix)/include/ffmpeg
227
d771bcae
FB
228#
229# include dependency files if they exist
230#
231ifneq ($(wildcard .depend),)
232include .depend
233endif