os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
[libav.git] / libavcodec / Makefile
CommitLineData
4cc281d9
FB
1#
2# libavcodec Makefile
ff4ec49e 3# (c) 2000, 2001, 2002 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
eddbd7e5 10CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
de6d9b64
FB
11LDFLAGS= -g
12
773cefc6 13OBJS= common.o utils.o mem.o allcodecs.o \
28db7fce 14 mpegvideo.o h263.o jrevdct.o jfdctfst.o jfdctint.o\
10b7b472 15 mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
de6d9b64 16 motion_est.o imgconvert.o imgresample.o msmpeg4.o \
be8ffec9 17 mpeg12.o h263dec.o svq1.o rv10.o mpegaudiodec.o pcm.o simple_idct.o \
6d2abd6b 18 ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
11f18faf 19 wmadec.o fft.o mdct.o mace.o huffyuv.o
980fc7b8 20ASM_OBJS=
de6d9b64 21
57514323 22# currently using liba52 for ac3 decoding
d771bcae 23ifeq ($(CONFIG_AC3),yes)
57514323 24OBJS+= a52dec.o
57514323
ZK
25
26# using builtin liba52 or runtime linked liba52.so.0
ff4ec49e 27ifneq ($(CONFIG_A52BIN),yes)
57514323
ZK
28OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
29 liba52/imdct.o liba52/parse.o
d771bcae 30endif
ff4ec49e 31endif
de6d9b64 32
5798368b
J
33ifeq ($(CONFIG_MP3LAME),yes)
34OBJS += mp3lameaudio.o
2a2a98c0 35EXTRALIBS += -lmp3lame
5798368b
J
36endif
37
81e0d0b4
MH
38ifeq ($(CONFIG_VORBIS),yes)
39OBJS += oggvorbis.o
40EXTRALIBS += -lvorbis -lvorbisenc
41endif
42
43f1708f
J
43ifeq ($(TARGET_GPROF),yes)
44CFLAGS+=-p
45LDFLAGS+=-p
46endif
47
de6d9b64 48# i386 mmx specific stuff
980fc7b8 49ifeq ($(TARGET_MMX),yes)
4300403e 50OBJS += i386/fdct_mmx.o i386/cputest.o \
de1ee36a 51 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
57514323 52 i386/idct_mmx.o i386/motion_est_mmx.o \
923ceff8 53 i386/simple_idct_mmx.o i386/fft_sse.o
de6d9b64
FB
54endif
55
3d03c0a2
FB
56# armv4l specific stuff
57ifeq ($(TARGET_ARCH_ARMV4L),yes)
58ASM_OBJS += armv4l/jrevdct_arm.o
676e200c 59OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
3d03c0a2
FB
60endif
61
c34270f5
FB
62# sun mediaLib specific stuff
63# currently only works when libavcodec is used in mplayer
64ifeq ($(HAVE_MLIB),yes)
65OBJS += mlib/dsputil_mlib.o
66CFLAGS += $(MLIB_INC)
67endif
68
1e98dffb
NK
69# alpha specific stuff
70ifeq ($(TARGET_ARCH_ALPHA),yes)
8b313a47
FH
71OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
72 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
f9bb4bdf 73ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
0af65aac 74CFLAGS += -fforce-addr -freduce-all-givs
1e98dffb
NK
75endif
76
59925ef2 77ifeq ($(TARGET_ARCH_POWERPC),yes)
05c4072b 78OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
ab6c65f6
BF
79endif
80
d46aba26 81ifeq ($(TARGET_MMI),yes)
5917d17c 82OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
d46aba26
LS
83endif
84
ab6c65f6 85ifeq ($(TARGET_ALTIVEC),yes)
59925ef2 86CFLAGS += -faltivec
8d268a7d
FB
87OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
88 ppc/fft_altivec.o
59925ef2
BF
89endif
90
bb7d4939 91SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
ff4ec49e 92OBJS := $(OBJS) $(ASM_OBJS)
980fc7b8 93
f3ec2d46 94LIB= $(LIBPREF)avcodec$(LIBSUF)
0fd94442 95ifeq ($(BUILD_SHARED),yes)
f3ec2d46 96SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
0fd94442 97endif
6d2abd6b 98TESTS= imgresample-test dct-test motion-test fft-test
de6d9b64 99
0fd94442 100all: $(LIB) $(SLIB)
ff4ec49e 101
c10e9f70 102tests: apiexample cpuid_test $(TESTS)
de6d9b64 103
ff4ec49e 104$(LIB): $(OBJS)
de6d9b64 105 rm -f $@
be7109c1 106 $(AR) rc $@ $(OBJS)
f3ec2d46 107ifneq ($(CONFIG_OS2),yes)
be7109c1 108 $(RANLIB) $@
f3ec2d46 109endif
ff4ec49e
FB
110
111$(SLIB): $(OBJS)
e1707f52 112 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
de6d9b64
FB
113
114dsputil.o: dsputil.c dsputil.h
115
116%.o: %.c
117 $(CC) $(CFLAGS) -c -o $@ $<
118
3d03c0a2
FB
119%.o: %.S
120 $(CC) $(CFLAGS) -c -o $@ $<
121
0af65aac
FH
122# motion_est_alpha uses the MVI extension, which is not available with
123# -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those
124# cases.
125ifeq ($(TARGET_ARCH_ALPHA),yes)
126alpha/motion_est_alpha.o: alpha/motion_est_alpha.c
127 cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \
128 case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \
129 echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\
130 $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<
131endif
132
980fc7b8
FB
133# depend only used by mplayer now
134dep: depend
135
136depend:
137 $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
138
de6d9b64 139clean:
1ac9248b 140 rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
3d03c0a2 141 armv4l/*.o armv4l/*~ \
c34270f5 142 mlib/*.o mlib/*~ \
1e98dffb 143 alpha/*.o alpha/*~ \
59925ef2 144 ppc/*.o ppc/*~ \
d46aba26 145 ps2/*.o ps2/*~ \
57514323
ZK
146 liba52/*.o liba52/*~ \
147 apiexample $(TESTS)
de6d9b64 148
800d7ceb 149distclean: clean
980fc7b8
FB
150 rm -f Makefile.bak .depend
151
de6d9b64
FB
152# api example program
153apiexample: apiexample.c $(LIB)
cfda33cb 154 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
de6d9b64 155
c10e9f70
NK
156# cpuid test
157cpuid_test: i386/cputest.c
158 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
159
de6d9b64
FB
160# testing progs
161
162imgresample-test: imgresample.c
6acce86b 163 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
de6d9b64 164
9ebc63a9 165dct-test: dct-test.o fdctref.o $(LIB)
90cee0c3 166 $(CC) -o $@ $^ -lm
d771bcae 167
4300403e 168motion-test: motion_test.o $(LIB)
6acce86b 169 $(CC) -o $@ $^ -lm
4300403e 170
923ceff8 171fft-test: fft-test.o $(LIB)
6d2abd6b
FB
172 $(CC) -o $@ $^ -lm
173
0fd94442 174install: all
0fd94442 175ifeq ($(BUILD_SHARED),yes)
c1325d18 176 install -d $(prefix)/lib
ff4ec49e 177 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
c1325d18
VM
178 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
179 ldconfig || true
ff4ec49e 180 mkdir -p $(prefix)/include/ffmpeg
3565eeaa
FH
181 install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
182 install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
0fd94442 183endif
773cefc6
FB
184
185installlib: all
186 install -m 644 $(LIB) $(prefix)/lib
187 mkdir -p $(prefix)/include/ffmpeg
188 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
189 $(prefix)/include/ffmpeg
190
d771bcae
FB
191#
192# include dependency files if they exist
193#
194ifneq ($(wildcard .depend),)
195include .depend
196endif