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