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.

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