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.

504 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.. -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 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. # currently using libdts for dts decoding
  224. ifeq ($(CONFIG_DTS),yes)
  225. OBJS+= dtsdec.o
  226. CFLAGS += $(DTS_INC)
  227. EXTRALIBS += -ldts
  228. endif
  229. ifeq ($(CONFIG_FAAD),yes)
  230. OBJS+= faad.o
  231. ifeq ($(CONFIG_FAADBIN),yes)
  232. # no libs needed
  233. else
  234. EXTRALIBS += -lfaad
  235. endif
  236. endif
  237. ifeq ($(CONFIG_FAAC),yes)
  238. OBJS+= faac.o
  239. EXTRALIBS += -lfaac
  240. endif
  241. ifeq ($(CONFIG_XVID),yes)
  242. OBJS+= xvidff.o
  243. EXTRALIBS += -lxvidcore
  244. endif
  245. ifeq ($(CONFIG_X264),yes)
  246. OBJS+= x264.o
  247. EXTRALIBS += -lx264
  248. endif
  249. ifeq ($(CONFIG_PP),yes)
  250. ifeq ($(SHARED_PP),yes)
  251. EXTRALIBS += -Llibpostproc -lpostproc$(BUILDSUF)
  252. else
  253. # LIBS += libpostproc/libpostproc.a ... should be fixed
  254. OBJS += libpostproc/postprocess.o
  255. endif
  256. endif
  257. ifeq ($(CONFIG_MP3LAME),yes)
  258. OBJS += mp3lameaudio.o
  259. EXTRALIBS += -lmp3lame
  260. endif
  261. ifeq ($(CONFIG_LIBOGG),yes)
  262. ifeq ($(CONFIG_LIBVORBIS),yes)
  263. OBJS += oggvorbis.o
  264. EXTRALIBS += -lvorbisenc -lvorbis
  265. endif
  266. ifeq ($(CONFIG_LIBTHEORA), yes)
  267. OBJS += oggtheora.o
  268. EXTRALIBS += -ltheora
  269. endif
  270. EXTRALIBS += -logg
  271. endif
  272. ifeq ($(CONFIG_LIBGSM),yes)
  273. OBJS += libgsm.o
  274. EXTRALIBS += -lgsm
  275. endif
  276. ifeq ($(TARGET_GPROF),yes)
  277. CFLAGS+=-p
  278. LDFLAGS+=-p
  279. endif
  280. # i386 mmx specific stuff
  281. ifeq ($(TARGET_MMX),yes)
  282. OBJS += i386/fdct_mmx.o i386/cputest.o \
  283. i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
  284. i386/idct_mmx.o i386/motion_est_mmx.o \
  285. i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
  286. i386/vp3dsp_sse2.o
  287. ifdef TARGET_BUILTIN_VECTOR
  288. i386/fft_sse.o: CFLAGS+= -msse
  289. depend: CFLAGS+= -msse
  290. endif
  291. endif
  292. # armv4l specific stuff
  293. ifeq ($(TARGET_ARCH_ARMV4L),yes)
  294. ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o armv4l/dsputil_arm_s.o
  295. OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
  296. ifeq ($(TARGET_IWMMXT),yes)
  297. OBJS += armv4l/dsputil_iwmmxt.o armv4l/mpegvideo_iwmmxt.o
  298. endif
  299. endif
  300. # sun mediaLib specific stuff
  301. # currently only works when libavcodec is used in mplayer
  302. ifeq ($(HAVE_MLIB),yes)
  303. OBJS += mlib/dsputil_mlib.o
  304. CFLAGS += $(MLIB_INC)
  305. endif
  306. # Intel IPP specific stuff
  307. # currently only works when libavcodec is used in mplayer
  308. ifeq ($(HAVE_IPP),yes)
  309. CFLAGS += $(IPP_INC)
  310. endif
  311. # alpha specific stuff
  312. ifeq ($(TARGET_ARCH_ALPHA),yes)
  313. OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
  314. alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
  315. ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
  316. CFLAGS += -fforce-addr
  317. endif
  318. ifeq ($(TARGET_ARCH_POWERPC),yes)
  319. OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
  320. endif
  321. ifeq ($(TARGET_MMI),yes)
  322. OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
  323. endif
  324. ifeq ($(TARGET_ALTIVEC),yes)
  325. OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
  326. ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o \
  327. ppc/dsputil_h264_altivec.o
  328. endif
  329. ifeq ($(TARGET_ARCH_SH4),yes)
  330. OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
  331. endif
  332. ifeq ($(TARGET_ARCH_SPARC),yes)
  333. OBJS+=sparc/dsputil_vis.o
  334. sparc/%.o: sparc/%.c
  335. $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $<
  336. endif
  337. ifeq ($(TARGET_ARCH_SPARC64),yes)
  338. CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
  339. endif
  340. SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
  341. OBJS := $(OBJS) $(ASM_OBJS)
  342. LIB= $(LIBPREF)avcodec$(LIBSUF)
  343. ifeq ($(BUILD_SHARED),yes)
  344. SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
  345. endif
  346. TESTS= imgresample-test dct-test motion-test fft-test
  347. all: $(LIB) $(SLIB)
  348. amrlibs:
  349. $(MAKE) -C amr spclib fipoplib
  350. tests: apiexample cpuid_test $(TESTS)
  351. $(LIB): $(OBJS) $(AMRLIBS)
  352. rm -f $@
  353. $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
  354. $(RANLIB) $@
  355. $(SLIB): $(OBJS)
  356. ifeq ($(CONFIG_PP),yes)
  357. $(MAKE) -C libpostproc
  358. endif
  359. ifeq ($(CONFIG_WIN32),yes)
  360. $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
  361. -lib /machine:i386 /def:$(@:.dll=.def)
  362. else
  363. $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS) $(LDFLAGS)
  364. endif
  365. dsputil.o: dsputil.c dsputil.h
  366. libpostproc/libpostproc.a:
  367. $(MAKE) -C libpostproc
  368. %.o: %.c
  369. $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
  370. %.o: %.S
  371. $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
  372. depend: $(SRCS)
  373. $(CC) -MM $(CFLAGS) $^ 1>.depend
  374. dep: depend
  375. clean: $(CLEANAMR)
  376. rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
  377. armv4l/*.o armv4l/*~ \
  378. mlib/*.o mlib/*~ \
  379. alpha/*.o alpha/*~ \
  380. ppc/*.o ppc/*~ \
  381. ps2/*.o ps2/*~ \
  382. sh4/*.o sh4/*~ \
  383. sparc/*.o sparc/*~ \
  384. liba52/*.o liba52/*~ \
  385. apiexample $(TESTS)
  386. $(MAKE) -C libpostproc clean
  387. distclean: clean
  388. rm -f Makefile.bak .depend
  389. cleanamr:
  390. $(MAKE) -C amr clean
  391. cleanamrfloat:
  392. rm -f amr_float/*.o
  393. cleanamrwbfloat:
  394. $(MAKE) -C amrwb_float -f makefile.gcc clean
  395. # api example program
  396. apiexample: apiexample.c $(LIB)
  397. $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
  398. # cpuid test
  399. cpuid_test: i386/cputest.c
  400. $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
  401. # testing progs
  402. imgresample-test: imgresample.c
  403. $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
  404. dct-test: dct-test.o fdctref.o $(LIB)
  405. $(CC) -o $@ $^ -lm
  406. motion-test: motion_test.o $(LIB)
  407. $(CC) -o $@ $^ -lm
  408. fft-test: fft-test.o $(LIB)
  409. $(CC) -o $@ $^ -lm
  410. ifeq ($(BUILD_SHARED),yes)
  411. install: all install-headers
  412. ifeq ($(CONFIG_WIN32),yes)
  413. install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
  414. else
  415. install -d $(libdir)
  416. install $(INSTALLSTRIP) -m 755 $(SLIB) $(libdir)/libavcodec-$(VERSION).so
  417. ln -sf libavcodec-$(VERSION).so $(libdir)/libavcodec.so
  418. $(LDCONFIG) || true
  419. endif
  420. ifeq ($(CONFIG_PP),yes)
  421. $(MAKE) -C libpostproc $@
  422. endif
  423. else
  424. install:
  425. endif
  426. installlib: all install-headers
  427. install -m 644 $(LIB) "$(libdir)"
  428. install-headers:
  429. mkdir -p "$(prefix)/include/ffmpeg"
  430. install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
  431. $(SRC_PATH)/libavcodec/common.h \
  432. $(SRC_PATH)/libavcodec/rational.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