3 # (c) 2000-2005 Fabrice Bellard
7 VPATH=$(SRC_PATH)/libavcodec
9 # NOTE: -I.. is needed to include config.h
10 CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavutil -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE $(AMR_CFLAGS)
12 #FIXME: This should be in configure/config.mak
13 ifeq ($(CONFIG_WIN32),yes)
14 LDFLAGS=-Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
17 OBJS= bitstream.o utils.o mem.o allcodecs.o \
18 mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
19 mpegaudio.o ac3enc.o mjpeg.o resample.o resample2.o dsputil.o \
20 motion_est.o imgconvert.o imgresample.o \
21 mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
22 ratecontrol.o adpcm.o eval.o error_resilience.o \
23 fft.o mdct.o raw.o golomb.o cabac.o\
24 dpcm.o adx.o faandct.o parser.o g726.o \
25 vp3dsp.o h264idct.o rangecoder.o pnm.o h263.o msmpeg4.o h263dec.o \
28 ifeq ($(CONFIG_AASC_DECODER),yes)
31 ifeq ($(CONFIG_ALAC_DECODER),yes)
34 ifneq ($(CONFIG_ASV1_DECODER)$(CONFIG_ASV1_ENCODER)$(CONFIG_ASV2_DECODER)$(CONFIG_ASV2_ENCODER),)
37 ifeq ($(CONFIG_CINEPAK_DECODER),yes)
40 ifeq ($(CONFIG_COOK_DECODER),yes)
43 ifneq ($(CONFIG_CLJR_DECODER)$(CONFIG_CLJR_ENCODER),)
46 ifeq ($(CONFIG_CYUV_DECODER),yes)
49 ifeq ($(CONFIG_DVBSUB_DECODER),yes)
52 ifeq ($(CONFIG_DVBSUB_ENCODER),yes)
55 ifeq ($(CONFIG_DVDSUB_DECODER),yes)
58 ifeq ($(CONFIG_DVDSUB_ENCODER),yes)
61 ifneq ($(CONFIG_DVVIDEO_DECODER)$(CONFIG_DVVIDEO_ENCODER),)
64 ifeq ($(CONFIG_EIGHTBPS_DECODER),yes)
67 ifneq ($(CONFIG_FFV1_DECODER)$(CONFIG_FFV1_ENCODER),)
70 ifeq ($(CONFIG_FLAC_DECODER),yes)
73 ifeq ($(CONFIG_FLIC_DECODER),yes)
76 ifeq ($(CONFIG_FOURXM_DECODER),yes)
79 ifeq ($(CONFIG_FRAPS_DECODER),yes)
82 ifneq ($(CONFIG_H261_DECODER)$(CONFIG_H261_ENCODER),)
85 ifneq ($(CONFIG_H264_DECODER)$(CONFIG_SVQ3_DECODER),)
88 ifneq ($(CONFIG_HUFFYUV_DECODER)$(CONFIG_HUFFYUV_ENCODER)$(CONFIG_FFVHUFF_DECODER)$(CONFIG_FFVHUFF_ENCODER),)
91 ifeq ($(CONFIG_IDCIN_DECODER),yes)
94 ifeq ($(CONFIG_INDEO2_DECODER),yes)
97 ifeq ($(CONFIG_INDEO3_DECODER),yes)
100 ifeq ($(CONFIG_INTERPLAY_VIDEO_DECODER),yes)
101 OBJS+= interplayvideo.o
103 ifneq ($(CONFIG_MSZH_DECODER)$(CONFIG_ZLIB_DECODER)$(CONFIG_ZLIB_ENCODER),)
106 ifeq ($(CONFIG_LOCO_DECODER),yes)
109 ifneq ($(CONFIG_MACE3_DECODER)$(CONFIG_MACE6_DECODER),)
112 ifeq ($(CONFIG_MSRLE_DECODER),yes)
115 ifeq ($(CONFIG_MSVIDEO1_DECODER),yes)
118 ifneq ($(CONFIG_PNG_DECODER)$(CONFIG_PNG_ENCODER),)
121 ifeq ($(CONFIG_QDM2_DECODER),yes)
124 ifeq ($(CONFIG_QDRAW_DECODER),yes)
127 ifeq ($(CONFIG_QPEG_DECODER),yes)
130 ifeq ($(CONFIG_QTRLE_DECODER),yes)
133 ifeq ($(CONFIG_RA_144_DECODER),yes)
136 ifeq ($(CONFIG_RA_288_DECODER),yes)
139 ifeq ($(CONFIG_ROQ_DECODER),yes)
142 ifeq ($(CONFIG_RPZA_DECODER),yes)
145 ifneq ($(CONFIG_RV10_DECODER)$(CONFIG_RV20_DECODER)$(CONFIG_RV10_ENCODER)$(CONFIG_RV20_ENCODER),)
148 ifeq ($(CONFIG_SHORTEN_DECODER),yes)
151 ifeq ($(CONFIG_SMC_DECODER),yes)
154 ifneq ($(CONFIG_SNOW_DECODER)$(CONFIG_SNOW_ENCODER),)
157 ifneq ($(CONFIG_SONIC_DECODER)$(CONFIG_SONIC_ENCODER)$(CONFIG_SONIC_LS_ENCODER),)
160 ifneq ($(CONFIG_SVQ1_DECODER)$(CONFIG_SVQ1_ENCODER),)
163 ifeq ($(CONFIG_TRUEMOTION1_DECODER),yes)
166 ifeq ($(CONFIG_TRUEMOTION2_DECODER),yes)
169 ifeq ($(CONFIG_TRUESPEECH_DECODER),yes)
172 ifeq ($(CONFIG_TTA_DECODER),yes)
175 ifeq ($(CONFIG_TSCC_DECODER),yes)
178 ifeq ($(CONFIG_CSCD_DECODER),yes)
182 ifeq ($(CONFIG_ULTI_DECODER),yes)
185 ifneq ($(CONFIG_VC9_DECODER)$(CONFIG_WMV3_DECODER),)
188 ifneq ($(CONFIG_VCR1_DECODER)$(CONFIG_VCR1_ENCODER),)
191 ifneq ($(CONFIG_VMDVIDEO_DECODER)$(CONFIG_VMDAUDIO_DECODER),)
194 ifeq ($(CONFIG_VORBIS_DECODER),yes)
197 ifneq ($(CONFIG_VP3_DECODER)$(CONFIG_THEORA_DECODER),)
200 ifeq ($(CONFIG_VQA_DECODER),yes)
203 ifneq ($(CONFIG_WMAV1_DECODER)$(CONFIG_WMAV2_DECODER),)
206 ifeq ($(CONFIG_WNV1_DECODER),yes)
209 ifeq ($(CONFIG_WS_SND1_DECODER),yes)
212 ifneq ($(CONFIG_XAN_WC3_DECODER)$(CONFIG_XAN_WC4_DECODER),)
215 ifeq ($(CONFIG_XL_DECODER),yes)
218 ifeq ($(CONFIG_BMP_DECODER),yes)
221 ifeq ($(CONFIG_MMVIDEO_DECODER),yes)
224 ifeq ($(CONFIG_ZMBV_DECODER),yes)
230 ifeq ($(AMR_NB_FIXED),yes)
232 AMREXTRALIBS+= amr/*.o
237 OBJS+= amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
238 CLEANAMR=cleanamrfloat
242 ifeq ($(HAVE_PTHREADS),yes)
246 ifeq ($(HAVE_W32THREADS),yes)
250 ifeq ($(HAVE_OS2THREADS),yes)
255 ifeq ($(HAVE_BEOSTHREADS),yes)
261 OBJS+= amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
262 amrwb_float/dec_if.o amrwb_float/dec_lpc.o amrwb_float/dec_main.o \
263 amrwb_float/dec_rom.o amrwb_float/dec_util.o amrwb_float/enc_acelp.o \
264 amrwb_float/enc_dtx.o amrwb_float/enc_gain.o amrwb_float/enc_if.o \
265 amrwb_float/enc_lpc.o amrwb_float/enc_main.o amrwb_float/enc_rom.o \
266 amrwb_float/enc_util.o amrwb_float/if_rom.o
269 CLEANAMRWB=cleanamrwbfloat
272 ifeq ($(HAVE_XVMC_ACCEL),yes)
276 # currently using liba52 for ac3 decoding
277 ifeq ($(CONFIG_AC3),yes)
280 # using builtin liba52 or runtime linked liba52.so.0
281 ifneq ($(CONFIG_A52BIN),yes)
282 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
283 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
287 EXTRALIBS += -L../libavutil -lavutil$(BUILDSUF)
289 # currently using libdts for dts decoding
290 ifeq ($(CONFIG_DTS),yes)
295 ifeq ($(CONFIG_FAAD),yes)
299 ifeq ($(CONFIG_FAAC),yes)
303 ifeq ($(CONFIG_XVID),yes)
308 ifeq ($(CONFIG_X264),yes)
312 ifeq ($(CONFIG_MP3LAME),yes)
313 OBJS += mp3lameaudio.o
316 ifeq ($(CONFIG_LIBOGG),yes)
317 ifeq ($(CONFIG_LIBVORBIS),yes)
320 ifeq ($(CONFIG_LIBTHEORA), yes)
325 ifeq ($(CONFIG_LIBGSM),yes)
329 ifeq ($(TARGET_GPROF),yes)
334 # i386 mmx specific stuff
335 ifeq ($(TARGET_MMX),yes)
336 OBJS += i386/fdct_mmx.o i386/cputest.o \
337 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
338 i386/idct_mmx.o i386/motion_est_mmx.o \
339 i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
341 ifeq ($(CONFIG_GPL),yes)
342 OBJS += i386/idct_mmx_xvid.o
344 ifdef TARGET_BUILTIN_VECTOR
345 i386/fft_sse.o: CFLAGS+= -msse
346 depend: CFLAGS+= -msse
350 # armv4l specific stuff
351 ifeq ($(TARGET_ARCH_ARMV4L),yes)
352 ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o armv4l/dsputil_arm_s.o
353 OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
354 ifeq ($(TARGET_IWMMXT),yes)
355 OBJS += armv4l/dsputil_iwmmxt.o armv4l/mpegvideo_iwmmxt.o
359 # sun mediaLib specific stuff
360 # currently only works when libavcodec is used in mplayer
361 ifeq ($(HAVE_MLIB),yes)
362 OBJS += mlib/dsputil_mlib.o
363 CFLAGS += $(MLIB_INC)
366 # Intel IPP specific stuff
367 # currently only works when libavcodec is used in mplayer
368 ifeq ($(HAVE_IPP),yes)
372 # alpha specific stuff
373 ifeq ($(TARGET_ARCH_ALPHA),yes)
374 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
375 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
376 ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
377 CFLAGS += -fforce-addr
380 ifeq ($(TARGET_ARCH_POWERPC),yes)
381 OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
384 ifeq ($(TARGET_MMI),yes)
385 OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
388 ifeq ($(TARGET_ALTIVEC),yes)
389 OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
390 ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o \
391 ppc/dsputil_h264_altivec.o
394 ifeq ($(TARGET_ARCH_SH4),yes)
395 OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
398 ifeq ($(TARGET_ARCH_SPARC),yes)
399 OBJS+=sparc/dsputil_vis.o
401 $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $<
403 ifeq ($(TARGET_ARCH_SPARC64),yes)
404 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
407 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
408 OBJS := $(OBJS) $(ASM_OBJS)
411 LIBAVUTIL= $(SRC_PATH)/libavutil/$(LIBPREF)avutil$(LIBSUF)
412 ifeq ($(BUILD_SHARED),yes)
413 LIBVERSION=$(LAVCVERSION)
414 LIBMAJOR=$(LAVCMAJOR)
416 TESTS= imgresample-test dct-test motion-test fft-test
418 all: $(LIB) $(SLIBNAME)
421 $(MAKE) -C amr spclib fipoplib
423 tests: apiexample cpuid_test $(TESTS)
425 $(LIB): $(OBJS) $(AMRLIBS)
427 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
431 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
432 ifeq ($(CONFIG_WIN32),yes)
433 -lib /machine:i386 /def:$(@:.dll=.def)
436 dsputil.o: dsputil.c dsputil.h
439 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
442 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
445 $(CC) -MM $(CFLAGS) $^ 1>.depend
450 rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
451 *.dll.a *.def *.exp \
453 armv4l/*.o armv4l/*~ \
460 liba52/*.o liba52/*~ \
473 $(MAKE) -C amrwb_float -f makefile.gcc clean
475 # api example program
476 apiexample: apiexample.c $(LIB)
477 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(LIBAVUTIL) $(EXTRALIBS) -lm
480 cpuid_test: i386/cputest.c
481 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
485 imgresample-test: imgresample.c
486 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
488 dct-test: dct-test.o fdctref.o $(LIB)
489 $(CC) -o $@ $^ -lm $(LIBAVUTIL)
491 motion-test: motion_test.o $(LIB)
494 fft-test: fft-test.o $(LIB)
495 $(CC) -o $@ $^ $(LIBAVUTIL) -lm
498 install-lib-shared: $(SLIBNAME)
499 ifeq ($(CONFIG_WIN32),yes)
500 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
502 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
503 $(libdir)/$(SLIBNAME_WITH_VERSION)
504 ln -sf $(SLIBNAME_WITH_VERSION) \
505 $(libdir)/$(SLIBNAME_WITH_MAJOR)
506 ln -sf $(SLIBNAME_WITH_VERSION) \
507 $(libdir)/$(SLIBNAME)
510 install-lib-static: $(LIB)
511 install -m 644 $(LIB) "$(libdir)"
514 install -m 644 avcodec.h dsputil.h "$(incdir)"
515 install -m 644 $(SRC_PATH)/libavcodec.pc "$(libdir)/pkgconfig"
518 # include dependency files if they exist
520 ifneq ($(wildcard .depend),)