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