libdts support by (Benjamin Zores <ben at geexbox dot org>)
[libav.git] / libavcodec / Makefile
1 #
2 # libavcodec Makefile
3 # (c) 2000-2003 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.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
11
12 OBJS= common.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 dv.o error_resilience.o \
18 fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
19 vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o \
20 roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o \
21 msvideo1.o vqavideo.o idcinvideo.o adx.o rational.o faandct.o 8bps.o \
22 smc.o parser.o flicvideo.o truemotion1.o vmdav.o lcl.o qtrle.o g726.o \
23 flac.o vp3dsp.o integer.o
24
25 ifeq ($(AMR_NB),yes)
26 ifeq ($(AMR_NB_FIXED),yes)
27 OBJS+= amr.o
28 AMREXTRALIBS+= amr/*.o
29 AMRLIBS=amrlibs
30 CLEANAMR=cleanamr
31 else
32 OBJS+= amr.o amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
33 CLEANAMR=cleanamrfloat
34 endif
35 endif
36
37 ifeq ($(HAVE_PTHREADS),yes)
38 OBJS+= pthread.o
39 endif
40
41 ifeq ($(HAVE_W32THREADS),yes)
42 OBJS+= w32thread.o
43 endif
44
45 ifeq ($(AMR_WB),yes)
46 OBJS+= amr.o amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
47 amrwb_float/dec_if.o amrwb_float/dec_lpc.o amrwb_float/dec_main.o \
48 amrwb_float/dec_rom.o amrwb_float/dec_util.o amrwb_float/enc_acelp.o \
49 amrwb_float/enc_dtx.o amrwb_float/enc_gain.o amrwb_float/enc_if.o \
50 amrwb_float/enc_lpc.o amrwb_float/enc_main.o amrwb_float/enc_rom.o \
51 amrwb_float/enc_util.o amrwb_float/if_rom.o
52 endif
53 CLEANAMRWB=cleanamrwbfloat
54 ASM_OBJS=
55
56 # codecs which are patented in some non free countries like the us
57 ifeq ($(CONFIG_RISKY),yes)
58 OBJS+= h263.o h261.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
59 endif
60
61 ifeq ($(HAVE_XVMC_ACCEL),yes)
62 OBJS+= xvmcvideo.o
63 endif
64
65 # currently using liba52 for ac3 decoding
66 ifeq ($(CONFIG_AC3),yes)
67 OBJS+= a52dec.o
68
69 # using builtin liba52 or runtime linked liba52.so.0
70 ifneq ($(CONFIG_A52BIN),yes)
71 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
72 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
73 endif
74 endif
75
76 # currently using libdts for dts decoding
77 ifeq ($(CONFIG_DTS),yes)
78 OBJS+= dtsdec.o
79 endif
80
81 ifeq ($(CONFIG_FAAD),yes)
82 OBJS+= faad.o
83 ifeq ($(CONFIG_FAADBIN),yes)
84 # no libs needed
85 else
86 EXTRALIBS += -lfaad
87 endif
88 endif
89
90 ifeq ($(CONFIG_FAAC),yes)
91 OBJS+= faac.o
92 EXTRALIBS += -lfaac
93 endif
94
95 ifeq ($(CONFIG_PP),yes)
96 ifeq ($(SHARED_PP),yes)
97 EXTRALIBS += -lpostproc
98 else
99 # LIBS += libpostproc/libpostproc.a ... should be fixed
100 OBJS += libpostproc/postprocess.o
101 endif
102 endif
103
104 ifeq ($(CONFIG_MP3LAME),yes)
105 OBJS += mp3lameaudio.o
106 EXTRALIBS += -lmp3lame
107 endif
108
109 ifeq ($(CONFIG_VORBIS),yes)
110 OBJS += oggvorbis.o
111 EXTRALIBS += -lvorbis -lvorbisenc
112 endif
113
114 ifeq ($(TARGET_GPROF),yes)
115 CFLAGS+=-p
116 LDFLAGS+=-p
117 endif
118
119 # i386 mmx specific stuff
120 ifeq ($(TARGET_MMX),yes)
121 OBJS += i386/fdct_mmx.o i386/cputest.o \
122 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
123 i386/idct_mmx.o i386/motion_est_mmx.o \
124 i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
125 i386/vp3dsp_sse2.o
126 ifdef TARGET_BUILTIN_VECTOR
127 i386/fft_sse.o: CFLAGS+= -msse
128 depend: CFLAGS+= -msse
129 endif
130 endif
131
132 # armv4l specific stuff
133 ifeq ($(TARGET_ARCH_ARMV4L),yes)
134 ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
135 OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
136 endif
137
138 # sun mediaLib specific stuff
139 # currently only works when libavcodec is used in mplayer
140 ifeq ($(HAVE_MLIB),yes)
141 OBJS += mlib/dsputil_mlib.o
142 CFLAGS += $(MLIB_INC)
143 endif
144
145 # alpha specific stuff
146 ifeq ($(TARGET_ARCH_ALPHA),yes)
147 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
148 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
149 ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
150 CFLAGS += -fforce-addr -freduce-all-givs
151 endif
152
153 ifeq ($(TARGET_ARCH_POWERPC),yes)
154 OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
155 endif
156
157 ifeq ($(TARGET_MMI),yes)
158 OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
159 endif
160
161 ifeq ($(TARGET_ALTIVEC),yes)
162 OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
163 ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o
164 endif
165
166 ifeq ($(TARGET_ARCH_SH4),yes)
167 OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
168 endif
169
170 ifeq ($(TARGET_ARCH_SPARC),yes)
171 OBJS+=sparc/dsputil_vis.o
172 sparc/%.o: sparc/%.c
173 $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $<
174 endif
175 ifeq ($(TARGET_ARCH_SPARC64),yes)
176 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
177 endif
178
179 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
180 OBJS := $(OBJS) $(ASM_OBJS)
181
182 LIB= $(LIBPREF)avcodec$(LIBSUF)
183 ifeq ($(BUILD_SHARED),yes)
184 SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
185 endif
186 TESTS= imgresample-test dct-test motion-test fft-test
187
188 all: $(LIB) $(SLIB)
189
190 amrlibs:
191 $(MAKE) -C amr spclib fipoplib
192
193 tests: apiexample cpuid_test $(TESTS)
194
195 $(LIB): $(OBJS) $(AMRLIBS)
196 rm -f $@
197 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
198 $(RANLIB) $@
199
200 $(SLIB): $(OBJS)
201 ifeq ($(CONFIG_WIN32),yes)
202 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
203 -lib /machine:i386 /def:$(@:.dll=.def)
204 else
205 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS) $(LDFLAGS)
206 endif
207
208 dsputil.o: dsputil.c dsputil.h
209
210 libpostproc/libpostproc.a:
211 $(MAKE) -C libpostproc
212
213 %.o: %.c
214 $(CC) $(CFLAGS) -c -o $@ $<
215
216 %.o: %.S
217 $(CC) $(CFLAGS) -c -o $@ $<
218
219 depend: $(SRCS)
220 $(CC) -MM $(CFLAGS) $^ 1>.depend
221
222 dep: depend
223
224 clean: $(CLEANAMR)
225 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
226 armv4l/*.o armv4l/*~ \
227 mlib/*.o mlib/*~ \
228 alpha/*.o alpha/*~ \
229 ppc/*.o ppc/*~ \
230 ps2/*.o ps2/*~ \
231 sh4/*.o sh4/*~ \
232 sparc/*.o sparc/*~ \
233 liba52/*.o liba52/*~ \
234 apiexample $(TESTS)
235 $(MAKE) -C libpostproc clean
236
237 distclean: clean
238 rm -f Makefile.bak .depend
239
240 cleanamr:
241 $(MAKE) -C amr clean
242
243 cleanamrfloat:
244 rm -f amr_float/*.o
245
246 cleanamrwbfloat:
247 $(MAKE) -C amrwb_float -f makefile.gcc clean
248
249 # api example program
250 apiexample: apiexample.c $(LIB)
251 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
252
253 # cpuid test
254 cpuid_test: i386/cputest.c
255 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
256
257 # testing progs
258
259 imgresample-test: imgresample.c
260 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
261
262 dct-test: dct-test.o fdctref.o $(LIB)
263 $(CC) -o $@ $^ -lm
264
265 motion-test: motion_test.o $(LIB)
266 $(CC) -o $@ $^ -lm
267
268 fft-test: fft-test.o $(LIB)
269 $(CC) -o $@ $^ -lm
270
271 ifeq ($(BUILD_SHARED),yes)
272 install: all install-headers
273 ifeq ($(CONFIG_WIN32),yes)
274 install -s -m 755 $(SLIB) "$(prefix)"
275 else
276 install -d $(prefix)/lib
277 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
278 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
279 ldconfig || true
280 endif
281 else
282 install:
283 endif
284
285 installlib: all install-headers
286 install -m 644 $(LIB) $(prefix)/lib
287
288 install-headers:
289 mkdir -p "$(prefix)/include/ffmpeg"
290 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
291 $(SRC_PATH)/libavcodec/common.h \
292 $(SRC_PATH)/libavcodec/rational.h \
293 "$(prefix)/include/ffmpeg"
294
295 #
296 # include dependency files if they exist
297 #
298 ifneq ($(wildcard .depend),)
299 include .depend
300 endif