use get_format
[libav.git] / libavcodec / Makefile
CommitLineData
4cc281d9
FB
1#
2# libavcodec Makefile
cf7412b5 3# (c) 2000-2003 Fabrice Bellard
4cc281d9 4#
980fc7b8
FB
5include ../config.mak
6
4cc281d9
FB
7VPATH=$(SRC_PATH)/libavcodec
8
ff4ec49e 9# NOTE: -I.. is needed to include config.h
cf9d24ad 10CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
de6d9b64 11
773cefc6 12OBJS= common.o utils.o mem.o allcodecs.o \
1d0d55da 13 mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
10b7b472 14 mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
1d0d55da 15 motion_est.o imgconvert.o imgresample.o \
4f1bb8a9 16 mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
6d2abd6b 17 ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
d86053a4 18 fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
3ef8be2b 19 vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o \
2fdf638b 20 roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o \
11e29a41 21 msvideo1.o vqavideo.o idcinvideo.o adx.o rational.o faandct.o 8bps.o \
ac2570a8
MN
22 smc.o parser.o flicvideo.o truemotion1.o vmdav.o lcl.o qtrle.o g726.o \
23 flac.o
891f64b3 24
25ifeq ($(AMR_NB),yes)
bc634f6f 26ifeq ($(AMR_NB_FIXED),yes)
891f64b3 27OBJS+= amr.o
bc634f6f
ZK
28AMREXTRALIBS+= amr/*.o
29AMRLIBS=amrlibs
30CLEANAMR=cleanamr
31else
32OBJS+= amr.o amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
33CLEANAMR=cleanamrfloat
34endif
891f64b3 35endif
36
9c3d33d6
MN
37ifeq ($(HAVE_PTHREADS),yes)
38OBJS+= pthread.o
39endif
40
d663a1fd
MN
41ifeq ($(AMR_WB),yes)
42OBJS+= amr.o amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
43 amrwb_float/dec_if.o amrwb_float/dec_lpc.o amrwb_float/dec_main.o \
44 amrwb_float/dec_rom.o amrwb_float/dec_util.o amrwb_float/enc_acelp.o \
45 amrwb_float/enc_dtx.o amrwb_float/enc_gain.o amrwb_float/enc_if.o \
46 amrwb_float/enc_lpc.o amrwb_float/enc_main.o amrwb_float/enc_rom.o \
47 amrwb_float/enc_util.o amrwb_float/if_rom.o
48endif
49CLEANAMRWB=cleanamrwbfloat
980fc7b8 50ASM_OBJS=
de6d9b64 51
1d0d55da
MN
52# codecs which are patented in some non free countries like the us
53ifeq ($(CONFIG_RISKY),yes)
deabd4fd 54OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
1d0d55da
MN
55endif
56
4f1bb8a9
IK
57ifeq ($(HAVE_XVMC_ACCEL),yes)
58OBJS+= xvmcvideo.o
59endif
60
57514323 61# currently using liba52 for ac3 decoding
d771bcae 62ifeq ($(CONFIG_AC3),yes)
57514323 63OBJS+= a52dec.o
57514323
ZK
64
65# using builtin liba52 or runtime linked liba52.so.0
ff4ec49e 66ifneq ($(CONFIG_A52BIN),yes)
57514323 67OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
521221cf 68 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
d771bcae 69endif
ff4ec49e 70endif
de6d9b64 71
280bd7b7
ZK
72ifeq ($(CONFIG_FAAD),yes)
73OBJS+= faad.o
445ad18d
ZK
74ifeq ($(CONFIG_FAADBIN),yes)
75# no libs needed
76else
77EXTRALIBS += -lfaad
78endif
280bd7b7
ZK
79endif
80
29d48296
MN
81ifeq ($(CONFIG_FAAC),yes)
82OBJS+= faac.o
83EXTRALIBS += -lfaac
84endif
85
bba9b16c
MN
86ifeq ($(CONFIG_PP),yes)
87ifeq ($(SHARED_PP),yes)
88EXTRALIBS += -lpostproc
89else
90# LIBS += libpostproc/libpostproc.a ... should be fixed
91OBJS += libpostproc/postprocess.o
92endif
93endif
94
5798368b
J
95ifeq ($(CONFIG_MP3LAME),yes)
96OBJS += mp3lameaudio.o
2a2a98c0 97EXTRALIBS += -lmp3lame
5798368b
J
98endif
99
81e0d0b4
MH
100ifeq ($(CONFIG_VORBIS),yes)
101OBJS += oggvorbis.o
102EXTRALIBS += -lvorbis -lvorbisenc
103endif
104
43f1708f
J
105ifeq ($(TARGET_GPROF),yes)
106CFLAGS+=-p
107LDFLAGS+=-p
108endif
109
de6d9b64 110# i386 mmx specific stuff
980fc7b8 111ifeq ($(TARGET_MMX),yes)
4300403e 112OBJS += i386/fdct_mmx.o i386/cputest.o \
de1ee36a 113 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
57514323 114 i386/idct_mmx.o i386/motion_est_mmx.o \
923ceff8 115 i386/simple_idct_mmx.o i386/fft_sse.o
a968e365
FB
116ifdef TARGET_BUILTIN_VECTOR
117i386/fft_sse.o: CFLAGS+= -msse
118endif
de6d9b64
FB
119endif
120
3d03c0a2
FB
121# armv4l specific stuff
122ifeq ($(TARGET_ARCH_ARMV4L),yes)
bd7d1ea7 123ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
676e200c 124OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
3d03c0a2
FB
125endif
126
c34270f5
FB
127# sun mediaLib specific stuff
128# currently only works when libavcodec is used in mplayer
129ifeq ($(HAVE_MLIB),yes)
130OBJS += mlib/dsputil_mlib.o
131CFLAGS += $(MLIB_INC)
132endif
133
1e98dffb
NK
134# alpha specific stuff
135ifeq ($(TARGET_ARCH_ALPHA),yes)
8b313a47
FH
136OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
137 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
f9bb4bdf 138ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
0af65aac 139CFLAGS += -fforce-addr -freduce-all-givs
1e98dffb
NK
140endif
141
59925ef2 142ifeq ($(TARGET_ARCH_POWERPC),yes)
05c4072b 143OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
ab6c65f6
BF
144endif
145
d46aba26 146ifeq ($(TARGET_MMI),yes)
5917d17c 147OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
d46aba26
LS
148endif
149
ab6c65f6 150ifeq ($(TARGET_ALTIVEC),yes)
8d268a7d 151OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
14cabd40 152 ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o
59925ef2
BF
153endif
154
0c6bd2ea
B
155ifeq ($(TARGET_ARCH_SH4),yes)
156OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
157endif
158
159
bb7d4939 160SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
ff4ec49e 161OBJS := $(OBJS) $(ASM_OBJS)
980fc7b8 162
f3ec2d46 163LIB= $(LIBPREF)avcodec$(LIBSUF)
0fd94442 164ifeq ($(BUILD_SHARED),yes)
f3ec2d46 165SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
0fd94442 166endif
6d2abd6b 167TESTS= imgresample-test dct-test motion-test fft-test
de6d9b64 168
0fd94442 169all: $(LIB) $(SLIB)
ff4ec49e 170
bc634f6f
ZK
171amrlibs:
172 $(MAKE) -C amr spclib fipoplib
173
c10e9f70 174tests: apiexample cpuid_test $(TESTS)
de6d9b64 175
bc634f6f 176$(LIB): $(OBJS) $(AMRLIBS)
de6d9b64 177 rm -f $@
bc634f6f 178 $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
be7109c1 179 $(RANLIB) $@
ff4ec49e 180
811b32ed 181$(SLIB): $(OBJS)
cf7412b5
FB
182ifeq ($(CONFIG_WIN32),yes)
183 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
184 -lib /machine:i386 /def:$(@:.dll=.def)
185else
bc634f6f 186 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
cf7412b5 187endif
de6d9b64
FB
188
189dsputil.o: dsputil.c dsputil.h
190
bba9b16c
MN
191libpostproc/libpostproc.a:
192 $(MAKE) -C libpostproc
193
de6d9b64
FB
194%.o: %.c
195 $(CC) $(CFLAGS) -c -o $@ $<
196
3d03c0a2
FB
197%.o: %.S
198 $(CC) $(CFLAGS) -c -o $@ $<
199
811b32ed 200depend: $(SRCS)
a968e365 201 $(CC) -MM $(CFLAGS) $^ 1>.depend
e51d4def 202
980fc7b8
FB
203dep: depend
204
bc634f6f 205clean: $(CLEANAMR)
77b71ddc 206 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
3d03c0a2 207 armv4l/*.o armv4l/*~ \
c34270f5 208 mlib/*.o mlib/*~ \
1e98dffb 209 alpha/*.o alpha/*~ \
59925ef2 210 ppc/*.o ppc/*~ \
d46aba26 211 ps2/*.o ps2/*~ \
0c6bd2ea 212 sh4/*.o sh4/*~ \
57514323
ZK
213 liba52/*.o liba52/*~ \
214 apiexample $(TESTS)
64094f37 215 $(MAKE) -C libpostproc clean
de6d9b64 216
800d7ceb 217distclean: clean
980fc7b8
FB
218 rm -f Makefile.bak .depend
219
bc634f6f
ZK
220cleanamr:
221 $(MAKE) -C amr clean
222
223cleanamrfloat:
224 rm -f amr_float/*.o
225
d663a1fd
MN
226cleanamrwbfloat:
227 $(MAKE) -C amrwb_float -f makefile.gcc clean
228
de6d9b64
FB
229# api example program
230apiexample: apiexample.c $(LIB)
cfda33cb 231 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
de6d9b64 232
c10e9f70
NK
233# cpuid test
234cpuid_test: i386/cputest.c
235 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
236
de6d9b64
FB
237# testing progs
238
239imgresample-test: imgresample.c
6acce86b 240 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
de6d9b64 241
9ebc63a9 242dct-test: dct-test.o fdctref.o $(LIB)
90cee0c3 243 $(CC) -o $@ $^ -lm
d771bcae 244
4300403e 245motion-test: motion_test.o $(LIB)
6acce86b 246 $(CC) -o $@ $^ -lm
4300403e 247
923ceff8 248fft-test: fft-test.o $(LIB)
6d2abd6b
FB
249 $(CC) -o $@ $^ -lm
250
0fd94442 251ifeq ($(BUILD_SHARED),yes)
cb728d79
FB
252install: all install-headers
253ifeq ($(CONFIG_WIN32),yes)
254 install -s -m 755 $(SLIB) "$(prefix)"
255else
c1325d18 256 install -d $(prefix)/lib
ff4ec49e 257 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
c1325d18
VM
258 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
259 ldconfig || true
cb728d79
FB
260endif
261else
262install:
0fd94442 263endif
773cefc6 264
cb728d79 265installlib: all install-headers
773cefc6 266 install -m 644 $(LIB) $(prefix)/lib
cb728d79
FB
267
268install-headers:
269 mkdir -p "$(prefix)/include/ffmpeg"
07bd15c3
FR
270 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
271 $(SRC_PATH)/libavcodec/common.h \
272 $(SRC_PATH)/libavcodec/rational.h \
cb728d79 273 "$(prefix)/include/ffmpeg"
773cefc6 274
d771bcae
FB
275#
276# include dependency files if they exist
277#
278ifneq ($(wildcard .depend),)
279include .depend
280endif