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.

197 lines
4.8KB

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