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.

190 lines
4.6KB

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