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