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