* quiet missing EOF \n warning
[libav.git] / libavcodec / Makefile
CommitLineData
4cc281d9
FB
1#
2# libavcodec Makefile
ff4ec49e 3# (c) 2000, 2001, 2002 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
eddbd7e5 10CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
de6d9b64
FB
11LDFLAGS= -g
12
773cefc6 13OBJS= common.o utils.o mem.o allcodecs.o \
1d0d55da 14 mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
10b7b472 15 mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
1d0d55da
MN
16 motion_est.o imgconvert.o imgresample.o \
17 mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
6d2abd6b 18 ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
d86053a4
MM
19 fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
20 vp3.o
980fc7b8 21ASM_OBJS=
de6d9b64 22
1d0d55da
MN
23# codecs which are patented in some non free countries like the us
24ifeq ($(CONFIG_RISKY),yes)
deabd4fd 25OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
1d0d55da
MN
26endif
27
57514323 28# currently using liba52 for ac3 decoding
d771bcae 29ifeq ($(CONFIG_AC3),yes)
57514323 30OBJS+= a52dec.o
57514323
ZK
31
32# using builtin liba52 or runtime linked liba52.so.0
ff4ec49e 33ifneq ($(CONFIG_A52BIN),yes)
57514323 34OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
521221cf 35 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
d771bcae 36endif
ff4ec49e 37endif
de6d9b64 38
280bd7b7
ZK
39ifeq ($(CONFIG_FAAD),yes)
40OBJS+= faad.o
41endif
42
bba9b16c
MN
43ifeq ($(CONFIG_PP),yes)
44ifeq ($(SHARED_PP),yes)
45EXTRALIBS += -lpostproc
46else
47# LIBS += libpostproc/libpostproc.a ... should be fixed
48OBJS += libpostproc/postprocess.o
49endif
50endif
51
5798368b
J
52ifeq ($(CONFIG_MP3LAME),yes)
53OBJS += mp3lameaudio.o
2a2a98c0 54EXTRALIBS += -lmp3lame
5798368b
J
55endif
56
81e0d0b4
MH
57ifeq ($(CONFIG_VORBIS),yes)
58OBJS += oggvorbis.o
59EXTRALIBS += -lvorbis -lvorbisenc
60endif
61
43f1708f
J
62ifeq ($(TARGET_GPROF),yes)
63CFLAGS+=-p
64LDFLAGS+=-p
65endif
66
de6d9b64 67# i386 mmx specific stuff
980fc7b8 68ifeq ($(TARGET_MMX),yes)
4300403e 69OBJS += i386/fdct_mmx.o i386/cputest.o \
de1ee36a 70 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
57514323 71 i386/idct_mmx.o i386/motion_est_mmx.o \
923ceff8 72 i386/simple_idct_mmx.o i386/fft_sse.o
a968e365
FB
73ifdef TARGET_BUILTIN_VECTOR
74i386/fft_sse.o: CFLAGS+= -msse
75endif
de6d9b64
FB
76endif
77
3d03c0a2
FB
78# armv4l specific stuff
79ifeq ($(TARGET_ARCH_ARMV4L),yes)
80ASM_OBJS += armv4l/jrevdct_arm.o
676e200c 81OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
3d03c0a2
FB
82endif
83
c34270f5
FB
84# sun mediaLib specific stuff
85# currently only works when libavcodec is used in mplayer
86ifeq ($(HAVE_MLIB),yes)
87OBJS += mlib/dsputil_mlib.o
88CFLAGS += $(MLIB_INC)
89endif
90
1e98dffb
NK
91# alpha specific stuff
92ifeq ($(TARGET_ARCH_ALPHA),yes)
8b313a47
FH
93OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
94 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
f9bb4bdf 95ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
0af65aac 96CFLAGS += -fforce-addr -freduce-all-givs
1e98dffb
NK
97endif
98
59925ef2 99ifeq ($(TARGET_ARCH_POWERPC),yes)
05c4072b 100OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
ab6c65f6
BF
101endif
102
d46aba26 103ifeq ($(TARGET_MMI),yes)
5917d17c 104OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
d46aba26
LS
105endif
106
ab6c65f6 107ifeq ($(TARGET_ALTIVEC),yes)
3b991c54 108ifeq ($(TARGET_OS),Darwin)
59925ef2 109CFLAGS += -faltivec
3b991c54
RD
110else
111CFLAGS += -maltivec -mabi=altivec
112endif
8d268a7d 113OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
e629ab68 114 ppc/fft_altivec.o ppc/gmc_altivec.o
59925ef2
BF
115endif
116
bb7d4939 117SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
ff4ec49e 118OBJS := $(OBJS) $(ASM_OBJS)
980fc7b8 119
f3ec2d46 120LIB= $(LIBPREF)avcodec$(LIBSUF)
0fd94442 121ifeq ($(BUILD_SHARED),yes)
f3ec2d46 122SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
0fd94442 123endif
6d2abd6b 124TESTS= imgresample-test dct-test motion-test fft-test
de6d9b64 125
0fd94442 126all: $(LIB) $(SLIB)
ff4ec49e 127
c10e9f70 128tests: apiexample cpuid_test $(TESTS)
de6d9b64 129
811b32ed 130$(LIB): $(OBJS)
de6d9b64 131 rm -f $@
be7109c1
MN
132 $(AR) rc $@ $(OBJS)
133 $(RANLIB) $@
ff4ec49e 134
811b32ed 135$(SLIB): $(OBJS)
e1707f52 136 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
de6d9b64
FB
137
138dsputil.o: dsputil.c dsputil.h
139
bba9b16c
MN
140libpostproc/libpostproc.a:
141 $(MAKE) -C libpostproc
142
de6d9b64
FB
143%.o: %.c
144 $(CC) $(CFLAGS) -c -o $@ $<
145
3d03c0a2
FB
146%.o: %.S
147 $(CC) $(CFLAGS) -c -o $@ $<
148
0af65aac
FH
149# motion_est_alpha uses the MVI extension, which is not available with
150# -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those
151# cases.
152ifeq ($(TARGET_ARCH_ALPHA),yes)
153alpha/motion_est_alpha.o: alpha/motion_est_alpha.c
154 cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \
155 case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \
156 echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\
157 $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<
158endif
159
811b32ed 160depend: $(SRCS)
a968e365 161 $(CC) -MM $(CFLAGS) $^ 1>.depend
e51d4def 162
980fc7b8
FB
163dep: depend
164
de6d9b64 165clean:
77b71ddc 166 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
3d03c0a2 167 armv4l/*.o armv4l/*~ \
c34270f5 168 mlib/*.o mlib/*~ \
1e98dffb 169 alpha/*.o alpha/*~ \
59925ef2 170 ppc/*.o ppc/*~ \
d46aba26 171 ps2/*.o ps2/*~ \
57514323
ZK
172 liba52/*.o liba52/*~ \
173 apiexample $(TESTS)
64094f37 174 $(MAKE) -C libpostproc clean
de6d9b64 175
800d7ceb 176distclean: clean
980fc7b8
FB
177 rm -f Makefile.bak .depend
178
de6d9b64
FB
179# api example program
180apiexample: apiexample.c $(LIB)
cfda33cb 181 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
de6d9b64 182
c10e9f70
NK
183# cpuid test
184cpuid_test: i386/cputest.c
185 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
186
de6d9b64
FB
187# testing progs
188
189imgresample-test: imgresample.c
6acce86b 190 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
de6d9b64 191
9ebc63a9 192dct-test: dct-test.o fdctref.o $(LIB)
90cee0c3 193 $(CC) -o $@ $^ -lm
d771bcae 194
4300403e 195motion-test: motion_test.o $(LIB)
6acce86b 196 $(CC) -o $@ $^ -lm
4300403e 197
923ceff8 198fft-test: fft-test.o $(LIB)
6d2abd6b
FB
199 $(CC) -o $@ $^ -lm
200
0fd94442 201install: all
0fd94442 202ifeq ($(BUILD_SHARED),yes)
c1325d18 203 install -d $(prefix)/lib
ff4ec49e 204 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
c1325d18
VM
205 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
206 ldconfig || true
ff4ec49e 207 mkdir -p $(prefix)/include/ffmpeg
3565eeaa
FH
208 install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
209 install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
0fd94442 210endif
773cefc6
FB
211
212installlib: all
213 install -m 644 $(LIB) $(prefix)/lib
214 mkdir -p $(prefix)/include/ffmpeg
215 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
216 $(prefix)/include/ffmpeg
217
d771bcae
FB
218#
219# include dependency files if they exist
220#
221ifneq ($(wildcard .depend),)
222include .depend
223endif