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.

485 lines
11KB

  1. #
  2. # libavcodec Makefile
  3. # (c) 2000-2005 Fabrice Bellard
  4. #
  5. include ../config.mak
  6. VPATH=$(SRC_PATH)/libavcodec
  7. # NOTE: -I.. is needed to include config.h
  8. CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE $(AMR_CFLAGS)
  9. OBJS= bitstream.o utils.o mem.o allcodecs.o \
  10. mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
  11. mpegaudio.o ac3enc.o mjpeg.o resample.o resample2.o dsputil.o \
  12. motion_est.o imgconvert.o imgresample.o \
  13. mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
  14. ratecontrol.o adpcm.o eval.o error_resilience.o \
  15. fft.o mdct.o raw.o golomb.o cabac.o\
  16. dpcm.o adx.o rational.o faandct.o parser.o g726.o \
  17. vp3dsp.o integer.o h264idct.o rangecoder.o pnm.o h263.o msmpeg4.o h263dec.o
  18. ifeq ($(CONFIG_AASC_DECODER),yes)
  19. OBJS+= aasc.o
  20. endif
  21. ifeq ($(CONFIG_ALAC_DECODER),yes)
  22. OBJS+= alac.o
  23. endif
  24. ifneq ($(CONFIG_ASV1_DECODER)$(CONFIG_ASV1_ENCODER)$(CONFIG_ASV2_DECODER)$(CONFIG_ASV2_ENCODER),)
  25. OBJS+= asv1.o
  26. endif
  27. ifeq ($(CONFIG_CINEPAK_DECODER),yes)
  28. OBJS+= cinepak.o
  29. endif
  30. ifneq ($(CONFIG_CLJR_DECODER)$(CONFIG_CLJR_ENCODER),)
  31. OBJS+= cljr.o
  32. endif
  33. ifeq ($(CONFIG_CYUV_DECODER),yes)
  34. OBJS+= cyuv.o
  35. endif
  36. ifneq ($(CONFIG_DVVIDEO_DECODER)$(CONFIG_DVVIDEO_ENCODER),)
  37. OBJS+= dv.o
  38. endif
  39. ifeq ($(CONFIG_EIGHTBPS_DECODER),yes)
  40. OBJS+= 8bps.o
  41. endif
  42. ifneq ($(CONFIG_FFV1_DECODER)$(CONFIG_FFV1_ENCODER),)
  43. OBJS+= ffv1.o
  44. endif
  45. ifeq ($(CONFIG_FLAC_DECODER),yes)
  46. OBJS+= flac.o
  47. endif
  48. ifeq ($(CONFIG_FLIC_DECODER),yes)
  49. OBJS+= flicvideo.o
  50. endif
  51. ifeq ($(CONFIG_FOURXM_DECODER),yes)
  52. OBJS+= 4xm.o
  53. endif
  54. ifneq ($(CONFIG_H261_DECODER)$(CONFIG_H261_ENCODER),)
  55. OBJS+= h261.o
  56. endif
  57. ifneq ($(CONFIG_H264_DECODER)$(CONFIG_SVQ3_DECODER),)
  58. OBJS+= h264.o
  59. endif
  60. ifneq ($(CONFIG_HUFFYUV_DECODER)$(CONFIG_HUFFYUV_ENCODER)$(CONFIG_FFVHUFF_DECODER)$(CONFIG_FFVHUFF_ENCODER),)
  61. OBJS+= huffyuv.o
  62. endif
  63. ifeq ($(CONFIG_IDCIN_DECODER),yes)
  64. OBJS+= idcinvideo.o
  65. endif
  66. ifeq ($(CONFIG_INDEO2_DECODER),yes)
  67. OBJS+= indeo2.o
  68. endif
  69. ifeq ($(CONFIG_INDEO3_DECODER),yes)
  70. OBJS+= indeo3.o
  71. endif
  72. ifeq ($(CONFIG_INTERPLAY_VIDEO_DECODER),yes)
  73. OBJS+= interplayvideo.o
  74. endif
  75. ifneq ($(CONFIG_MSZH_DECODER)$(CONFIG_ZLIB_DECODER)$(CONFIG_ZLIB_ENCODER),)
  76. OBJS+= lcl.o
  77. endif
  78. ifeq ($(CONFIG_LOCO_DECODER),yes)
  79. OBJS+= loco.o
  80. endif
  81. ifneq ($(CONFIG_MACE3_DECODER)$(CONFIG_MACE6_DECODER),)
  82. OBJS+= mace.o
  83. endif
  84. ifeq ($(CONFIG_MSRLE_DECODER),yes)
  85. OBJS+= msrle.o
  86. endif
  87. ifeq ($(CONFIG_MSVIDEO1_DECODER),yes)
  88. OBJS+= msvideo1.o
  89. endif
  90. ifneq ($(CONFIG_PNG_DECODER)$(CONFIG_PNG_ENCODER),)
  91. OBJS+= png.o
  92. endif
  93. ifeq ($(CONFIG_QDRAW_DECODER),yes)
  94. OBJS+= qdrw.o
  95. endif
  96. ifeq ($(CONFIG_QPEG_DECODER),yes)
  97. OBJS+= qpeg.o
  98. endif
  99. ifeq ($(CONFIG_QTRLE_DECODER),yes)
  100. OBJS+= qtrle.o
  101. endif
  102. ifeq ($(CONFIG_RA_144_DECODER),yes)
  103. OBJS+= ra144.o
  104. endif
  105. ifeq ($(CONFIG_RA_288_DECODER),yes)
  106. OBJS+= ra288.o
  107. endif
  108. ifeq ($(CONFIG_ROQ_DECODER),yes)
  109. OBJS+= roqvideo.o
  110. endif
  111. ifeq ($(CONFIG_RPZA_DECODER),yes)
  112. OBJS+= rpza.o
  113. endif
  114. ifneq ($(CONFIG_RV10_DECODER)$(CONFIG_RV20_DECODER)$(CONFIG_RV10_ENCODER)$(CONFIG_RV20_ENCODER),)
  115. OBJS+= rv10.o
  116. endif
  117. ifeq ($(CONFIG_SHORTEN_DECODER),yes)
  118. OBJS+= shorten.o
  119. endif
  120. ifeq ($(CONFIG_SMC_DECODER),yes)
  121. OBJS+= smc.o
  122. endif
  123. ifneq ($(CONFIG_SNOW_DECODER)$(CONFIG_SNOW_ENCODER),)
  124. OBJS+= snow.o
  125. endif
  126. ifneq ($(CONFIG_SONIC_DECODER)$(CONFIG_SONIC_ENCODER)$(CONFIG_SONIC_LS_ENCODER),)
  127. OBJS+= sonic.o
  128. endif
  129. ifneq ($(CONFIG_SVQ1_DECODER)$(CONFIG_SVQ1_ENCODER),)
  130. OBJS+= svq1.o
  131. endif
  132. ifeq ($(CONFIG_TRUEMOTION1_DECODER),yes)
  133. OBJS+= truemotion1.o
  134. endif
  135. ifeq ($(CONFIG_TSCC_DECODER),yes)
  136. OBJS+= tscc.o
  137. endif
  138. ifeq ($(CONFIG_ULTI_DECODER),yes)
  139. OBJS+= ulti.o
  140. endif
  141. ifneq ($(CONFIG_VC9_DECODER)$(CONFIG_WMV3_DECODER),)
  142. OBJS+= vc9.o
  143. endif
  144. ifneq ($(CONFIG_VCR1_DECODER)$(CONFIG_VCR1_ENCODER),)
  145. OBJS+= vcr1.o
  146. endif
  147. ifneq ($(CONFIG_VMDVIDEO_DECODER)$(CONFIG_VMDAUDIO_DECODER),)
  148. OBJS+= vmdav.o
  149. endif
  150. ifeq ($(CONFIG_VORBIS_DECODER),yes)
  151. OBJS+= vorbis.o
  152. endif
  153. ifneq ($(CONFIG_VP3_DECODER)$(CONFIG_THEORA_DECODER),)
  154. OBJS+= vp3.o
  155. endif
  156. ifeq ($(CONFIG_VQA_DECODER),yes)
  157. OBJS+= vqavideo.o
  158. endif
  159. ifneq ($(CONFIG_WMAV1_DECODER)$(CONFIG_WMAV2_DECODER),)
  160. OBJS+= wmadec.o
  161. endif
  162. ifeq ($(CONFIG_WNV1_DECODER),yes)
  163. OBJS+= wnv1.o
  164. endif
  165. ifeq ($(CONFIG_WS_SND1_DECODER),yes)
  166. OBJS+= ws-snd1.o
  167. endif
  168. ifneq ($(CONFIG_XAN_WC3_DECODER)$(CONFIG_XAN_WC4_DECODER),)
  169. OBJS+= xan.o
  170. endif
  171. ifeq ($(CONFIG_XL_DECODER),yes)
  172. OBJS+= xl.o
  173. endif
  174. AMROBJS=
  175. ifeq ($(AMR_NB),yes)
  176. ifeq ($(AMR_NB_FIXED),yes)
  177. AMROBJS= amr.o
  178. AMREXTRALIBS+= amr/*.o
  179. AMRLIBS=amrlibs
  180. CLEANAMR=cleanamr
  181. else
  182. AMROBJS= amr.o
  183. OBJS+= amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
  184. CLEANAMR=cleanamrfloat
  185. endif
  186. endif
  187. ifeq ($(HAVE_PTHREADS),yes)
  188. OBJS+= pthread.o
  189. endif
  190. ifeq ($(HAVE_W32THREADS),yes)
  191. OBJS+= w32thread.o
  192. endif
  193. ifeq ($(HAVE_BEOSTHREADS),yes)
  194. OBJS+= beosthread.o
  195. endif
  196. ifeq ($(AMR_WB),yes)
  197. AMROBJS= amr.o
  198. OBJS+= amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
  199. amrwb_float/dec_if.o amrwb_float/dec_lpc.o amrwb_float/dec_main.o \
  200. amrwb_float/dec_rom.o amrwb_float/dec_util.o amrwb_float/enc_acelp.o \
  201. amrwb_float/enc_dtx.o amrwb_float/enc_gain.o amrwb_float/enc_if.o \
  202. amrwb_float/enc_lpc.o amrwb_float/enc_main.o amrwb_float/enc_rom.o \
  203. amrwb_float/enc_util.o amrwb_float/if_rom.o
  204. endif
  205. OBJS+= $(AMROBJS)
  206. CLEANAMRWB=cleanamrwbfloat
  207. ASM_OBJS=
  208. ifeq ($(HAVE_XVMC_ACCEL),yes)
  209. OBJS+= xvmcvideo.o
  210. endif
  211. # currently using liba52 for ac3 decoding
  212. ifeq ($(CONFIG_AC3),yes)
  213. OBJS+= a52dec.o
  214. # using builtin liba52 or runtime linked liba52.so.0
  215. ifneq ($(CONFIG_A52BIN),yes)
  216. OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
  217. liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
  218. endif
  219. endif
  220. # currently using libdts for dts decoding
  221. ifeq ($(CONFIG_DTS),yes)
  222. OBJS+= dtsdec.o
  223. CFLAGS += $(DTS_INC)
  224. EXTRALIBS += -ldts
  225. endif
  226. ifeq ($(CONFIG_FAAD),yes)
  227. OBJS+= faad.o
  228. ifeq ($(CONFIG_FAADBIN),yes)
  229. # no libs needed
  230. else
  231. EXTRALIBS += -lfaad
  232. endif
  233. endif
  234. ifeq ($(CONFIG_FAAC),yes)
  235. OBJS+= faac.o
  236. EXTRALIBS += -lfaac
  237. endif
  238. ifeq ($(CONFIG_XVID),yes)
  239. OBJS+= xvidff.o
  240. EXTRALIBS += -lxvidcore
  241. endif
  242. ifeq ($(CONFIG_X264),yes)
  243. OBJS+= x264.o
  244. EXTRALIBS += -lx264
  245. endif
  246. ifeq ($(CONFIG_PP),yes)
  247. ifeq ($(SHARED_PP),yes)
  248. EXTRALIBS += -L$(VPATH)/libpostproc -lpostproc$(BUILDSUF)
  249. else
  250. # LIBS += libpostproc/libpostproc.a ... should be fixed
  251. OBJS += libpostproc/postprocess.o
  252. endif
  253. endif
  254. ifeq ($(CONFIG_MP3LAME),yes)
  255. OBJS += mp3lameaudio.o
  256. EXTRALIBS += -lmp3lame
  257. endif
  258. ifeq ($(CONFIG_LIBOGG),yes)
  259. ifeq ($(CONFIG_LIBVORBIS),yes)
  260. OBJS += oggvorbis.o
  261. EXTRALIBS += -lvorbisenc -lvorbis
  262. endif
  263. ifeq ($(CONFIG_LIBTHEORA), yes)
  264. OBJS += oggtheora.o
  265. EXTRALIBS += -ltheora
  266. endif
  267. EXTRALIBS += -logg
  268. endif
  269. ifeq ($(TARGET_GPROF),yes)
  270. CFLAGS+=-p
  271. LDFLAGS+=-p
  272. endif
  273. # i386 mmx specific stuff
  274. ifeq ($(TARGET_MMX),yes)
  275. OBJS += i386/fdct_mmx.o i386/cputest.o \
  276. i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
  277. i386/idct_mmx.o i386/motion_est_mmx.o \
  278. i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
  279. i386/vp3dsp_sse2.o
  280. ifdef TARGET_BUILTIN_VECTOR
  281. i386/fft_sse.o: CFLAGS+= -msse
  282. depend: CFLAGS+= -msse
  283. endif
  284. endif
  285. # armv4l specific stuff
  286. ifeq ($(TARGET_ARCH_ARMV4L),yes)
  287. ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
  288. OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
  289. endif
  290. # sun mediaLib specific stuff
  291. # currently only works when libavcodec is used in mplayer
  292. ifeq ($(HAVE_MLIB),yes)
  293. OBJS += mlib/dsputil_mlib.o
  294. CFLAGS += $(MLIB_INC)
  295. endif
  296. # alpha specific stuff
  297. ifeq ($(TARGET_ARCH_ALPHA),yes)
  298. OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
  299. alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
  300. ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
  301. CFLAGS += -fforce-addr
  302. endif
  303. ifeq ($(TARGET_ARCH_POWERPC),yes)
  304. OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
  305. endif
  306. ifeq ($(TARGET_MMI),yes)
  307. OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
  308. endif
  309. ifeq ($(TARGET_ALTIVEC),yes)
  310. OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
  311. ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o \
  312. ppc/dsputil_h264_altivec.o
  313. endif
  314. ifeq ($(TARGET_ARCH_SH4),yes)
  315. OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
  316. endif
  317. ifeq ($(TARGET_ARCH_SPARC),yes)
  318. OBJS+=sparc/dsputil_vis.o
  319. sparc/%.o: sparc/%.c
  320. $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $<
  321. endif
  322. ifeq ($(TARGET_ARCH_SPARC64),yes)
  323. CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
  324. endif
  325. SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
  326. OBJS := $(OBJS) $(ASM_OBJS)
  327. LIB= $(LIBPREF)avcodec$(LIBSUF)
  328. ifeq ($(BUILD_SHARED),yes)
  329. SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
  330. endif
  331. TESTS= imgresample-test dct-test motion-test fft-test
  332. all: $(LIB) $(SLIB)
  333. amrlibs:
  334. $(MAKE) -C amr spclib fipoplib
  335. tests: apiexample cpuid_test $(TESTS)
  336. $(LIB): $(OBJS) $(AMRLIBS)
  337. rm -f $@
  338. $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
  339. $(RANLIB) $@
  340. $(SLIB): $(OBJS)
  341. ifeq ($(CONFIG_PP),yes)
  342. $(MAKE) -C libpostproc
  343. endif
  344. ifeq ($(CONFIG_WIN32),yes)
  345. $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
  346. -lib /machine:i386 /def:$(@:.dll=.def)
  347. else
  348. $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS) $(LDFLAGS)
  349. endif
  350. dsputil.o: dsputil.c dsputil.h
  351. libpostproc/libpostproc.a:
  352. $(MAKE) -C libpostproc
  353. %.o: %.c
  354. $(CC) $(CFLAGS) -c -o $@ $<
  355. %.o: %.S
  356. $(CC) $(CFLAGS) -c -o $@ $<
  357. depend: $(SRCS)
  358. $(CC) -MM $(CFLAGS) $^ 1>.depend
  359. dep: depend
  360. clean: $(CLEANAMR)
  361. rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
  362. armv4l/*.o armv4l/*~ \
  363. mlib/*.o mlib/*~ \
  364. alpha/*.o alpha/*~ \
  365. ppc/*.o ppc/*~ \
  366. ps2/*.o ps2/*~ \
  367. sh4/*.o sh4/*~ \
  368. sparc/*.o sparc/*~ \
  369. liba52/*.o liba52/*~ \
  370. apiexample $(TESTS)
  371. $(MAKE) -C libpostproc clean
  372. distclean: clean
  373. rm -f Makefile.bak .depend
  374. cleanamr:
  375. $(MAKE) -C amr clean
  376. cleanamrfloat:
  377. rm -f amr_float/*.o
  378. cleanamrwbfloat:
  379. $(MAKE) -C amrwb_float -f makefile.gcc clean
  380. # api example program
  381. apiexample: apiexample.c $(LIB)
  382. $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
  383. # cpuid test
  384. cpuid_test: i386/cputest.c
  385. $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
  386. # testing progs
  387. imgresample-test: imgresample.c
  388. $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
  389. dct-test: dct-test.o fdctref.o $(LIB)
  390. $(CC) -o $@ $^ -lm
  391. motion-test: motion_test.o $(LIB)
  392. $(CC) -o $@ $^ -lm
  393. fft-test: fft-test.o $(LIB)
  394. $(CC) -o $@ $^ -lm
  395. ifeq ($(BUILD_SHARED),yes)
  396. install: all install-headers
  397. ifeq ($(CONFIG_WIN32),yes)
  398. install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
  399. else
  400. install -d $(libdir)
  401. install $(INSTALLSTRIP) -m 755 $(SLIB) $(libdir)/libavcodec-$(VERSION).so
  402. ln -sf libavcodec-$(VERSION).so $(libdir)/libavcodec.so
  403. ldconfig || true
  404. endif
  405. ifeq ($(CONFIG_PP),yes)
  406. $(MAKE) -C libpostproc $@
  407. endif
  408. else
  409. install:
  410. endif
  411. installlib: all install-headers
  412. install -m 644 $(LIB) "$(libdir)"
  413. install-headers:
  414. mkdir -p "$(prefix)/include/ffmpeg"
  415. install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
  416. $(SRC_PATH)/libavcodec/common.h \
  417. $(SRC_PATH)/libavcodec/rational.h \
  418. "$(prefix)/include/ffmpeg"
  419. #
  420. # include dependency files if they exist
  421. #
  422. ifneq ($(wildcard .depend),)
  423. include .depend
  424. endif