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.

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