PowerPC warnings & optimisations patch by (Dan Christiansen <danchr at daimi dot...
[libav.git] / libavcodec / Makefile
CommitLineData
4cc281d9
FB
1#
2# libavcodec Makefile
cf7412b5 3# (c) 2000-2003 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
fe0f2a97 10CFLAGS= -Wall $(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
de6d9b64 11
773cefc6 12OBJS= common.o utils.o mem.o allcodecs.o \
1d0d55da 13 mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
10b7b472 14 mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
1d0d55da 15 motion_est.o imgconvert.o imgresample.o \
4f1bb8a9 16 mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
6d2abd6b 17 ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
d86053a4 18 fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
3ef8be2b 19 vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o \
9937e686 20 roqvideo.o dpcm.o interplayvideo.o xan.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
d663a1fd
MN
34ifeq ($(AMR_WB),yes)
35OBJS+= amr.o amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
36 amrwb_float/dec_if.o amrwb_float/dec_lpc.o amrwb_float/dec_main.o \
37 amrwb_float/dec_rom.o amrwb_float/dec_util.o amrwb_float/enc_acelp.o \
38 amrwb_float/enc_dtx.o amrwb_float/enc_gain.o amrwb_float/enc_if.o \
39 amrwb_float/enc_lpc.o amrwb_float/enc_main.o amrwb_float/enc_rom.o \
40 amrwb_float/enc_util.o amrwb_float/if_rom.o
41endif
42CLEANAMRWB=cleanamrwbfloat
980fc7b8 43ASM_OBJS=
de6d9b64 44
1d0d55da
MN
45# codecs which are patented in some non free countries like the us
46ifeq ($(CONFIG_RISKY),yes)
deabd4fd 47OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
1d0d55da
MN
48endif
49
4f1bb8a9
IK
50ifeq ($(HAVE_XVMC_ACCEL),yes)
51OBJS+= xvmcvideo.o
52endif
53
57514323 54# currently using liba52 for ac3 decoding
d771bcae 55ifeq ($(CONFIG_AC3),yes)
57514323 56OBJS+= a52dec.o
57514323
ZK
57
58# using builtin liba52 or runtime linked liba52.so.0
ff4ec49e 59ifneq ($(CONFIG_A52BIN),yes)
57514323 60OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
521221cf 61 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
d771bcae 62endif
ff4ec49e 63endif
de6d9b64 64
280bd7b7
ZK
65ifeq ($(CONFIG_FAAD),yes)
66OBJS+= faad.o
445ad18d
ZK
67ifeq ($(CONFIG_FAADBIN),yes)
68# no libs needed
69else
70EXTRALIBS += -lfaad
71endif
280bd7b7
ZK
72endif
73
bba9b16c
MN
74ifeq ($(CONFIG_PP),yes)
75ifeq ($(SHARED_PP),yes)
76EXTRALIBS += -lpostproc
77else
78# LIBS += libpostproc/libpostproc.a ... should be fixed
79OBJS += libpostproc/postprocess.o
80endif
81endif
82
5798368b
J
83ifeq ($(CONFIG_MP3LAME),yes)
84OBJS += mp3lameaudio.o
2a2a98c0 85EXTRALIBS += -lmp3lame
5798368b
J
86endif
87
81e0d0b4
MH
88ifeq ($(CONFIG_VORBIS),yes)
89OBJS += oggvorbis.o
90EXTRALIBS += -lvorbis -lvorbisenc
91endif
92
43f1708f
J
93ifeq ($(TARGET_GPROF),yes)
94CFLAGS+=-p
95LDFLAGS+=-p
96endif
97
de6d9b64 98# i386 mmx specific stuff
980fc7b8 99ifeq ($(TARGET_MMX),yes)
4300403e 100OBJS += i386/fdct_mmx.o i386/cputest.o \
de1ee36a 101 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
57514323 102 i386/idct_mmx.o i386/motion_est_mmx.o \
923ceff8 103 i386/simple_idct_mmx.o i386/fft_sse.o
a968e365
FB
104ifdef TARGET_BUILTIN_VECTOR
105i386/fft_sse.o: CFLAGS+= -msse
106endif
de6d9b64
FB
107endif
108
3d03c0a2
FB
109# armv4l specific stuff
110ifeq ($(TARGET_ARCH_ARMV4L),yes)
bd7d1ea7 111ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
676e200c 112OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
3d03c0a2
FB
113endif
114
c34270f5
FB
115# sun mediaLib specific stuff
116# currently only works when libavcodec is used in mplayer
117ifeq ($(HAVE_MLIB),yes)
118OBJS += mlib/dsputil_mlib.o
119CFLAGS += $(MLIB_INC)
120endif
121
1e98dffb
NK
122# alpha specific stuff
123ifeq ($(TARGET_ARCH_ALPHA),yes)
8b313a47
FH
124OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
125 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
f9bb4bdf 126ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
0af65aac 127CFLAGS += -fforce-addr -freduce-all-givs
1e98dffb
NK
128endif
129
59925ef2 130ifeq ($(TARGET_ARCH_POWERPC),yes)
05c4072b 131OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
ab6c65f6
BF
132endif
133
d46aba26 134ifeq ($(TARGET_MMI),yes)
5917d17c 135OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
d46aba26
LS
136endif
137
ab6c65f6 138ifeq ($(TARGET_ALTIVEC),yes)
8d268a7d 139OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
e629ab68 140 ppc/fft_altivec.o ppc/gmc_altivec.o
59925ef2
BF
141endif
142
0c6bd2ea
B
143ifeq ($(TARGET_ARCH_SH4),yes)
144OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
145endif
146
147
bb7d4939 148SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
ff4ec49e 149OBJS := $(OBJS) $(ASM_OBJS)
980fc7b8 150
f3ec2d46 151LIB= $(LIBPREF)avcodec$(LIBSUF)
0fd94442 152ifeq ($(BUILD_SHARED),yes)
f3ec2d46 153SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
0fd94442 154endif
6d2abd6b 155TESTS= imgresample-test dct-test motion-test fft-test
de6d9b64 156
0fd94442 157all: $(LIB) $(SLIB)
ff4ec49e 158
bc634f6f
ZK
159amrlibs:
160 $(MAKE) -C amr spclib fipoplib
161
c10e9f70 162tests: apiexample cpuid_test $(TESTS)
de6d9b64 163
bc634f6f 164$(LIB): $(OBJS) $(AMRLIBS)
de6d9b64 165 rm -f $@
bc634f6f 166 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
be7109c1 167 $(RANLIB) $@
ff4ec49e 168
811b32ed 169$(SLIB): $(OBJS)
cf7412b5
FB
170ifeq ($(CONFIG_WIN32),yes)
171 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
172 -lib /machine:i386 /def:$(@:.dll=.def)
173else
bc634f6f 174 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
cf7412b5 175endif
de6d9b64
FB
176
177dsputil.o: dsputil.c dsputil.h
178
bba9b16c
MN
179libpostproc/libpostproc.a:
180 $(MAKE) -C libpostproc
181
de6d9b64
FB
182%.o: %.c
183 $(CC) $(CFLAGS) -c -o $@ $<
184
3d03c0a2
FB
185%.o: %.S
186 $(CC) $(CFLAGS) -c -o $@ $<
187
811b32ed 188depend: $(SRCS)
a968e365 189 $(CC) -MM $(CFLAGS) $^ 1>.depend
e51d4def 190
980fc7b8
FB
191dep: depend
192
bc634f6f 193clean: $(CLEANAMR)
77b71ddc 194 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
3d03c0a2 195 armv4l/*.o armv4l/*~ \
c34270f5 196 mlib/*.o mlib/*~ \
1e98dffb 197 alpha/*.o alpha/*~ \
59925ef2 198 ppc/*.o ppc/*~ \
d46aba26 199 ps2/*.o ps2/*~ \
0c6bd2ea 200 sh4/*.o sh4/*~ \
57514323
ZK
201 liba52/*.o liba52/*~ \
202 apiexample $(TESTS)
64094f37 203 $(MAKE) -C libpostproc clean
de6d9b64 204
800d7ceb 205distclean: clean
980fc7b8
FB
206 rm -f Makefile.bak .depend
207
bc634f6f
ZK
208cleanamr:
209 $(MAKE) -C amr clean
210
211cleanamrfloat:
212 rm -f amr_float/*.o
213
d663a1fd
MN
214cleanamrwbfloat:
215 $(MAKE) -C amrwb_float -f makefile.gcc clean
216
de6d9b64
FB
217# api example program
218apiexample: apiexample.c $(LIB)
cfda33cb 219 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
de6d9b64 220
c10e9f70
NK
221# cpuid test
222cpuid_test: i386/cputest.c
223 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
224
de6d9b64
FB
225# testing progs
226
227imgresample-test: imgresample.c
6acce86b 228 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
de6d9b64 229
9ebc63a9 230dct-test: dct-test.o fdctref.o $(LIB)
90cee0c3 231 $(CC) -o $@ $^ -lm
d771bcae 232
4300403e 233motion-test: motion_test.o $(LIB)
6acce86b 234 $(CC) -o $@ $^ -lm
4300403e 235
923ceff8 236fft-test: fft-test.o $(LIB)
6d2abd6b
FB
237 $(CC) -o $@ $^ -lm
238
0fd94442 239ifeq ($(BUILD_SHARED),yes)
cb728d79
FB
240install: all install-headers
241ifeq ($(CONFIG_WIN32),yes)
242 install -s -m 755 $(SLIB) "$(prefix)"
243else
c1325d18 244 install -d $(prefix)/lib
ff4ec49e 245 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
c1325d18
VM
246 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
247 ldconfig || true
cb728d79
FB
248endif
249else
250install:
0fd94442 251endif
773cefc6 252
cb728d79 253installlib: all install-headers
773cefc6 254 install -m 644 $(LIB) $(prefix)/lib
cb728d79
FB
255
256install-headers:
257 mkdir -p "$(prefix)/include/ffmpeg"
773cefc6 258 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
cb728d79 259 "$(prefix)/include/ffmpeg"
773cefc6 260
d771bcae
FB
261#
262# include dependency files if they exist
263#
264ifneq ($(wildcard .depend),)
265include .depend
266endif