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.

224 lines
5.4KB

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