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