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