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