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