AVOption removial patch from (James A. Morrison >ja2morri csclub.uwaterloo ca>)
[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.. -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 dv.o error_resilience.o \
18 fft.o mdct.o mace.o huffyuv.o cyuv.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 snow.o tscc.o sonic.o ulti.o h264idct.o \
24 qdrw.o xl.o rangecoder.o png.o pnm.o qpeg.o vc9.o h263.o h261.o \
25 msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o shorten.o loco.o \
26 alac.o
27
28 AMROBJS=
29 ifeq ($(AMR_NB),yes)
30 ifeq ($(AMR_NB_FIXED),yes)
31 AMROBJS= amr.o
32 AMREXTRALIBS+= amr/*.o
33 AMRLIBS=amrlibs
34 CLEANAMR=cleanamr
35 else
36 AMROBJS= amr.o
37 OBJS+= amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
38 CLEANAMR=cleanamrfloat
39 endif
40 endif
41
42 ifeq ($(HAVE_PTHREADS),yes)
43 OBJS+= pthread.o
44 endif
45
46 ifeq ($(HAVE_W32THREADS),yes)
47 OBJS+= w32thread.o
48 endif
49
50 ifeq ($(HAVE_BEOSTHREADS),yes)
51 OBJS+= beosthread.o
52 endif
53
54 ifeq ($(AMR_WB),yes)
55 AMROBJS= amr.o
56 OBJS+= amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
57 amrwb_float/dec_if.o amrwb_float/dec_lpc.o amrwb_float/dec_main.o \
58 amrwb_float/dec_rom.o amrwb_float/dec_util.o amrwb_float/enc_acelp.o \
59 amrwb_float/enc_dtx.o amrwb_float/enc_gain.o amrwb_float/enc_if.o \
60 amrwb_float/enc_lpc.o amrwb_float/enc_main.o amrwb_float/enc_rom.o \
61 amrwb_float/enc_util.o amrwb_float/if_rom.o
62 endif
63 OBJS+= $(AMROBJS)
64 CLEANAMRWB=cleanamrwbfloat
65 ASM_OBJS=
66
67 ifeq ($(HAVE_XVMC_ACCEL),yes)
68 OBJS+= xvmcvideo.o
69 endif
70
71 # currently using liba52 for ac3 decoding
72 ifeq ($(CONFIG_AC3),yes)
73 OBJS+= a52dec.o
74
75 # using builtin liba52 or runtime linked liba52.so.0
76 ifneq ($(CONFIG_A52BIN),yes)
77 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
78 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
79 endif
80 endif
81
82 # currently using libdts for dts decoding
83 ifeq ($(CONFIG_DTS),yes)
84 OBJS+= dtsdec.o
85 CFLAGS += $(DTS_INC)
86 EXTRALIBS += -ldts
87 endif
88
89 ifeq ($(CONFIG_FAAD),yes)
90 OBJS+= faad.o
91 ifeq ($(CONFIG_FAADBIN),yes)
92 # no libs needed
93 else
94 EXTRALIBS += -lfaad
95 endif
96 endif
97
98 ifeq ($(CONFIG_FAAC),yes)
99 OBJS+= faac.o
100 EXTRALIBS += -lfaac
101 endif
102
103 ifeq ($(CONFIG_XVID),yes)
104 OBJS+= xvidff.o
105 EXTRALIBS += -lxvidcore
106 endif
107
108 ifeq ($(CONFIG_PP),yes)
109 ifeq ($(SHARED_PP),yes)
110 EXTRALIBS += -L$(VPATH)/libpostproc -lpostproc
111 else
112 # LIBS += libpostproc/libpostproc.a ... should be fixed
113 OBJS += libpostproc/postprocess.o
114 endif
115 endif
116
117 ifeq ($(CONFIG_MP3LAME),yes)
118 OBJS += mp3lameaudio.o
119 EXTRALIBS += -lmp3lame
120 endif
121
122 ifeq ($(CONFIG_LIBOGG),yes)
123 EXTRALIBS += -logg
124 ifeq ($(CONFIG_LIBVORBIS),yes)
125 OBJS += oggvorbis.o
126 EXTRALIBS += -lvorbis -lvorbisenc
127 endif
128 ifeq ($(CONFIG_LIBTHEORA), yes)
129 OBJS += oggtheora.o
130 EXTRALIBS += -ltheora
131 endif
132 endif
133
134 ifeq ($(TARGET_GPROF),yes)
135 CFLAGS+=-p
136 LDFLAGS+=-p
137 endif
138
139 # i386 mmx specific stuff
140 ifeq ($(TARGET_MMX),yes)
141 OBJS += i386/fdct_mmx.o i386/cputest.o \
142 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
143 i386/idct_mmx.o i386/motion_est_mmx.o \
144 i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
145 i386/vp3dsp_sse2.o
146 ifdef TARGET_BUILTIN_VECTOR
147 i386/fft_sse.o: CFLAGS+= -msse
148 depend: CFLAGS+= -msse
149 endif
150 endif
151
152 # armv4l specific stuff
153 ifeq ($(TARGET_ARCH_ARMV4L),yes)
154 ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
155 OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
156 endif
157
158 # sun mediaLib specific stuff
159 # currently only works when libavcodec is used in mplayer
160 ifeq ($(HAVE_MLIB),yes)
161 OBJS += mlib/dsputil_mlib.o
162 CFLAGS += $(MLIB_INC)
163 endif
164
165 # alpha specific stuff
166 ifeq ($(TARGET_ARCH_ALPHA),yes)
167 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
168 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
169 ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
170 CFLAGS += -fforce-addr
171 endif
172
173 ifeq ($(TARGET_ARCH_POWERPC),yes)
174 OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
175 endif
176
177 ifeq ($(TARGET_MMI),yes)
178 OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
179 endif
180
181 ifeq ($(TARGET_ALTIVEC),yes)
182 OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
183 ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o \
184 ppc/dsputil_h264_altivec.o
185 endif
186
187 ifeq ($(TARGET_ARCH_SH4),yes)
188 OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
189 endif
190
191 ifeq ($(TARGET_ARCH_SPARC),yes)
192 OBJS+=sparc/dsputil_vis.o
193 sparc/%.o: sparc/%.c
194 $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $<
195 endif
196 ifeq ($(TARGET_ARCH_SPARC64),yes)
197 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
198 endif
199
200 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
201 OBJS := $(OBJS) $(ASM_OBJS)
202
203 LIB= $(LIBPREF)avcodec$(LIBSUF)
204 ifeq ($(BUILD_SHARED),yes)
205 SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
206 endif
207 TESTS= imgresample-test dct-test motion-test fft-test
208
209 all: $(LIB) $(SLIB)
210
211 amrlibs:
212 $(MAKE) -C amr spclib fipoplib
213
214 tests: apiexample cpuid_test $(TESTS)
215
216 $(LIB): $(OBJS) $(AMRLIBS)
217 rm -f $@
218 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
219 $(RANLIB) $@
220
221 $(SLIB): $(OBJS)
222 ifeq ($(CONFIG_PP),yes)
223 $(MAKE) -C libpostproc
224 endif
225 ifeq ($(CONFIG_WIN32),yes)
226 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
227 -lib /machine:i386 /def:$(@:.dll=.def)
228 else
229 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS) $(LDFLAGS)
230 endif
231
232 dsputil.o: dsputil.c dsputil.h
233
234 libpostproc/libpostproc.a:
235 $(MAKE) -C libpostproc
236
237 %.o: %.c
238 $(CC) $(CFLAGS) -c -o $@ $<
239
240 %.o: %.S
241 $(CC) $(CFLAGS) -c -o $@ $<
242
243 depend: $(SRCS)
244 $(CC) -MM $(CFLAGS) $^ 1>.depend
245
246 dep: depend
247
248 clean: $(CLEANAMR)
249 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
250 armv4l/*.o armv4l/*~ \
251 mlib/*.o mlib/*~ \
252 alpha/*.o alpha/*~ \
253 ppc/*.o ppc/*~ \
254 ps2/*.o ps2/*~ \
255 sh4/*.o sh4/*~ \
256 sparc/*.o sparc/*~ \
257 liba52/*.o liba52/*~ \
258 apiexample $(TESTS)
259 $(MAKE) -C libpostproc clean
260
261 distclean: clean
262 rm -f Makefile.bak .depend
263
264 cleanamr:
265 $(MAKE) -C amr clean
266
267 cleanamrfloat:
268 rm -f amr_float/*.o
269
270 cleanamrwbfloat:
271 $(MAKE) -C amrwb_float -f makefile.gcc clean
272
273 # api example program
274 apiexample: apiexample.c $(LIB)
275 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
276
277 # cpuid test
278 cpuid_test: i386/cputest.c
279 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
280
281 # testing progs
282
283 imgresample-test: imgresample.c
284 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
285
286 dct-test: dct-test.o fdctref.o $(LIB)
287 $(CC) -o $@ $^ -lm
288
289 motion-test: motion_test.o $(LIB)
290 $(CC) -o $@ $^ -lm
291
292 fft-test: fft-test.o $(LIB)
293 $(CC) -o $@ $^ -lm
294
295 ifeq ($(BUILD_SHARED),yes)
296 install: all install-headers
297 ifeq ($(CONFIG_WIN32),yes)
298 install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
299 else
300 install -d $(prefix)/lib
301 install $(INSTALLSTRIP) -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
302 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
303 ldconfig || true
304 endif
305 ifeq ($(CONFIG_PP),yes)
306 $(MAKE) -C libpostproc $@
307 endif
308 else
309 install:
310 endif
311
312 installlib: all install-headers
313 install -m 644 $(LIB) "$(prefix)/lib"
314
315 install-headers:
316 mkdir -p "$(prefix)/include/ffmpeg"
317 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
318 $(SRC_PATH)/libavcodec/common.h \
319 $(SRC_PATH)/libavcodec/rational.h \
320 "$(prefix)/include/ffmpeg"
321
322 #
323 # include dependency files if they exist
324 #
325 ifneq ($(wildcard .depend),)
326 include .depend
327 endif