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.

240 lines
5.6KB

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