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.

229 lines
5.4KB

  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 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 \
  14. mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
  15. ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
  16. fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
  17. vp3.o
  18. ASM_OBJS=
  19. # codecs which are patented in some non free countries like the us
  20. ifeq ($(CONFIG_RISKY),yes)
  21. OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
  22. endif
  23. # currently using liba52 for ac3 decoding
  24. ifeq ($(CONFIG_AC3),yes)
  25. OBJS+= a52dec.o
  26. # using builtin liba52 or runtime linked liba52.so.0
  27. ifneq ($(CONFIG_A52BIN),yes)
  28. OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
  29. liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
  30. endif
  31. endif
  32. ifeq ($(CONFIG_FAAD),yes)
  33. OBJS+= faad.o
  34. ifeq ($(CONFIG_FAADBIN),yes)
  35. # no libs needed
  36. else
  37. EXTRALIBS += -lfaad
  38. endif
  39. endif
  40. ifeq ($(CONFIG_PP),yes)
  41. ifeq ($(SHARED_PP),yes)
  42. EXTRALIBS += -lpostproc
  43. else
  44. # LIBS += libpostproc/libpostproc.a ... should be fixed
  45. OBJS += libpostproc/postprocess.o
  46. endif
  47. endif
  48. ifeq ($(CONFIG_MP3LAME),yes)
  49. OBJS += mp3lameaudio.o
  50. EXTRALIBS += -lmp3lame
  51. endif
  52. ifeq ($(CONFIG_VORBIS),yes)
  53. OBJS += oggvorbis.o
  54. EXTRALIBS += -lvorbis -lvorbisenc
  55. endif
  56. ifeq ($(TARGET_GPROF),yes)
  57. CFLAGS+=-p
  58. LDFLAGS+=-p
  59. endif
  60. # i386 mmx specific stuff
  61. ifeq ($(TARGET_MMX),yes)
  62. OBJS += i386/fdct_mmx.o i386/cputest.o \
  63. i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
  64. i386/idct_mmx.o i386/motion_est_mmx.o \
  65. i386/simple_idct_mmx.o i386/fft_sse.o
  66. ifdef TARGET_BUILTIN_VECTOR
  67. i386/fft_sse.o: CFLAGS+= -msse
  68. endif
  69. endif
  70. # armv4l specific stuff
  71. ifeq ($(TARGET_ARCH_ARMV4L),yes)
  72. ASM_OBJS += armv4l/jrevdct_arm.o
  73. OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
  74. endif
  75. # sun mediaLib specific stuff
  76. # currently only works when libavcodec is used in mplayer
  77. ifeq ($(HAVE_MLIB),yes)
  78. OBJS += mlib/dsputil_mlib.o
  79. CFLAGS += $(MLIB_INC)
  80. endif
  81. # alpha specific stuff
  82. ifeq ($(TARGET_ARCH_ALPHA),yes)
  83. OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
  84. alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
  85. ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
  86. CFLAGS += -fforce-addr -freduce-all-givs
  87. endif
  88. ifeq ($(TARGET_ARCH_POWERPC),yes)
  89. OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
  90. endif
  91. ifeq ($(TARGET_MMI),yes)
  92. OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
  93. endif
  94. ifeq ($(TARGET_ALTIVEC),yes)
  95. ifeq ($(TARGET_OS),Darwin)
  96. CFLAGS += -faltivec
  97. else
  98. CFLAGS += -maltivec -mabi=altivec
  99. endif
  100. OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
  101. ppc/fft_altivec.o ppc/gmc_altivec.o
  102. endif
  103. SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
  104. OBJS := $(OBJS) $(ASM_OBJS)
  105. LIB= $(LIBPREF)avcodec$(LIBSUF)
  106. ifeq ($(BUILD_SHARED),yes)
  107. SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
  108. endif
  109. TESTS= imgresample-test dct-test motion-test fft-test
  110. all: $(LIB) $(SLIB)
  111. tests: apiexample cpuid_test $(TESTS)
  112. $(LIB): $(OBJS)
  113. rm -f $@
  114. $(AR) rc $@ $(OBJS)
  115. $(RANLIB) $@
  116. $(SLIB): $(OBJS)
  117. $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
  118. dsputil.o: dsputil.c dsputil.h
  119. libpostproc/libpostproc.a:
  120. $(MAKE) -C libpostproc
  121. %.o: %.c
  122. $(CC) $(CFLAGS) -c -o $@ $<
  123. %.o: %.S
  124. $(CC) $(CFLAGS) -c -o $@ $<
  125. # motion_est_alpha uses the MVI extension, which is not available with
  126. # -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those
  127. # cases.
  128. ifeq ($(TARGET_ARCH_ALPHA),yes)
  129. alpha/motion_est_alpha.o: alpha/motion_est_alpha.c
  130. cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \
  131. case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \
  132. echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\
  133. $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<
  134. endif
  135. depend: $(SRCS)
  136. $(CC) -MM $(CFLAGS) $^ 1>.depend
  137. dep: depend
  138. clean:
  139. rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
  140. armv4l/*.o armv4l/*~ \
  141. mlib/*.o mlib/*~ \
  142. alpha/*.o alpha/*~ \
  143. ppc/*.o ppc/*~ \
  144. ps2/*.o ps2/*~ \
  145. liba52/*.o liba52/*~ \
  146. apiexample $(TESTS)
  147. $(MAKE) -C libpostproc clean
  148. distclean: clean
  149. rm -f Makefile.bak .depend
  150. # api example program
  151. apiexample: apiexample.c $(LIB)
  152. $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
  153. # cpuid test
  154. cpuid_test: i386/cputest.c
  155. $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
  156. # testing progs
  157. imgresample-test: imgresample.c
  158. $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
  159. dct-test: dct-test.o fdctref.o $(LIB)
  160. $(CC) -o $@ $^ -lm
  161. motion-test: motion_test.o $(LIB)
  162. $(CC) -o $@ $^ -lm
  163. fft-test: fft-test.o $(LIB)
  164. $(CC) -o $@ $^ -lm
  165. install: all
  166. ifeq ($(BUILD_SHARED),yes)
  167. install -d $(prefix)/lib
  168. install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
  169. ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
  170. ldconfig || true
  171. mkdir -p $(prefix)/include/ffmpeg
  172. install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
  173. install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
  174. endif
  175. installlib: all
  176. install -m 644 $(LIB) $(prefix)/lib
  177. mkdir -p $(prefix)/include/ffmpeg
  178. install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
  179. $(prefix)/include/ffmpeg
  180. #
  181. # include dependency files if they exist
  182. #
  183. ifneq ($(wildcard .depend),)
  184. include .depend
  185. endif