3 # (c) 2000-2003 Fabrice Bellard
7 VPATH=$(SRC_PATH)/libavcodec
9 # NOTE: -I.. is needed to include config.h
10 CFLAGS= $(OPTFLAGS) -Wall -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
12 OBJS= common.o utils.o mem.o allcodecs.o \
13 mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
14 mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
15 motion_est.o imgconvert.o imgresample.o \
16 mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
17 ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
18 fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
19 vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o \
20 roqvideo.o dpcm.o interplayvideo.o xan.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 ifeq ($(HAVE_XVMC_ACCEL),yes)
45 # currently using liba52 for ac3 decoding
46 ifeq ($(CONFIG_AC3),yes)
49 # using builtin liba52 or runtime linked liba52.so.0
50 ifneq ($(CONFIG_A52BIN),yes)
51 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
52 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
56 ifeq ($(CONFIG_FAAD),yes)
58 ifeq ($(CONFIG_FAADBIN),yes)
65 ifeq ($(CONFIG_PP),yes)
66 ifeq ($(SHARED_PP),yes)
67 EXTRALIBS += -lpostproc
69 # LIBS += libpostproc/libpostproc.a ... should be fixed
70 OBJS += libpostproc/postprocess.o
74 ifeq ($(CONFIG_MP3LAME),yes)
75 OBJS += mp3lameaudio.o
76 EXTRALIBS += -lmp3lame
79 ifeq ($(CONFIG_VORBIS),yes)
81 EXTRALIBS += -lvorbis -lvorbisenc
84 ifeq ($(TARGET_GPROF),yes)
89 # i386 mmx specific stuff
90 ifeq ($(TARGET_MMX),yes)
91 OBJS += i386/fdct_mmx.o i386/cputest.o \
92 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
93 i386/idct_mmx.o i386/motion_est_mmx.o \
94 i386/simple_idct_mmx.o i386/fft_sse.o
95 ifdef TARGET_BUILTIN_VECTOR
96 i386/fft_sse.o: CFLAGS+= -msse
100 # armv4l specific stuff
101 ifeq ($(TARGET_ARCH_ARMV4L),yes)
102 ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
103 OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
106 # sun mediaLib specific stuff
107 # currently only works when libavcodec is used in mplayer
108 ifeq ($(HAVE_MLIB),yes)
109 OBJS += mlib/dsputil_mlib.o
110 CFLAGS += $(MLIB_INC)
113 # alpha specific stuff
114 ifeq ($(TARGET_ARCH_ALPHA),yes)
115 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
116 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
117 ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
118 CFLAGS += -fforce-addr -freduce-all-givs
121 ifeq ($(TARGET_ARCH_POWERPC),yes)
122 OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
125 ifeq ($(TARGET_MMI),yes)
126 OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
129 ifeq ($(TARGET_ALTIVEC),yes)
130 OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
131 ppc/fft_altivec.o ppc/gmc_altivec.o
134 ifeq ($(TARGET_ARCH_SH4),yes)
135 OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
139 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
140 OBJS := $(OBJS) $(ASM_OBJS)
142 LIB= $(LIBPREF)avcodec$(LIBSUF)
143 ifeq ($(BUILD_SHARED),yes)
144 SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
146 TESTS= imgresample-test dct-test motion-test fft-test
151 $(MAKE) -C amr spclib fipoplib
153 tests: apiexample cpuid_test $(TESTS)
155 $(LIB): $(OBJS) $(AMRLIBS)
157 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
161 ifeq ($(CONFIG_WIN32),yes)
162 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
163 -lib /machine:i386 /def:$(@:.dll=.def)
165 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
168 dsputil.o: dsputil.c dsputil.h
170 libpostproc/libpostproc.a:
171 $(MAKE) -C libpostproc
174 $(CC) $(CFLAGS) -c -o $@ $<
177 $(CC) $(CFLAGS) -c -o $@ $<
180 $(CC) -MM $(CFLAGS) $^ 1>.depend
185 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
186 armv4l/*.o armv4l/*~ \
192 liba52/*.o liba52/*~ \
194 $(MAKE) -C libpostproc clean
197 rm -f Makefile.bak .depend
205 # api example program
206 apiexample: apiexample.c $(LIB)
207 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
210 cpuid_test: i386/cputest.c
211 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
215 imgresample-test: imgresample.c
216 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
218 dct-test: dct-test.o fdctref.o $(LIB)
221 motion-test: motion_test.o $(LIB)
224 fft-test: fft-test.o $(LIB)
227 ifeq ($(BUILD_SHARED),yes)
228 install: all install-headers
229 ifeq ($(CONFIG_WIN32),yes)
230 install -s -m 755 $(SLIB) "$(prefix)"
232 install -d $(prefix)/lib
233 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
234 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
241 installlib: all install-headers
242 install -m 644 $(LIB) $(prefix)/lib
245 mkdir -p "$(prefix)/include/ffmpeg"
246 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
247 "$(prefix)/include/ffmpeg"
250 # include dependency files if they exist
252 ifneq ($(wildcard .depend),)