double free patch by (Måns Rullgård <mru inprovide com>)
[libav.git] / libavcodec / Makefile
CommitLineData
4cc281d9
FB
1#
2# libavcodec Makefile
6d6d7970 3# (c) 2000-2005 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
2a515c08 10CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE $(AMR_CFLAGS)
de6d9b64 11
caa336b4 12OBJS= bitstream.o utils.o mem.o allcodecs.o \
1d0d55da 13 mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
7b1fa7db 14 mpegaudio.o ac3enc.o mjpeg.o resample.o resample2.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 \
40c5fa26 18 fft.o mdct.o mace.o huffyuv.o cyuv.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 \
2fdf638b 20 roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o \
11e29a41 21 msvideo1.o vqavideo.o idcinvideo.o adx.o rational.o faandct.o 8bps.o \
ac2570a8 22 smc.o parser.o flicvideo.o truemotion1.o vmdav.o lcl.o qtrle.o g726.o \
d08d7142 23 flac.o vp3dsp.o integer.o snow.o tscc.o sonic.o ulti.o h264idct.o \
fe533bb3 24 qdrw.o xl.o rangecoder.o png.o pnm.o qpeg.o vc9.o h263.o h261.o \
6d6d7970
MM
25 msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o shorten.o loco.o \
26 alac.o
891f64b3 27
4d4bb927 28AMROBJS=
891f64b3 29ifeq ($(AMR_NB),yes)
bc634f6f 30ifeq ($(AMR_NB_FIXED),yes)
4d4bb927 31AMROBJS= amr.o
bc634f6f
ZK
32AMREXTRALIBS+= amr/*.o
33AMRLIBS=amrlibs
34CLEANAMR=cleanamr
35else
4d4bb927
RT
36AMROBJS= amr.o
37OBJS+= amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
bc634f6f
ZK
38CLEANAMR=cleanamrfloat
39endif
891f64b3 40endif
41
9c3d33d6
MN
42ifeq ($(HAVE_PTHREADS),yes)
43OBJS+= pthread.o
44endif
45
16806499
MN
46ifeq ($(HAVE_W32THREADS),yes)
47OBJS+= w32thread.o
48endif
49
2450cff2
FR
50ifeq ($(HAVE_BEOSTHREADS),yes)
51OBJS+= beosthread.o
52endif
53
d663a1fd 54ifeq ($(AMR_WB),yes)
4d4bb927
RT
55AMROBJS= amr.o
56OBJS+= amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
d663a1fd
MN
57 amrwb_float/dec_if.o amrwb_float/dec_lpc.o amrwb_float/dec_main.o \
58 amrwb_float/dec_rom.o amrwb_float/dec_util.o amrwb_float/enc_acelp.o \
59 amrwb_float/enc_dtx.o amrwb_float/enc_gain.o amrwb_float/enc_if.o \
60 amrwb_float/enc_lpc.o amrwb_float/enc_main.o amrwb_float/enc_rom.o \
61 amrwb_float/enc_util.o amrwb_float/if_rom.o
62endif
4d4bb927 63OBJS+= $(AMROBJS)
d663a1fd 64CLEANAMRWB=cleanamrwbfloat
980fc7b8 65ASM_OBJS=
de6d9b64 66
4f1bb8a9
IK
67ifeq ($(HAVE_XVMC_ACCEL),yes)
68OBJS+= xvmcvideo.o
69endif
70
57514323 71# currently using liba52 for ac3 decoding
d771bcae 72ifeq ($(CONFIG_AC3),yes)
57514323 73OBJS+= a52dec.o
57514323
ZK
74
75# using builtin liba52 or runtime linked liba52.so.0
ff4ec49e 76ifneq ($(CONFIG_A52BIN),yes)
57514323 77OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
521221cf 78 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
d771bcae 79endif
ff4ec49e 80endif
de6d9b64 81
23c99253
MN
82# currently using libdts for dts decoding
83ifeq ($(CONFIG_DTS),yes)
84OBJS+= dtsdec.o
c5c97a8d
MN
85CFLAGS += $(DTS_INC)
86EXTRALIBS += -ldts
23c99253
MN
87endif
88
280bd7b7
ZK
89ifeq ($(CONFIG_FAAD),yes)
90OBJS+= faad.o
445ad18d
ZK
91ifeq ($(CONFIG_FAADBIN),yes)
92# no libs needed
93else
94EXTRALIBS += -lfaad
95endif
280bd7b7
ZK
96endif
97
29d48296
MN
98ifeq ($(CONFIG_FAAC),yes)
99OBJS+= faac.o
100EXTRALIBS += -lfaac
101endif
102
1ddadfa9
AT
103ifeq ($(CONFIG_XVID),yes)
104OBJS+= xvidff.o
105EXTRALIBS += -lxvidcore
106endif
107
bba9b16c
MN
108ifeq ($(CONFIG_PP),yes)
109ifeq ($(SHARED_PP),yes)
91378af4 110EXTRALIBS += -L$(VPATH)/libpostproc -lpostproc
bba9b16c
MN
111else
112# LIBS += libpostproc/libpostproc.a ... should be fixed
113OBJS += libpostproc/postprocess.o
114endif
115endif
116
5798368b
J
117ifeq ($(CONFIG_MP3LAME),yes)
118OBJS += mp3lameaudio.o
2a2a98c0 119EXTRALIBS += -lmp3lame
5798368b
J
120endif
121
5c5dea3f
NB
122ifeq ($(CONFIG_LIBOGG),yes)
123EXTRALIBS += -logg
124ifeq ($(CONFIG_LIBVORBIS),yes)
81e0d0b4
MH
125OBJS += oggvorbis.o
126EXTRALIBS += -lvorbis -lvorbisenc
127endif
5c5dea3f
NB
128ifeq ($(CONFIG_LIBTHEORA), yes)
129OBJS += oggtheora.o
130EXTRALIBS += -ltheora
131endif
132endif
81e0d0b4 133
43f1708f
J
134ifeq ($(TARGET_GPROF),yes)
135CFLAGS+=-p
136LDFLAGS+=-p
137endif
138
de6d9b64 139# i386 mmx specific stuff
980fc7b8 140ifeq ($(TARGET_MMX),yes)
4300403e 141OBJS += i386/fdct_mmx.o i386/cputest.o \
de1ee36a 142 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
57514323 143 i386/idct_mmx.o i386/motion_est_mmx.o \
38acbc3c
MM
144 i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
145 i386/vp3dsp_sse2.o
a968e365
FB
146ifdef TARGET_BUILTIN_VECTOR
147i386/fft_sse.o: CFLAGS+= -msse
148beec7 148depend: CFLAGS+= -msse
a968e365 149endif
de6d9b64
FB
150endif
151
3d03c0a2
FB
152# armv4l specific stuff
153ifeq ($(TARGET_ARCH_ARMV4L),yes)
bd7d1ea7 154ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
676e200c 155OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
3d03c0a2
FB
156endif
157
c34270f5
FB
158# sun mediaLib specific stuff
159# currently only works when libavcodec is used in mplayer
160ifeq ($(HAVE_MLIB),yes)
161OBJS += mlib/dsputil_mlib.o
162CFLAGS += $(MLIB_INC)
163endif
164
1e98dffb
NK
165# alpha specific stuff
166ifeq ($(TARGET_ARCH_ALPHA),yes)
8b313a47
FH
167OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
168 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
f9bb4bdf 169ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
647b610c 170CFLAGS += -fforce-addr
1e98dffb
NK
171endif
172
59925ef2 173ifeq ($(TARGET_ARCH_POWERPC),yes)
05c4072b 174OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
ab6c65f6
BF
175endif
176
d46aba26 177ifeq ($(TARGET_MMI),yes)
5917d17c 178OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
d46aba26
LS
179endif
180
ab6c65f6 181ifeq ($(TARGET_ALTIVEC),yes)
8d268a7d 182OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
a6a12a8a
RD
183 ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o \
184 ppc/dsputil_h264_altivec.o
59925ef2
BF
185endif
186
0c6bd2ea
B
187ifeq ($(TARGET_ARCH_SH4),yes)
188OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
189endif
190
bb476ff3 191ifeq ($(TARGET_ARCH_SPARC),yes)
44f54ceb 192OBJS+=sparc/dsputil_vis.o
bb476ff3
JM
193sparc/%.o: sparc/%.c
194 $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $<
195endif
196ifeq ($(TARGET_ARCH_SPARC64),yes)
44f54ceb
MN
197CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
198endif
199
bb7d4939 200SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
ff4ec49e 201OBJS := $(OBJS) $(ASM_OBJS)
980fc7b8 202
f3ec2d46 203LIB= $(LIBPREF)avcodec$(LIBSUF)
0fd94442 204ifeq ($(BUILD_SHARED),yes)
f3ec2d46 205SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
0fd94442 206endif
6d2abd6b 207TESTS= imgresample-test dct-test motion-test fft-test
de6d9b64 208
0fd94442 209all: $(LIB) $(SLIB)
ff4ec49e 210
bc634f6f
ZK
211amrlibs:
212 $(MAKE) -C amr spclib fipoplib
213
c10e9f70 214tests: apiexample cpuid_test $(TESTS)
de6d9b64 215
bc634f6f 216$(LIB): $(OBJS) $(AMRLIBS)
de6d9b64 217 rm -f $@
bc634f6f 218 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
be7109c1 219 $(RANLIB) $@
ff4ec49e 220
811b32ed 221$(SLIB): $(OBJS)
91378af4 222ifeq ($(CONFIG_PP),yes)
8b8e1c55 223 $(MAKE) -C libpostproc
91378af4 224endif
cf7412b5
FB
225ifeq ($(CONFIG_WIN32),yes)
226 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
227 -lib /machine:i386 /def:$(@:.dll=.def)
228else
1b8b121f 229 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS) $(LDFLAGS)
cf7412b5 230endif
de6d9b64
FB
231
232dsputil.o: dsputil.c dsputil.h
233
bba9b16c
MN
234libpostproc/libpostproc.a:
235 $(MAKE) -C libpostproc
236
de6d9b64
FB
237%.o: %.c
238 $(CC) $(CFLAGS) -c -o $@ $<
239
3d03c0a2
FB
240%.o: %.S
241 $(CC) $(CFLAGS) -c -o $@ $<
242
811b32ed 243depend: $(SRCS)
a968e365 244 $(CC) -MM $(CFLAGS) $^ 1>.depend
e51d4def 245
980fc7b8
FB
246dep: depend
247
bc634f6f 248clean: $(CLEANAMR)
77b71ddc 249 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
3d03c0a2 250 armv4l/*.o armv4l/*~ \
c34270f5 251 mlib/*.o mlib/*~ \
1e98dffb 252 alpha/*.o alpha/*~ \
59925ef2 253 ppc/*.o ppc/*~ \
d46aba26 254 ps2/*.o ps2/*~ \
0c6bd2ea 255 sh4/*.o sh4/*~ \
bb476ff3 256 sparc/*.o sparc/*~ \
57514323
ZK
257 liba52/*.o liba52/*~ \
258 apiexample $(TESTS)
64094f37 259 $(MAKE) -C libpostproc clean
de6d9b64 260
800d7ceb 261distclean: clean
980fc7b8
FB
262 rm -f Makefile.bak .depend
263
bc634f6f
ZK
264cleanamr:
265 $(MAKE) -C amr clean
266
267cleanamrfloat:
268 rm -f amr_float/*.o
269
d663a1fd
MN
270cleanamrwbfloat:
271 $(MAKE) -C amrwb_float -f makefile.gcc clean
272
de6d9b64
FB
273# api example program
274apiexample: apiexample.c $(LIB)
cfda33cb 275 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
de6d9b64 276
c10e9f70
NK
277# cpuid test
278cpuid_test: i386/cputest.c
279 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
280
de6d9b64
FB
281# testing progs
282
283imgresample-test: imgresample.c
6acce86b 284 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
de6d9b64 285
9ebc63a9 286dct-test: dct-test.o fdctref.o $(LIB)
90cee0c3 287 $(CC) -o $@ $^ -lm
d771bcae 288
4300403e 289motion-test: motion_test.o $(LIB)
6acce86b 290 $(CC) -o $@ $^ -lm
4300403e 291
923ceff8 292fft-test: fft-test.o $(LIB)
6d2abd6b
FB
293 $(CC) -o $@ $^ -lm
294
0fd94442 295ifeq ($(BUILD_SHARED),yes)
cb728d79
FB
296install: all install-headers
297ifeq ($(CONFIG_WIN32),yes)
65d1bea2 298 install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
cb728d79 299else
c1325d18 300 install -d $(prefix)/lib
65d1bea2 301 install $(INSTALLSTRIP) -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
c1325d18
VM
302 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
303 ldconfig || true
cb728d79 304endif
91378af4 305ifeq ($(CONFIG_PP),yes)
8b8e1c55 306 $(MAKE) -C libpostproc $@
91378af4 307endif
cb728d79
FB
308else
309install:
0fd94442 310endif
773cefc6 311
cb728d79 312installlib: all install-headers
f14d4e7e 313 install -m 644 $(LIB) "$(prefix)/lib"
cb728d79
FB
314
315install-headers:
316 mkdir -p "$(prefix)/include/ffmpeg"
07bd15c3
FR
317 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
318 $(SRC_PATH)/libavcodec/common.h \
319 $(SRC_PATH)/libavcodec/rational.h \
cb728d79 320 "$(prefix)/include/ffmpeg"
773cefc6 321
d771bcae
FB
322#
323# include dependency files if they exist
324#
325ifneq ($(wildcard .depend),)
326include .depend
327endif