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.

505 lines
12KB

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