3 # (c) 2000, 2001, 2002 Fabrice Bellard
7 VPATH=$(SRC_PATH)/libavcodec
9 # NOTE: -I.. is needed to include config.h
10 CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
13 OBJS= common.o utils.o mem.o allcodecs.o \
14 mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
15 mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
16 motion_est.o imgconvert.o imgresample.o \
17 mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
18 ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
19 fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o
22 # codecs which are patented in some non free countries like the us
23 ifeq ($(CONFIG_RISKY),yes)
24 OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o
27 # currently using liba52 for ac3 decoding
28 ifeq ($(CONFIG_AC3),yes)
31 # using builtin liba52 or runtime linked liba52.so.0
32 ifneq ($(CONFIG_A52BIN),yes)
33 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
34 liba52/imdct.o liba52/parse.o
38 ifeq ($(CONFIG_MP3LAME),yes)
39 OBJS += mp3lameaudio.o
40 EXTRALIBS += -lmp3lame
43 ifeq ($(CONFIG_VORBIS),yes)
45 EXTRALIBS += -lvorbis -lvorbisenc
48 ifeq ($(TARGET_GPROF),yes)
53 # i386 mmx specific stuff
54 ifeq ($(TARGET_MMX),yes)
55 OBJS += i386/fdct_mmx.o i386/cputest.o \
56 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
57 i386/idct_mmx.o i386/motion_est_mmx.o \
58 i386/simple_idct_mmx.o i386/fft_sse.o
59 ifdef TARGET_BUILTIN_VECTOR
60 i386/fft_sse.o: CFLAGS+= -msse
64 # armv4l specific stuff
65 ifeq ($(TARGET_ARCH_ARMV4L),yes)
66 ASM_OBJS += armv4l/jrevdct_arm.o
67 OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
70 # sun mediaLib specific stuff
71 # currently only works when libavcodec is used in mplayer
72 ifeq ($(HAVE_MLIB),yes)
73 OBJS += mlib/dsputil_mlib.o
77 # alpha specific stuff
78 ifeq ($(TARGET_ARCH_ALPHA),yes)
79 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
80 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
81 ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
82 CFLAGS += -fforce-addr -freduce-all-givs
85 ifeq ($(TARGET_ARCH_POWERPC),yes)
86 OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
89 ifeq ($(TARGET_MMI),yes)
90 OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
93 ifeq ($(TARGET_ALTIVEC),yes)
94 ifeq ($(TARGET_OS),Darwin)
97 CFLAGS += -maltivec -mabi=altivec
99 OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
100 ppc/fft_altivec.o ppc/gmc_altivec.o
103 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
104 OBJS := $(OBJS) $(ASM_OBJS)
106 LIB= $(LIBPREF)avcodec$(LIBSUF)
107 ifeq ($(BUILD_SHARED),yes)
108 SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
110 TESTS= imgresample-test dct-test motion-test fft-test
114 tests: apiexample cpuid_test $(TESTS)
119 ifneq ($(CONFIG_OS2),yes)
124 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
126 dsputil.o: dsputil.c dsputil.h
129 $(CC) $(CFLAGS) -c -o $@ $<
132 $(CC) $(CFLAGS) -c -o $@ $<
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
137 ifeq ($(TARGET_ARCH_ALPHA),yes)
138 alpha/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 $@ $<
146 $(CC) -MM $(CFLAGS) $^ 1>.depend
151 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
152 armv4l/*.o armv4l/*~ \
157 liba52/*.o liba52/*~ \
161 rm -f Makefile.bak .depend
163 # api example program
164 apiexample: apiexample.c $(LIB)
165 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
168 cpuid_test: i386/cputest.c
169 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
173 imgresample-test: imgresample.c
174 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
176 dct-test: dct-test.o fdctref.o $(LIB)
179 motion-test: motion_test.o $(LIB)
182 fft-test: fft-test.o $(LIB)
186 ifeq ($(BUILD_SHARED),yes)
187 install -d $(prefix)/lib
188 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
189 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
191 mkdir -p $(prefix)/include/ffmpeg
192 install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
193 install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
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
203 # include dependency files if they exist
205 ifneq ($(wildcard .depend),)