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