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.

195 lines
4.7KB

  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
  74. endif
  75. SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
  76. OBJS := $(OBJS) $(ASM_OBJS)
  77. LIB= libavcodec.a
  78. ifeq ($(BUILD_SHARED),yes)
  79. SLIB= libavcodec.so
  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. $(RANLIB) $@
  88. $(SLIB): $(OBJS)
  89. $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
  90. dsputil.o: dsputil.c dsputil.h
  91. %.o: %.c
  92. $(CC) $(CFLAGS) -c -o $@ $<
  93. %.o: %.S
  94. $(CC) $(CFLAGS) -c -o $@ $<
  95. # motion_est_alpha uses the MVI extension, which is not available with
  96. # -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those
  97. # cases.
  98. ifeq ($(TARGET_ARCH_ALPHA),yes)
  99. alpha/motion_est_alpha.o: alpha/motion_est_alpha.c
  100. cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \
  101. case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \
  102. echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\
  103. $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<
  104. endif
  105. # depend only used by mplayer now
  106. dep: depend
  107. depend:
  108. $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
  109. clean:
  110. rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
  111. armv4l/*.o armv4l/*~ \
  112. mlib/*.o mlib/*~ \
  113. alpha/*.o alpha/*~ \
  114. ppc/*.o ppc/*~ \
  115. ps2/*.o ps2/*~ \
  116. liba52/*.o liba52/*~ \
  117. apiexample $(TESTS)
  118. distclean: clean
  119. rm -f Makefile.bak .depend
  120. # api example program
  121. apiexample: apiexample.c $(LIB)
  122. $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
  123. # cpuid test
  124. cpuid_test: i386/cputest.c
  125. $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
  126. # testing progs
  127. imgresample-test: imgresample.c
  128. $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
  129. dct-test: dct-test.o fdctref.o $(LIB)
  130. $(CC) -o $@ $^ -lm
  131. motion-test: motion_test.o $(LIB)
  132. $(CC) -o $@ $^ -lm
  133. fft-test: fft-test.o $(LIB)
  134. $(CC) -o $@ $^ -lm
  135. install: all
  136. ifeq ($(BUILD_SHARED),yes)
  137. install -d $(prefix)/lib
  138. install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
  139. ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
  140. ldconfig || true
  141. mkdir -p $(prefix)/include/ffmpeg
  142. install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
  143. install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
  144. endif
  145. installlib: all
  146. install -m 644 $(LIB) $(prefix)/lib
  147. mkdir -p $(prefix)/include/ffmpeg
  148. install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
  149. $(prefix)/include/ffmpeg
  150. #
  151. # include dependency files if they exist
  152. #
  153. ifneq ($(wildcard .depend),)
  154. include .depend
  155. endif