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