libdts support by (Benjamin Zores <ben at geexbox dot org>)
[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
cf9d24ad 10CFLAGS=$(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\
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 \
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 \
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 \
29adde83 23 flac.o vp3dsp.o integer.o
891f64b3 24
25ifeq ($(AMR_NB),yes)
bc634f6f 26ifeq ($(AMR_NB_FIXED),yes)
891f64b3 27OBJS+= amr.o
bc634f6f
ZK
28AMREXTRALIBS+= amr/*.o
29AMRLIBS=amrlibs
30CLEANAMR=cleanamr
31else
32OBJS+= amr.o amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
33CLEANAMR=cleanamrfloat
34endif
891f64b3 35endif
36
9c3d33d6
MN
37ifeq ($(HAVE_PTHREADS),yes)
38OBJS+= pthread.o
39endif
40
16806499
MN
41ifeq ($(HAVE_W32THREADS),yes)
42OBJS+= w32thread.o
43endif
44
d663a1fd
MN
45ifeq ($(AMR_WB),yes)
46OBJS+= amr.o amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
47 amrwb_float/dec_if.o amrwb_float/dec_lpc.o amrwb_float/dec_main.o \
48 amrwb_float/dec_rom.o amrwb_float/dec_util.o amrwb_float/enc_acelp.o \
49 amrwb_float/enc_dtx.o amrwb_float/enc_gain.o amrwb_float/enc_if.o \
50 amrwb_float/enc_lpc.o amrwb_float/enc_main.o amrwb_float/enc_rom.o \
51 amrwb_float/enc_util.o amrwb_float/if_rom.o
52endif
53CLEANAMRWB=cleanamrwbfloat
980fc7b8 54ASM_OBJS=
de6d9b64 55
1d0d55da
MN
56# codecs which are patented in some non free countries like the us
57ifeq ($(CONFIG_RISKY),yes)
c6148de2 58OBJS+= h263.o h261.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
1d0d55da
MN
59endif
60
4f1bb8a9
IK
61ifeq ($(HAVE_XVMC_ACCEL),yes)
62OBJS+= xvmcvideo.o
63endif
64
57514323 65# currently using liba52 for ac3 decoding
d771bcae 66ifeq ($(CONFIG_AC3),yes)
57514323 67OBJS+= a52dec.o
57514323
ZK
68
69# using builtin liba52 or runtime linked liba52.so.0
ff4ec49e 70ifneq ($(CONFIG_A52BIN),yes)
57514323 71OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
521221cf 72 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
d771bcae 73endif
ff4ec49e 74endif
de6d9b64 75
23c99253
MN
76# currently using libdts for dts decoding
77ifeq ($(CONFIG_DTS),yes)
78OBJS+= dtsdec.o
79endif
80
280bd7b7
ZK
81ifeq ($(CONFIG_FAAD),yes)
82OBJS+= faad.o
445ad18d
ZK
83ifeq ($(CONFIG_FAADBIN),yes)
84# no libs needed
85else
86EXTRALIBS += -lfaad
87endif
280bd7b7
ZK
88endif
89
29d48296
MN
90ifeq ($(CONFIG_FAAC),yes)
91OBJS+= faac.o
92EXTRALIBS += -lfaac
93endif
94
bba9b16c
MN
95ifeq ($(CONFIG_PP),yes)
96ifeq ($(SHARED_PP),yes)
97EXTRALIBS += -lpostproc
98else
99# LIBS += libpostproc/libpostproc.a ... should be fixed
100OBJS += libpostproc/postprocess.o
101endif
102endif
103
5798368b
J
104ifeq ($(CONFIG_MP3LAME),yes)
105OBJS += mp3lameaudio.o
2a2a98c0 106EXTRALIBS += -lmp3lame
5798368b
J
107endif
108
81e0d0b4
MH
109ifeq ($(CONFIG_VORBIS),yes)
110OBJS += oggvorbis.o
111EXTRALIBS += -lvorbis -lvorbisenc
112endif
113
43f1708f
J
114ifeq ($(TARGET_GPROF),yes)
115CFLAGS+=-p
116LDFLAGS+=-p
117endif
118
de6d9b64 119# i386 mmx specific stuff
980fc7b8 120ifeq ($(TARGET_MMX),yes)
4300403e 121OBJS += i386/fdct_mmx.o i386/cputest.o \
de1ee36a 122 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
57514323 123 i386/idct_mmx.o i386/motion_est_mmx.o \
38acbc3c
MM
124 i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
125 i386/vp3dsp_sse2.o
a968e365
FB
126ifdef TARGET_BUILTIN_VECTOR
127i386/fft_sse.o: CFLAGS+= -msse
148beec7 128depend: CFLAGS+= -msse
a968e365 129endif
de6d9b64
FB
130endif
131
3d03c0a2
FB
132# armv4l specific stuff
133ifeq ($(TARGET_ARCH_ARMV4L),yes)
bd7d1ea7 134ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
676e200c 135OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
3d03c0a2
FB
136endif
137
c34270f5
FB
138# sun mediaLib specific stuff
139# currently only works when libavcodec is used in mplayer
140ifeq ($(HAVE_MLIB),yes)
141OBJS += mlib/dsputil_mlib.o
142CFLAGS += $(MLIB_INC)
143endif
144
1e98dffb
NK
145# alpha specific stuff
146ifeq ($(TARGET_ARCH_ALPHA),yes)
8b313a47
FH
147OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
148 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
f9bb4bdf 149ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
0af65aac 150CFLAGS += -fforce-addr -freduce-all-givs
1e98dffb
NK
151endif
152
59925ef2 153ifeq ($(TARGET_ARCH_POWERPC),yes)
05c4072b 154OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
ab6c65f6
BF
155endif
156
d46aba26 157ifeq ($(TARGET_MMI),yes)
5917d17c 158OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
d46aba26
LS
159endif
160
ab6c65f6 161ifeq ($(TARGET_ALTIVEC),yes)
8d268a7d 162OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
14cabd40 163 ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o
59925ef2
BF
164endif
165
0c6bd2ea
B
166ifeq ($(TARGET_ARCH_SH4),yes)
167OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
168endif
169
bb476ff3 170ifeq ($(TARGET_ARCH_SPARC),yes)
44f54ceb 171OBJS+=sparc/dsputil_vis.o
bb476ff3
JM
172sparc/%.o: sparc/%.c
173 $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $<
174endif
175ifeq ($(TARGET_ARCH_SPARC64),yes)
44f54ceb
MN
176CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
177endif
178
bb7d4939 179SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
ff4ec49e 180OBJS := $(OBJS) $(ASM_OBJS)
980fc7b8 181
f3ec2d46 182LIB= $(LIBPREF)avcodec$(LIBSUF)
0fd94442 183ifeq ($(BUILD_SHARED),yes)
f3ec2d46 184SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
0fd94442 185endif
6d2abd6b 186TESTS= imgresample-test dct-test motion-test fft-test
de6d9b64 187
0fd94442 188all: $(LIB) $(SLIB)
ff4ec49e 189
bc634f6f
ZK
190amrlibs:
191 $(MAKE) -C amr spclib fipoplib
192
c10e9f70 193tests: apiexample cpuid_test $(TESTS)
de6d9b64 194
bc634f6f 195$(LIB): $(OBJS) $(AMRLIBS)
de6d9b64 196 rm -f $@
bc634f6f 197 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
be7109c1 198 $(RANLIB) $@
ff4ec49e 199
811b32ed 200$(SLIB): $(OBJS)
cf7412b5
FB
201ifeq ($(CONFIG_WIN32),yes)
202 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
203 -lib /machine:i386 /def:$(@:.dll=.def)
204else
1b8b121f 205 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS) $(LDFLAGS)
cf7412b5 206endif
de6d9b64
FB
207
208dsputil.o: dsputil.c dsputil.h
209
bba9b16c
MN
210libpostproc/libpostproc.a:
211 $(MAKE) -C libpostproc
212
de6d9b64
FB
213%.o: %.c
214 $(CC) $(CFLAGS) -c -o $@ $<
215
3d03c0a2
FB
216%.o: %.S
217 $(CC) $(CFLAGS) -c -o $@ $<
218
811b32ed 219depend: $(SRCS)
a968e365 220 $(CC) -MM $(CFLAGS) $^ 1>.depend
e51d4def 221
980fc7b8
FB
222dep: depend
223
bc634f6f 224clean: $(CLEANAMR)
77b71ddc 225 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
3d03c0a2 226 armv4l/*.o armv4l/*~ \
c34270f5 227 mlib/*.o mlib/*~ \
1e98dffb 228 alpha/*.o alpha/*~ \
59925ef2 229 ppc/*.o ppc/*~ \
d46aba26 230 ps2/*.o ps2/*~ \
0c6bd2ea 231 sh4/*.o sh4/*~ \
bb476ff3 232 sparc/*.o sparc/*~ \
57514323
ZK
233 liba52/*.o liba52/*~ \
234 apiexample $(TESTS)
64094f37 235 $(MAKE) -C libpostproc clean
de6d9b64 236
800d7ceb 237distclean: clean
980fc7b8
FB
238 rm -f Makefile.bak .depend
239
bc634f6f
ZK
240cleanamr:
241 $(MAKE) -C amr clean
242
243cleanamrfloat:
244 rm -f amr_float/*.o
245
d663a1fd
MN
246cleanamrwbfloat:
247 $(MAKE) -C amrwb_float -f makefile.gcc clean
248
de6d9b64
FB
249# api example program
250apiexample: apiexample.c $(LIB)
cfda33cb 251 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
de6d9b64 252
c10e9f70
NK
253# cpuid test
254cpuid_test: i386/cputest.c
255 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
256
de6d9b64
FB
257# testing progs
258
259imgresample-test: imgresample.c
6acce86b 260 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
de6d9b64 261
9ebc63a9 262dct-test: dct-test.o fdctref.o $(LIB)
90cee0c3 263 $(CC) -o $@ $^ -lm
d771bcae 264
4300403e 265motion-test: motion_test.o $(LIB)
6acce86b 266 $(CC) -o $@ $^ -lm
4300403e 267
923ceff8 268fft-test: fft-test.o $(LIB)
6d2abd6b
FB
269 $(CC) -o $@ $^ -lm
270
0fd94442 271ifeq ($(BUILD_SHARED),yes)
cb728d79
FB
272install: all install-headers
273ifeq ($(CONFIG_WIN32),yes)
274 install -s -m 755 $(SLIB) "$(prefix)"
275else
c1325d18 276 install -d $(prefix)/lib
ff4ec49e 277 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
c1325d18
VM
278 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
279 ldconfig || true
cb728d79
FB
280endif
281else
282install:
0fd94442 283endif
773cefc6 284
cb728d79 285installlib: all install-headers
773cefc6 286 install -m 644 $(LIB) $(prefix)/lib
cb728d79
FB
287
288install-headers:
289 mkdir -p "$(prefix)/include/ffmpeg"
07bd15c3
FR
290 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
291 $(SRC_PATH)/libavcodec/common.h \
292 $(SRC_PATH)/libavcodec/rational.h \
cb728d79 293 "$(prefix)/include/ffmpeg"
773cefc6 294
d771bcae
FB
295#
296# include dependency files if they exist
297#
298ifneq ($(wildcard .depend),)
299include .depend
300endif