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