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.

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