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 raw.o h264.o golomb.o \
20 vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o
23 ifeq ($(AMR_NB_FIXED),yes)
25 AMREXTRALIBS+= amr/*.o
29 OBJS+= amr.o amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
30 CLEANAMR=cleanamrfloat
36 # codecs which are patented in some non free countries like the us
37 ifeq ($(CONFIG_RISKY),yes)
38 OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
41 # currently using liba52 for ac3 decoding
42 ifeq ($(CONFIG_AC3),yes)
45 # using builtin liba52 or runtime linked liba52.so.0
46 ifneq ($(CONFIG_A52BIN),yes)
47 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
48 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
52 ifeq ($(CONFIG_FAAD),yes)
54 ifeq ($(CONFIG_FAADBIN),yes)
61 ifeq ($(CONFIG_PP),yes)
62 ifeq ($(SHARED_PP),yes)
63 EXTRALIBS += -lpostproc
65 # LIBS += libpostproc/libpostproc.a ... should be fixed
66 OBJS += libpostproc/postprocess.o
70 ifeq ($(CONFIG_MP3LAME),yes)
71 OBJS += mp3lameaudio.o
72 EXTRALIBS += -lmp3lame
75 ifeq ($(CONFIG_VORBIS),yes)
77 EXTRALIBS += -lvorbis -lvorbisenc
80 ifeq ($(TARGET_GPROF),yes)
85 # i386 mmx specific stuff
86 ifeq ($(TARGET_MMX),yes)
87 OBJS += i386/fdct_mmx.o i386/cputest.o \
88 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
89 i386/idct_mmx.o i386/motion_est_mmx.o \
90 i386/simple_idct_mmx.o i386/fft_sse.o
91 ifdef TARGET_BUILTIN_VECTOR
92 i386/fft_sse.o: CFLAGS+= -msse
96 # armv4l specific stuff
97 ifeq ($(TARGET_ARCH_ARMV4L),yes)
98 ASM_OBJS += armv4l/jrevdct_arm.o
99 OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
102 # sun mediaLib specific stuff
103 # currently only works when libavcodec is used in mplayer
104 ifeq ($(HAVE_MLIB),yes)
105 OBJS += mlib/dsputil_mlib.o
106 CFLAGS += $(MLIB_INC)
109 # alpha specific stuff
110 ifeq ($(TARGET_ARCH_ALPHA),yes)
111 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
112 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
113 ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
114 CFLAGS += -fforce-addr -freduce-all-givs
117 ifeq ($(TARGET_ARCH_POWERPC),yes)
118 OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
121 ifeq ($(TARGET_MMI),yes)
122 OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
125 ifeq ($(TARGET_ALTIVEC),yes)
126 ifeq ($(TARGET_OS),Darwin)
129 CFLAGS += -maltivec -mabi=altivec
131 OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
132 ppc/fft_altivec.o ppc/gmc_altivec.o
135 ifeq ($(TARGET_ARCH_SH4),yes)
136 OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
140 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
141 OBJS := $(OBJS) $(ASM_OBJS)
143 LIB= $(LIBPREF)avcodec$(LIBSUF)
144 ifeq ($(BUILD_SHARED),yes)
145 SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
147 TESTS= imgresample-test dct-test motion-test fft-test
152 $(MAKE) -C amr spclib fipoplib
154 tests: apiexample cpuid_test $(TESTS)
156 $(LIB): $(OBJS) $(AMRLIBS)
158 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
162 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
164 dsputil.o: dsputil.c dsputil.h
166 libpostproc/libpostproc.a:
167 $(MAKE) -C libpostproc
170 $(CC) $(CFLAGS) -c -o $@ $<
173 $(CC) $(CFLAGS) -c -o $@ $<
175 # motion_est_alpha uses the MVI extension, which is not available with
176 # -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those
178 ifeq ($(TARGET_ARCH_ALPHA),yes)
179 alpha/motion_est_alpha.o: alpha/motion_est_alpha.c
180 cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \
181 case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \
182 echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\
183 $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<
187 $(CC) -MM $(CFLAGS) $^ 1>.depend
192 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
193 armv4l/*.o armv4l/*~ \
199 liba52/*.o liba52/*~ \
201 $(MAKE) -C libpostproc clean
204 rm -f Makefile.bak .depend
212 # api example program
213 apiexample: apiexample.c $(LIB)
214 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
217 cpuid_test: i386/cputest.c
218 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
222 imgresample-test: imgresample.c
223 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
225 dct-test: dct-test.o fdctref.o $(LIB)
228 motion-test: motion_test.o $(LIB)
231 fft-test: fft-test.o $(LIB)
235 ifeq ($(BUILD_SHARED),yes)
236 install -d $(prefix)/lib
237 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
238 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
240 mkdir -p $(prefix)/include/ffmpeg
241 install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
242 install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
246 install -m 644 $(LIB) $(prefix)/lib
247 mkdir -p $(prefix)/include/ffmpeg
248 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
249 $(prefix)/include/ffmpeg
252 # include dependency files if they exist
254 ifneq ($(wildcard .depend),)