also put the CONFIG_FOOBAR_EN/DECODER stuff in config.mak
[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 25 msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o shorten.o loco.o \
856dbbff 26 alac.o wnv1.o ws-snd1.o aasc.o indeo2.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
6662ec29
MN
108ifeq ($(CONFIG_X264),yes)
109OBJS+= x264.o
7c653cc9 110EXTRALIBS += -lx264
6662ec29
MN
111endif
112
bba9b16c
MN
113ifeq ($(CONFIG_PP),yes)
114ifeq ($(SHARED_PP),yes)
91378af4 115EXTRALIBS += -L$(VPATH)/libpostproc -lpostproc
bba9b16c
MN
116else
117# LIBS += libpostproc/libpostproc.a ... should be fixed
118OBJS += libpostproc/postprocess.o
119endif
120endif
121
5798368b
J
122ifeq ($(CONFIG_MP3LAME),yes)
123OBJS += mp3lameaudio.o
2a2a98c0 124EXTRALIBS += -lmp3lame
5798368b
J
125endif
126
5c5dea3f 127ifeq ($(CONFIG_LIBOGG),yes)
5c5dea3f 128ifeq ($(CONFIG_LIBVORBIS),yes)
81e0d0b4 129OBJS += oggvorbis.o
078a8dd6 130EXTRALIBS += -lvorbisenc -lvorbis
81e0d0b4 131endif
5c5dea3f
NB
132ifeq ($(CONFIG_LIBTHEORA), yes)
133OBJS += oggtheora.o
134EXTRALIBS += -ltheora
135endif
078a8dd6 136EXTRALIBS += -logg
5c5dea3f 137endif
81e0d0b4 138
43f1708f
J
139ifeq ($(TARGET_GPROF),yes)
140CFLAGS+=-p
141LDFLAGS+=-p
142endif
143
de6d9b64 144# i386 mmx specific stuff
980fc7b8 145ifeq ($(TARGET_MMX),yes)
4300403e 146OBJS += i386/fdct_mmx.o i386/cputest.o \
de1ee36a 147 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
57514323 148 i386/idct_mmx.o i386/motion_est_mmx.o \
38acbc3c
MM
149 i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
150 i386/vp3dsp_sse2.o
a968e365
FB
151ifdef TARGET_BUILTIN_VECTOR
152i386/fft_sse.o: CFLAGS+= -msse
148beec7 153depend: CFLAGS+= -msse
a968e365 154endif
de6d9b64
FB
155endif
156
3d03c0a2
FB
157# armv4l specific stuff
158ifeq ($(TARGET_ARCH_ARMV4L),yes)
bd7d1ea7 159ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
676e200c 160OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
3d03c0a2
FB
161endif
162
c34270f5
FB
163# sun mediaLib specific stuff
164# currently only works when libavcodec is used in mplayer
165ifeq ($(HAVE_MLIB),yes)
166OBJS += mlib/dsputil_mlib.o
167CFLAGS += $(MLIB_INC)
168endif
169
1e98dffb
NK
170# alpha specific stuff
171ifeq ($(TARGET_ARCH_ALPHA),yes)
8b313a47
FH
172OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
173 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
f9bb4bdf 174ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
647b610c 175CFLAGS += -fforce-addr
1e98dffb
NK
176endif
177
59925ef2 178ifeq ($(TARGET_ARCH_POWERPC),yes)
05c4072b 179OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
ab6c65f6
BF
180endif
181
d46aba26 182ifeq ($(TARGET_MMI),yes)
5917d17c 183OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
d46aba26
LS
184endif
185
ab6c65f6 186ifeq ($(TARGET_ALTIVEC),yes)
8d268a7d 187OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
a6a12a8a
RD
188 ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o \
189 ppc/dsputil_h264_altivec.o
59925ef2
BF
190endif
191
0c6bd2ea
B
192ifeq ($(TARGET_ARCH_SH4),yes)
193OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
194endif
195
bb476ff3 196ifeq ($(TARGET_ARCH_SPARC),yes)
44f54ceb 197OBJS+=sparc/dsputil_vis.o
bb476ff3
JM
198sparc/%.o: sparc/%.c
199 $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $<
200endif
201ifeq ($(TARGET_ARCH_SPARC64),yes)
44f54ceb
MN
202CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
203endif
204
bb7d4939 205SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
ff4ec49e 206OBJS := $(OBJS) $(ASM_OBJS)
980fc7b8 207
f3ec2d46 208LIB= $(LIBPREF)avcodec$(LIBSUF)
0fd94442 209ifeq ($(BUILD_SHARED),yes)
f3ec2d46 210SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
0fd94442 211endif
6d2abd6b 212TESTS= imgresample-test dct-test motion-test fft-test
de6d9b64 213
0fd94442 214all: $(LIB) $(SLIB)
ff4ec49e 215
bc634f6f
ZK
216amrlibs:
217 $(MAKE) -C amr spclib fipoplib
218
c10e9f70 219tests: apiexample cpuid_test $(TESTS)
de6d9b64 220
bc634f6f 221$(LIB): $(OBJS) $(AMRLIBS)
de6d9b64 222 rm -f $@
bc634f6f 223 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
be7109c1 224 $(RANLIB) $@
ff4ec49e 225
811b32ed 226$(SLIB): $(OBJS)
91378af4 227ifeq ($(CONFIG_PP),yes)
8b8e1c55 228 $(MAKE) -C libpostproc
91378af4 229endif
cf7412b5
FB
230ifeq ($(CONFIG_WIN32),yes)
231 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
232 -lib /machine:i386 /def:$(@:.dll=.def)
233else
1b8b121f 234 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS) $(LDFLAGS)
cf7412b5 235endif
de6d9b64
FB
236
237dsputil.o: dsputil.c dsputil.h
238
bba9b16c
MN
239libpostproc/libpostproc.a:
240 $(MAKE) -C libpostproc
241
de6d9b64
FB
242%.o: %.c
243 $(CC) $(CFLAGS) -c -o $@ $<
244
3d03c0a2
FB
245%.o: %.S
246 $(CC) $(CFLAGS) -c -o $@ $<
247
811b32ed 248depend: $(SRCS)
a968e365 249 $(CC) -MM $(CFLAGS) $^ 1>.depend
e51d4def 250
980fc7b8
FB
251dep: depend
252
bc634f6f 253clean: $(CLEANAMR)
77b71ddc 254 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
3d03c0a2 255 armv4l/*.o armv4l/*~ \
c34270f5 256 mlib/*.o mlib/*~ \
1e98dffb 257 alpha/*.o alpha/*~ \
59925ef2 258 ppc/*.o ppc/*~ \
d46aba26 259 ps2/*.o ps2/*~ \
0c6bd2ea 260 sh4/*.o sh4/*~ \
bb476ff3 261 sparc/*.o sparc/*~ \
57514323
ZK
262 liba52/*.o liba52/*~ \
263 apiexample $(TESTS)
64094f37 264 $(MAKE) -C libpostproc clean
de6d9b64 265
800d7ceb 266distclean: clean
980fc7b8
FB
267 rm -f Makefile.bak .depend
268
bc634f6f
ZK
269cleanamr:
270 $(MAKE) -C amr clean
271
272cleanamrfloat:
273 rm -f amr_float/*.o
274
d663a1fd
MN
275cleanamrwbfloat:
276 $(MAKE) -C amrwb_float -f makefile.gcc clean
277
de6d9b64
FB
278# api example program
279apiexample: apiexample.c $(LIB)
cfda33cb 280 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
de6d9b64 281
c10e9f70
NK
282# cpuid test
283cpuid_test: i386/cputest.c
284 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
285
de6d9b64
FB
286# testing progs
287
288imgresample-test: imgresample.c
6acce86b 289 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
de6d9b64 290
9ebc63a9 291dct-test: dct-test.o fdctref.o $(LIB)
90cee0c3 292 $(CC) -o $@ $^ -lm
d771bcae 293
4300403e 294motion-test: motion_test.o $(LIB)
6acce86b 295 $(CC) -o $@ $^ -lm
4300403e 296
923ceff8 297fft-test: fft-test.o $(LIB)
6d2abd6b
FB
298 $(CC) -o $@ $^ -lm
299
0fd94442 300ifeq ($(BUILD_SHARED),yes)
cb728d79
FB
301install: all install-headers
302ifeq ($(CONFIG_WIN32),yes)
65d1bea2 303 install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
cb728d79 304else
cc973ecb
LB
305 install -d $(libdir)
306 install $(INSTALLSTRIP) -m 755 $(SLIB) $(libdir)/libavcodec-$(VERSION).so
307 ln -sf libavcodec-$(VERSION).so $(libdir)/libavcodec.so
c1325d18 308 ldconfig || true
cb728d79 309endif
91378af4 310ifeq ($(CONFIG_PP),yes)
8b8e1c55 311 $(MAKE) -C libpostproc $@
91378af4 312endif
cb728d79
FB
313else
314install:
0fd94442 315endif
773cefc6 316
cb728d79 317installlib: all install-headers
cc973ecb 318 install -m 644 $(LIB) "$(libdir)"
cb728d79
FB
319
320install-headers:
321 mkdir -p "$(prefix)/include/ffmpeg"
07bd15c3
FR
322 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
323 $(SRC_PATH)/libavcodec/common.h \
324 $(SRC_PATH)/libavcodec/rational.h \
cb728d79 325 "$(prefix)/include/ffmpeg"
773cefc6 326
d771bcae
FB
327#
328# include dependency files if they exist
329#
330ifneq ($(wildcard .depend),)
331include .depend
332endif