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.

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