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