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.

204 lines
4.9KB

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