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.

257 lines
6.1KB

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