sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
[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 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 \
17 mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
18 ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
19 fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
20 vp3.o
21
22 ifeq ($(AMR_NB),yes)
23 OBJS+= amr.o
24 endif
25
26 ASM_OBJS=
27
28 # codecs which are patented in some non free countries like the us
29 ifeq ($(CONFIG_RISKY),yes)
30 OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
31 endif
32
33 # currently using liba52 for ac3 decoding
34 ifeq ($(CONFIG_AC3),yes)
35 OBJS+= a52dec.o
36
37 # using builtin liba52 or runtime linked liba52.so.0
38 ifneq ($(CONFIG_A52BIN),yes)
39 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
40 liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o
41 endif
42 endif
43
44 ifeq ($(CONFIG_FAAD),yes)
45 OBJS+= faad.o
46 ifeq ($(CONFIG_FAADBIN),yes)
47 # no libs needed
48 else
49 EXTRALIBS += -lfaad
50 endif
51 endif
52
53 ifeq ($(CONFIG_PP),yes)
54 ifeq ($(SHARED_PP),yes)
55 EXTRALIBS += -lpostproc
56 else
57 # LIBS += libpostproc/libpostproc.a ... should be fixed
58 OBJS += libpostproc/postprocess.o
59 endif
60 endif
61
62 ifeq ($(CONFIG_MP3LAME),yes)
63 OBJS += mp3lameaudio.o
64 EXTRALIBS += -lmp3lame
65 endif
66
67 ifeq ($(CONFIG_VORBIS),yes)
68 OBJS += oggvorbis.o
69 EXTRALIBS += -lvorbis -lvorbisenc
70 endif
71
72 ifeq ($(TARGET_GPROF),yes)
73 CFLAGS+=-p
74 LDFLAGS+=-p
75 endif
76
77 # i386 mmx specific stuff
78 ifeq ($(TARGET_MMX),yes)
79 OBJS += i386/fdct_mmx.o i386/cputest.o \
80 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
81 i386/idct_mmx.o i386/motion_est_mmx.o \
82 i386/simple_idct_mmx.o i386/fft_sse.o
83 ifdef TARGET_BUILTIN_VECTOR
84 i386/fft_sse.o: CFLAGS+= -msse
85 endif
86 endif
87
88 # armv4l specific stuff
89 ifeq ($(TARGET_ARCH_ARMV4L),yes)
90 ASM_OBJS += armv4l/jrevdct_arm.o
91 OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
92 endif
93
94 # sun mediaLib specific stuff
95 # currently only works when libavcodec is used in mplayer
96 ifeq ($(HAVE_MLIB),yes)
97 OBJS += mlib/dsputil_mlib.o
98 CFLAGS += $(MLIB_INC)
99 endif
100
101 # alpha specific stuff
102 ifeq ($(TARGET_ARCH_ALPHA),yes)
103 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
104 alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
105 ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
106 CFLAGS += -fforce-addr -freduce-all-givs
107 endif
108
109 ifeq ($(TARGET_ARCH_POWERPC),yes)
110 OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
111 endif
112
113 ifeq ($(TARGET_MMI),yes)
114 OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
115 endif
116
117 ifeq ($(TARGET_ALTIVEC),yes)
118 ifeq ($(TARGET_OS),Darwin)
119 CFLAGS += -faltivec
120 else
121 CFLAGS += -maltivec -mabi=altivec
122 endif
123 OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
124 ppc/fft_altivec.o ppc/gmc_altivec.o
125 endif
126
127 ifeq ($(TARGET_ARCH_SH4),yes)
128 OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
129 endif
130
131
132 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
133 OBJS := $(OBJS) $(ASM_OBJS)
134
135 LIB= $(LIBPREF)avcodec$(LIBSUF)
136 ifeq ($(BUILD_SHARED),yes)
137 SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
138 endif
139 TESTS= imgresample-test dct-test motion-test fft-test
140
141 all: $(LIB) $(SLIB)
142
143 tests: apiexample cpuid_test $(TESTS)
144
145 $(LIB): $(OBJS)
146 rm -f $@
147 $(AR) rc $@ $(OBJS)
148 $(RANLIB) $@
149
150 $(SLIB): $(OBJS)
151 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
152
153 dsputil.o: dsputil.c dsputil.h
154
155 libpostproc/libpostproc.a:
156 $(MAKE) -C libpostproc
157
158 %.o: %.c
159 $(CC) $(CFLAGS) -c -o $@ $<
160
161 %.o: %.S
162 $(CC) $(CFLAGS) -c -o $@ $<
163
164 # motion_est_alpha uses the MVI extension, which is not available with
165 # -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those
166 # cases.
167 ifeq ($(TARGET_ARCH_ALPHA),yes)
168 alpha/motion_est_alpha.o: alpha/motion_est_alpha.c
169 cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \
170 case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \
171 echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\
172 $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<
173 endif
174
175 depend: $(SRCS)
176 $(CC) -MM $(CFLAGS) $^ 1>.depend
177
178 dep: depend
179
180 clean:
181 rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
182 armv4l/*.o armv4l/*~ \
183 mlib/*.o mlib/*~ \
184 alpha/*.o alpha/*~ \
185 ppc/*.o ppc/*~ \
186 ps2/*.o ps2/*~ \
187 sh4/*.o sh4/*~ \
188 liba52/*.o liba52/*~ \
189 apiexample $(TESTS)
190 $(MAKE) -C libpostproc clean
191
192 distclean: clean
193 rm -f Makefile.bak .depend
194
195 # api example program
196 apiexample: apiexample.c $(LIB)
197 $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
198
199 # cpuid test
200 cpuid_test: i386/cputest.c
201 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
202
203 # testing progs
204
205 imgresample-test: imgresample.c
206 $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
207
208 dct-test: dct-test.o fdctref.o $(LIB)
209 $(CC) -o $@ $^ -lm
210
211 motion-test: motion_test.o $(LIB)
212 $(CC) -o $@ $^ -lm
213
214 fft-test: fft-test.o $(LIB)
215 $(CC) -o $@ $^ -lm
216
217 install: all
218 ifeq ($(BUILD_SHARED),yes)
219 install -d $(prefix)/lib
220 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
221 ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
222 ldconfig || true
223 mkdir -p $(prefix)/include/ffmpeg
224 install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
225 install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
226 endif
227
228 installlib: all
229 install -m 644 $(LIB) $(prefix)/lib
230 mkdir -p $(prefix)/include/ffmpeg
231 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
232 $(prefix)/include/ffmpeg
233
234 #
235 # include dependency files if they exist
236 #
237 ifneq ($(wildcard .depend),)
238 include .depend
239 endif