Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-core / tags / synfig_0_61_04 / synfig-core / src / modules / mod_libavcodec / libavcodec / Makefile
1 #
2 # libavcodec Makefile
3 # (c) 2000-2003 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 ifeq ($(CONFIG_WIN32),yes)
162         $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
163         -lib /machine:i386 /def:$(@:.dll=.def)
164 else
165         $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
166 endif
167
168 dsputil.o: dsputil.c dsputil.h
169
170 libpostproc/libpostproc.a:
171         $(MAKE) -C libpostproc
172
173 %.o: %.c
174         $(CC) $(CFLAGS) -c -o $@ $< 
175
176 %.o: %.S
177         $(CC) $(CFLAGS) -c -o $@ $<
178
179 depend: $(SRCS)
180         $(CC) -MM $(CFLAGS) $^ 1>.depend
181
182 dep:    depend
183
184 clean: $(CLEANAMR)
185         rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
186            armv4l/*.o armv4l/*~ \
187            mlib/*.o mlib/*~ \
188            alpha/*.o alpha/*~ \
189            ppc/*.o ppc/*~ \
190            ps2/*.o ps2/*~ \
191            sh4/*.o sh4/*~ \
192            liba52/*.o liba52/*~ \
193            apiexample $(TESTS)
194         $(MAKE) -C libpostproc clean
195
196 distclean: clean
197         rm -f Makefile.bak .depend
198
199 cleanamr:
200         $(MAKE) -C amr clean
201
202 cleanamrfloat:
203         rm -f amr_float/*.o
204
205 # api example program
206 apiexample: apiexample.c $(LIB)
207         $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
208
209 # cpuid test
210 cpuid_test: i386/cputest.c
211         $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
212
213 # testing progs
214
215 imgresample-test: imgresample.c
216         $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
217
218 dct-test: dct-test.o fdctref.o $(LIB)
219         $(CC) -o $@ $^ -lm
220
221 motion-test: motion_test.o $(LIB)
222         $(CC) -o $@ $^ -lm
223
224 fft-test: fft-test.o $(LIB)
225         $(CC) -o $@ $^ -lm
226
227 ifeq ($(BUILD_SHARED),yes)
228 install: all install-headers
229 ifeq ($(CONFIG_WIN32),yes)
230         install -s -m 755 $(SLIB) "$(prefix)"
231 else
232         install -d $(prefix)/lib
233         install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
234         ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
235         ldconfig || true
236 endif
237 else
238 install:
239 endif
240
241 installlib: all install-headers
242         install -m 644 $(LIB) $(prefix)/lib
243
244 install-headers:
245         mkdir -p "$(prefix)/include/ffmpeg"
246         install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
247                 "$(prefix)/include/ffmpeg"
248
249 #
250 # include dependency files if they exist
251 #
252 ifneq ($(wildcard .depend),)
253 include .depend
254 endif