9e643675b7eb634ba3d4a492935fc37634c8025b
[libav.git] / 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
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 EXTRALIBS += -ldts
245 endif
246
247 ifeq ($(CONFIG_FAAD),yes)
248 OBJS+= faad.o
249 ifeq ($(CONFIG_FAADBIN),yes)
250 # no libs needed
251 else
252 EXTRALIBS += -lfaad
253 endif
254 endif
255
256 ifeq ($(CONFIG_FAAC),yes)
257 OBJS+= faac.o
258 EXTRALIBS += -lfaac
259 endif
260
261 ifeq ($(CONFIG_XVID),yes)
262 OBJS+= xvidff.o
263 EXTRALIBS += -lxvidcore
264 endif
265
266 ifeq ($(CONFIG_X264),yes)
267 OBJS+= x264.o
268 EXTRALIBS += -lx264
269 endif
270
271 ifeq ($(CONFIG_PP),yes)
272 ifeq ($(SHARED_PP),yes)
273 EXTRALIBS += -Llibpostproc -lpostproc$(BUILDSUF)
274 else
275 # LIBS += libpostproc/libpostproc.a ... should be fixed
276 OBJS += libpostproc/postprocess.o
277 endif
278 endif
279
280 ifeq ($(CONFIG_MP3LAME),yes)
281 OBJS += mp3lameaudio.o
282 EXTRALIBS += -lmp3lame
283 endif
284
285 ifeq ($(CONFIG_LIBOGG),yes)
286 ifeq ($(CONFIG_LIBVORBIS),yes)
287 OBJS += oggvorbis.o
288 EXTRALIBS += -lvorbisenc -lvorbis
289 endif
290 ifeq ($(CONFIG_LIBTHEORA), yes)
291 OBJS += oggtheora.o
292 EXTRALIBS += -ltheora
293 endif
294 EXTRALIBS += -logg
295 endif
296
297 ifeq ($(CONFIG_LIBGSM),yes)
298 OBJS += libgsm.o
299 EXTRALIBS += -lgsm
300 endif
301
302 ifeq ($(TARGET_GPROF),yes)
303 CFLAGS+=-p
304 LDFLAGS+=-p
305 endif
306
307 # i386 mmx specific stuff
308 ifeq ($(TARGET_MMX),yes)
309 OBJS += i386/fdct_mmx.o i386/cputest.o \
310 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
311 i386/idct_mmx.o i386/motion_est_mmx.o \
312 i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
313 i386/vp3dsp_sse2.o
314 ifeq ($(CONFIG_GPL),yes)
315 OBJS += i386/idct_mmx_xvid.o
316 endif
317 ifdef TARGET_BUILTIN_VECTOR
318 i386/fft_sse.o: CFLAGS+= -msse
319 depend: CFLAGS+= -msse
320 endif
321 endif
322
323 # armv4l specific stuff
324 ifeq ($(TARGET_ARCH_ARMV4L),yes)
325 ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o armv4l/dsputil_arm_s.o
326 OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
327 ifeq ($(TARGET_IWMMXT),yes)
328 OBJS += armv4l/dsputil_iwmmxt.o armv4l/mpegvideo_iwmmxt.o
329 endif
330 endif
331
332 # sun mediaLib specific stuff
333 # currently only works when libavcodec is used in mplayer
334 ifeq ($(HAVE_MLIB),yes)
335 OBJS += mlib/dsputil_mlib.o
336 CFLAGS += $(MLIB_INC)
337 endif
338
339 # Intel IPP specific stuff
340 # currently only works when libavcodec is used in mplayer
341 ifeq ($(HAVE_IPP),yes)
342 CFLAGS += $(IPP_INC)
343 endif
344
345 # alpha specific stuff
346 ifeq ($(TARGET_ARCH_ALPHA),yes)
347 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
348 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
349 ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
350 CFLAGS += -fforce-addr
351 endif
352
353 ifeq ($(TARGET_ARCH_POWERPC),yes)
354 OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
355 endif
356
357 ifeq ($(TARGET_MMI),yes)
358 OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
359 endif
360
361 ifeq ($(TARGET_ALTIVEC),yes)
362 OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
363 ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o \
364 ppc/dsputil_h264_altivec.o
365 endif
366
367 ifeq ($(TARGET_ARCH_SH4),yes)
368 OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
369 endif
370
371 ifeq ($(TARGET_ARCH_SPARC),yes)
372 OBJS+=sparc/dsputil_vis.o
373 sparc/%.o: sparc/%.c
374 $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $<
375 endif
376 ifeq ($(TARGET_ARCH_SPARC64),yes)
377 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
378 endif
379
380 # Darwin specific stuff
381 ifeq ($(CONFIG_DARWIN),yes)
382 SHFLAGS += -Wl,-install_name,$(libdir)/$(SLIBPREF)avcodec$(SLIBSUF),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION)
383 endif
384
385 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
386 OBJS := $(OBJS) $(ASM_OBJS)
387
388 LIB= $(LIBPREF)avcodec$(LIBSUF)
389 LIBAVUTIL= $(SRC_PATH)/libavutil/$(LIBPREF)avutil$(LIBSUF)
390 ifeq ($(BUILD_SHARED),yes)
391 SLIBNAME= $(SLIBPREF)avcodec$(SLIBSUF)
392 endif
393 TESTS= imgresample-test dct-test motion-test fft-test
394
395 all: $(LIB) $(SLIBNAME)
396
397 amrlibs:
398 $(MAKE) -C amr spclib fipoplib
399
400 tests: apiexample cpuid_test $(TESTS)
401
402 $(LIB): $(OBJS) $(AMRLIBS)
403 rm -f $@
404 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
405 $(RANLIB) $@
406
407 $(SLIBNAME): $(OBJS)
408 ifeq ($(CONFIG_PP),yes)
409 $(MAKE) -C libpostproc
410 endif
411 ifeq ($(CONFIG_WIN32),yes)
412 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
413 -lib /machine:i386 /def:$(@:.dll=.def)
414 else
415 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
416 endif
417
418 dsputil.o: dsputil.c dsputil.h
419
420 libpostproc/libpostproc.a:
421 $(MAKE) -C libpostproc
422
423 %.o: %.c
424 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
425
426 %.o: %.S
427 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
428
429 depend: $(SRCS)
430 $(CC) -MM $(CFLAGS) $^ 1>.depend
431
432 dep: depend
433
434 clean: $(CLEANAMR)
435 rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF) i386/*.o i386/*~ \
436 armv4l/*.o armv4l/*~ \
437 mlib/*.o mlib/*~ \
438 alpha/*.o alpha/*~ \
439 ppc/*.o ppc/*~ \
440 ps2/*.o ps2/*~ \
441 sh4/*.o sh4/*~ \
442 sparc/*.o sparc/*~ \
443 liba52/*.o liba52/*~ \
444 apiexample $(TESTS)
445 $(MAKE) -C libpostproc clean
446
447 distclean: clean
448 rm -f Makefile.bak .depend
449
450 cleanamr:
451 $(MAKE) -C amr clean
452
453 cleanamrfloat:
454 rm -f amr_float/*.o
455
456 cleanamrwbfloat:
457 $(MAKE) -C amrwb_float -f makefile.gcc clean
458
459 # api example program
460 apiexample: apiexample.c $(LIB)
461 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(LIBAVUTIL) $(EXTRALIBS) -lm
462
463 # cpuid test
464 cpuid_test: i386/cputest.c
465 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
466
467 # testing progs
468
469 imgresample-test: imgresample.c
470 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
471
472 dct-test: dct-test.o fdctref.o $(LIB)
473 $(CC) -o $@ $^ -lm $(LIBAVUTIL)
474
475 motion-test: motion_test.o $(LIB)
476 $(CC) -o $@ $^ -lm
477
478 fft-test: fft-test.o $(LIB)
479 $(CC) -o $@ $^ $(LIBAVUTIL) -lm
480
481 ifeq ($(BUILD_SHARED),yes)
482 install: all install-headers
483 ifeq ($(CONFIG_WIN32),yes)
484 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
485 else
486 install -d $(libdir)
487 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/libavcodec-$(VERSION)$(SLIBSUF)
488 ln -sf libavcodec-$(VERSION)$(SLIBSUF) $(libdir)/libavcodec$(SLIBSUF)
489 $(LDCONFIG) || true
490 endif
491 ifeq ($(CONFIG_PP),yes)
492 $(MAKE) -C libpostproc $@
493 endif
494 else
495 install:
496 endif
497
498 installlib: all install-headers
499 install -m 644 $(LIB) "$(libdir)"
500
501 install-headers:
502 mkdir -p "$(prefix)/include/ffmpeg"
503 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
504 "$(prefix)/include/ffmpeg"
505 install -d $(libdir)/pkgconfig
506 install -m 644 ../libavcodec.pc $(libdir)/pkgconfig
507
508 #
509 # include dependency files if they exist
510 #
511 ifneq ($(wildcard .depend),)
512 include .depend
513 endif