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.

220 lines
5.3KB

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