You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

256 lines
6.0KB

  1. #
  2. # libavcodec Makefile
  3. # (c) 2000, 2001, 2002 Fabrice Bellard
  4. #
  5. include ../config.mak
  6. VPATH=$(SRC_PATH)/libavcodec
  7. # NOTE: -I.. is needed to include config.h
  8. CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
  9. LDFLAGS= -g
  10. OBJS= common.o utils.o mem.o allcodecs.o \
  11. mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
  12. mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
  13. motion_est.o imgconvert.o imgresample.o \
  14. mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
  15. ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
  16. fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
  17. vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o
  18. ifeq ($(AMR_NB),yes)
  19. ifeq ($(AMR_NB_FIXED),yes)
  20. OBJS+= amr.o
  21. AMREXTRALIBS+= amr/*.o
  22. AMRLIBS=amrlibs
  23. CLEANAMR=cleanamr
  24. else
  25. OBJS+= amr.o amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
  26. CLEANAMR=cleanamrfloat
  27. endif
  28. endif
  29. ASM_OBJS=
  30. # codecs which are patented in some non free countries like the us
  31. ifeq ($(CONFIG_RISKY),yes)
  32. OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
  33. endif
  34. ifeq ($(HAVE_XVMC_ACCEL),yes)
  35. OBJS+= xvmcvideo.o
  36. endif
  37. # currently using liba52 for ac3 decoding
  38. ifeq ($(CONFIG_AC3),yes)
  39. OBJS+= a52dec.o
  40. # using builtin liba52 or runtime linked liba52.so.0
  41. ifneq ($(CONFIG_A52BIN),yes)
  42. OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
  43. liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
  44. endif
  45. endif
  46. ifeq ($(CONFIG_FAAD),yes)
  47. OBJS+= faad.o
  48. ifeq ($(CONFIG_FAADBIN),yes)
  49. # no libs needed
  50. else
  51. EXTRALIBS += -lfaad
  52. endif
  53. endif
  54. ifeq ($(CONFIG_PP),yes)
  55. ifeq ($(SHARED_PP),yes)
  56. EXTRALIBS += -lpostproc
  57. else
  58. # LIBS += libpostproc/libpostproc.a ... should be fixed
  59. OBJS += libpostproc/postprocess.o
  60. endif
  61. endif
  62. ifeq ($(CONFIG_MP3LAME),yes)
  63. OBJS += mp3lameaudio.o
  64. EXTRALIBS += -lmp3lame
  65. endif
  66. ifeq ($(CONFIG_VORBIS),yes)
  67. OBJS += oggvorbis.o
  68. EXTRALIBS += -lvorbis -lvorbisenc
  69. endif
  70. ifeq ($(TARGET_GPROF),yes)
  71. CFLAGS+=-p
  72. LDFLAGS+=-p
  73. endif
  74. # i386 mmx specific stuff
  75. ifeq ($(TARGET_MMX),yes)
  76. OBJS += i386/fdct_mmx.o i386/cputest.o \
  77. i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
  78. i386/idct_mmx.o i386/motion_est_mmx.o \
  79. i386/simple_idct_mmx.o i386/fft_sse.o
  80. ifdef TARGET_BUILTIN_VECTOR
  81. i386/fft_sse.o: CFLAGS+= -msse
  82. endif
  83. endif
  84. # armv4l specific stuff
  85. ifeq ($(TARGET_ARCH_ARMV4L),yes)
  86. ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
  87. OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
  88. endif
  89. # sun mediaLib specific stuff
  90. # currently only works when libavcodec is used in mplayer
  91. ifeq ($(HAVE_MLIB),yes)
  92. OBJS += mlib/dsputil_mlib.o
  93. CFLAGS += $(MLIB_INC)
  94. endif
  95. # alpha specific stuff
  96. ifeq ($(TARGET_ARCH_ALPHA),yes)
  97. OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
  98. alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
  99. ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
  100. CFLAGS += -fforce-addr -freduce-all-givs
  101. endif
  102. ifeq ($(TARGET_ARCH_POWERPC),yes)
  103. OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
  104. endif
  105. ifeq ($(TARGET_MMI),yes)
  106. OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
  107. endif
  108. ifeq ($(TARGET_ALTIVEC),yes)
  109. OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
  110. ppc/fft_altivec.o ppc/gmc_altivec.o
  111. endif
  112. ifeq ($(TARGET_ARCH_SH4),yes)
  113. OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
  114. endif
  115. SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
  116. OBJS := $(OBJS) $(ASM_OBJS)
  117. LIB= $(LIBPREF)avcodec$(LIBSUF)
  118. ifeq ($(BUILD_SHARED),yes)
  119. SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
  120. endif
  121. TESTS= imgresample-test dct-test motion-test fft-test
  122. all: $(LIB) $(SLIB)
  123. amrlibs:
  124. $(MAKE) -C amr spclib fipoplib
  125. tests: apiexample cpuid_test $(TESTS)
  126. $(LIB): $(OBJS) $(AMRLIBS)
  127. rm -f $@
  128. $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
  129. $(RANLIB) $@
  130. $(SLIB): $(OBJS)
  131. $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
  132. dsputil.o: dsputil.c dsputil.h
  133. libpostproc/libpostproc.a:
  134. $(MAKE) -C libpostproc
  135. %.o: %.c
  136. $(CC) $(CFLAGS) -c -o $@ $<
  137. %.o: %.S
  138. $(CC) $(CFLAGS) -c -o $@ $<
  139. # motion_est_alpha uses the MVI extension, which is not available with
  140. # -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those
  141. # cases.
  142. ifeq ($(TARGET_ARCH_ALPHA),yes)
  143. alpha/motion_est_alpha.o: alpha/motion_est_alpha.c
  144. cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \
  145. case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \
  146. echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\
  147. $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<
  148. endif
  149. depend: $(SRCS)
  150. $(CC) -MM $(CFLAGS) $^ 1>.depend
  151. dep: depend
  152. clean: $(CLEANAMR)
  153. rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
  154. armv4l/*.o armv4l/*~ \
  155. mlib/*.o mlib/*~ \
  156. alpha/*.o alpha/*~ \
  157. ppc/*.o ppc/*~ \
  158. ps2/*.o ps2/*~ \
  159. sh4/*.o sh4/*~ \
  160. liba52/*.o liba52/*~ \
  161. apiexample $(TESTS)
  162. $(MAKE) -C libpostproc clean
  163. distclean: clean
  164. rm -f Makefile.bak .depend
  165. cleanamr:
  166. $(MAKE) -C amr clean
  167. cleanamrfloat:
  168. rm -f amr_float/*.o
  169. # api example program
  170. apiexample: apiexample.c $(LIB)
  171. $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
  172. # cpuid test
  173. cpuid_test: i386/cputest.c
  174. $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
  175. # testing progs
  176. imgresample-test: imgresample.c
  177. $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
  178. dct-test: dct-test.o fdctref.o $(LIB)
  179. $(CC) -o $@ $^ -lm
  180. motion-test: motion_test.o $(LIB)
  181. $(CC) -o $@ $^ -lm
  182. fft-test: fft-test.o $(LIB)
  183. $(CC) -o $@ $^ -lm
  184. install: all
  185. ifeq ($(BUILD_SHARED),yes)
  186. install -d $(prefix)/lib
  187. install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
  188. ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
  189. ldconfig || true
  190. mkdir -p $(prefix)/include/ffmpeg
  191. install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
  192. install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
  193. endif
  194. installlib: all
  195. install -m 644 $(LIB) $(prefix)/lib
  196. mkdir -p $(prefix)/include/ffmpeg
  197. install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
  198. $(prefix)/include/ffmpeg
  199. #
  200. # include dependency files if they exist
  201. #
  202. ifneq ($(wildcard .depend),)
  203. include .depend
  204. endif