fft altivec by Romain Dolbeau - simplified patch, test it on PPC with fft-test and...
[libav.git] / libavcodec / Makefile
1 #
2 # libavcodec Makefile
3 # (c) 2000, 2001, 2002 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) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
11 LDFLAGS= -g
12
13 OBJS= common.o utils.o mem.o allcodecs.o \
14 mpegvideo.o h263.o jrevdct.o jfdctfst.o jfdctint.o\
15 mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
16 motion_est.o imgconvert.o imgresample.o msmpeg4.o \
17 mpeg12.o h263dec.o svq1.o rv10.o mpegaudiodec.o pcm.o simple_idct.o \
18 ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
19 wmadec.o fft.o mdct.o mace.o huffyuv.o
20 ASM_OBJS=
21
22 # currently using liba52 for ac3 decoding
23 ifeq ($(CONFIG_AC3),yes)
24 OBJS+= a52dec.o
25
26 # using builtin liba52 or runtime linked liba52.so.0
27 ifneq ($(CONFIG_A52BIN),yes)
28 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
29 liba52/imdct.o liba52/parse.o
30 endif
31 endif
32
33 ifeq ($(CONFIG_MP3LAME),yes)
34 OBJS += mp3lameaudio.o
35 EXTRALIBS += -lmp3lame
36 endif
37
38 ifeq ($(CONFIG_VORBIS),yes)
39 OBJS += oggvorbis.o
40 EXTRALIBS += -lvorbis -lvorbisenc
41 endif
42
43 ifeq ($(TARGET_GPROF),yes)
44 CFLAGS+=-p
45 LDFLAGS+=-p
46 endif
47
48 # i386 mmx specific stuff
49 ifeq ($(TARGET_MMX),yes)
50 OBJS += i386/fdct_mmx.o i386/cputest.o \
51 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
52 i386/idct_mmx.o i386/motion_est_mmx.o \
53 i386/simple_idct_mmx.o i386/fft_sse.o
54 endif
55
56 # armv4l specific stuff
57 ifeq ($(TARGET_ARCH_ARMV4L),yes)
58 ASM_OBJS += armv4l/jrevdct_arm.o
59 OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
60 endif
61
62 # sun mediaLib specific stuff
63 # currently only works when libavcodec is used in mplayer
64 ifeq ($(HAVE_MLIB),yes)
65 OBJS += mlib/dsputil_mlib.o
66 CFLAGS += $(MLIB_INC)
67 endif
68
69 # alpha specific stuff
70 ifeq ($(TARGET_ARCH_ALPHA),yes)
71 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
72 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
73 ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
74 CFLAGS += -fforce-addr -freduce-all-givs
75 endif
76
77 ifeq ($(TARGET_ARCH_POWERPC),yes)
78 OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
79 endif
80
81 ifeq ($(TARGET_MMI),yes)
82 OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
83 endif
84
85 ifeq ($(TARGET_ALTIVEC),yes)
86 CFLAGS += -faltivec
87 OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
88 ppc/fft_altivec.o
89 endif
90
91 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
92 OBJS := $(OBJS) $(ASM_OBJS)
93
94 LIB= libavcodec.a
95 ifeq ($(BUILD_SHARED),yes)
96 SLIB= libavcodec.so
97 endif
98 TESTS= imgresample-test dct-test motion-test fft-test
99
100 all: $(LIB) $(SLIB)
101
102 tests: apiexample cpuid_test $(TESTS)
103
104 $(LIB): $(OBJS)
105 rm -f $@
106 $(AR) rc $@ $(OBJS)
107 $(RANLIB) $@
108
109 $(SLIB): $(OBJS)
110 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
111
112 dsputil.o: dsputil.c dsputil.h
113
114 %.o: %.c
115 $(CC) $(CFLAGS) -c -o $@ $<
116
117 %.o: %.S
118 $(CC) $(CFLAGS) -c -o $@ $<
119
120 # motion_est_alpha uses the MVI extension, which is not available with
121 # -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those
122 # cases.
123 ifeq ($(TARGET_ARCH_ALPHA),yes)
124 alpha/motion_est_alpha.o: alpha/motion_est_alpha.c
125 cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \
126 case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \
127 echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\
128 $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<
129 endif
130
131 # depend only used by mplayer now
132 dep: depend
133
134 depend:
135 $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
136
137 clean:
138 rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
139 armv4l/*.o armv4l/*~ \
140 mlib/*.o mlib/*~ \
141 alpha/*.o alpha/*~ \
142 ppc/*.o ppc/*~ \
143 ps2/*.o ps2/*~ \
144 liba52/*.o liba52/*~ \
145 apiexample $(TESTS)
146
147 distclean: clean
148 rm -f Makefile.bak .depend
149
150 # api example program
151 apiexample: apiexample.c $(LIB)
152 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
153
154 # cpuid test
155 cpuid_test: i386/cputest.c
156 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
157
158 # testing progs
159
160 imgresample-test: imgresample.c
161 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
162
163 dct-test: dct-test.o jfdctfst.o jfdctint.o i386/fdct_mmx.o\
164 fdctref.o jrevdct.o i386/idct_mmx.o simple_idct.o i386/simple_idct_mmx.o
165 $(CC) -o $@ $^ -lm
166
167 motion-test: motion_test.o $(LIB)
168 $(CC) -o $@ $^ -lm
169
170 fft-test: fft-test.o $(LIB)
171 $(CC) -o $@ $^ -lm
172
173 install: all
174 ifeq ($(BUILD_SHARED),yes)
175 install -d $(prefix)/lib
176 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
177 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
178 ldconfig || true
179 mkdir -p $(prefix)/include/ffmpeg
180 install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
181 install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
182 endif
183
184 installlib: all
185 install -m 644 $(LIB) $(prefix)/lib
186 mkdir -p $(prefix)/include/ffmpeg
187 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
188 $(prefix)/include/ffmpeg
189
190 #
191 # include dependency files if they exist
192 #
193 ifneq ($(wildcard .depend),)
194 include .depend
195 endif