Commit | Line | Data |
---|---|---|
4cc281d9 FB |
1 | # |
2 | # libavcodec Makefile | |
ff4ec49e | 3 | # (c) 2000, 2001, 2002 Fabrice Bellard |
4cc281d9 | 4 | # |
980fc7b8 FB |
5 | include ../config.mak |
6 | ||
4cc281d9 FB |
7 | VPATH=$(SRC_PATH)/libavcodec |
8 | ||
ff4ec49e | 9 | # NOTE: -I.. is needed to include config.h |
eddbd7e5 | 10 | CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE |
de6d9b64 FB |
11 | LDFLAGS= -g |
12 | ||
773cefc6 | 13 | OBJS= common.o utils.o mem.o allcodecs.o \ |
28db7fce | 14 | mpegvideo.o h263.o jrevdct.o jfdctfst.o jfdctint.o\ |
10b7b472 | 15 | mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \ |
de6d9b64 | 16 | motion_est.o imgconvert.o imgresample.o msmpeg4.o \ |
be8ffec9 | 17 | mpeg12.o h263dec.o svq1.o rv10.o mpegaudiodec.o pcm.o simple_idct.o \ |
6d2abd6b | 18 | ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \ |
11f18faf | 19 | wmadec.o fft.o mdct.o mace.o huffyuv.o |
980fc7b8 | 20 | ASM_OBJS= |
de6d9b64 | 21 | |
57514323 | 22 | # currently using liba52 for ac3 decoding |
d771bcae | 23 | ifeq ($(CONFIG_AC3),yes) |
57514323 | 24 | OBJS+= a52dec.o |
57514323 ZK |
25 | |
26 | # using builtin liba52 or runtime linked liba52.so.0 | |
ff4ec49e | 27 | ifneq ($(CONFIG_A52BIN),yes) |
57514323 ZK |
28 | OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \ |
29 | liba52/imdct.o liba52/parse.o | |
d771bcae | 30 | endif |
ff4ec49e | 31 | endif |
de6d9b64 | 32 | |
5798368b J |
33 | ifeq ($(CONFIG_MP3LAME),yes) |
34 | OBJS += mp3lameaudio.o | |
2a2a98c0 | 35 | EXTRALIBS += -lmp3lame |
5798368b J |
36 | endif |
37 | ||
81e0d0b4 MH |
38 | ifeq ($(CONFIG_VORBIS),yes) |
39 | OBJS += oggvorbis.o | |
40 | EXTRALIBS += -lvorbis -lvorbisenc | |
41 | endif | |
42 | ||
43f1708f J |
43 | ifeq ($(TARGET_GPROF),yes) |
44 | CFLAGS+=-p | |
45 | LDFLAGS+=-p | |
46 | endif | |
47 | ||
de6d9b64 | 48 | # i386 mmx specific stuff |
980fc7b8 | 49 | ifeq ($(TARGET_MMX),yes) |
4300403e | 50 | OBJS += i386/fdct_mmx.o i386/cputest.o \ |
de1ee36a | 51 | i386/dsputil_mmx.o i386/mpegvideo_mmx.o \ |
57514323 | 52 | i386/idct_mmx.o i386/motion_est_mmx.o \ |
923ceff8 | 53 | i386/simple_idct_mmx.o i386/fft_sse.o |
a968e365 FB |
54 | ifdef TARGET_BUILTIN_VECTOR |
55 | i386/fft_sse.o: CFLAGS+= -msse | |
56 | endif | |
de6d9b64 FB |
57 | endif |
58 | ||
3d03c0a2 FB |
59 | # armv4l specific stuff |
60 | ifeq ($(TARGET_ARCH_ARMV4L),yes) | |
61 | ASM_OBJS += armv4l/jrevdct_arm.o | |
676e200c | 62 | OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o |
3d03c0a2 FB |
63 | endif |
64 | ||
c34270f5 FB |
65 | # sun mediaLib specific stuff |
66 | # currently only works when libavcodec is used in mplayer | |
67 | ifeq ($(HAVE_MLIB),yes) | |
68 | OBJS += mlib/dsputil_mlib.o | |
69 | CFLAGS += $(MLIB_INC) | |
70 | endif | |
71 | ||
1e98dffb NK |
72 | # alpha specific stuff |
73 | ifeq ($(TARGET_ARCH_ALPHA),yes) | |
8b313a47 FH |
74 | OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \ |
75 | alpha/simple_idct_alpha.o alpha/motion_est_alpha.o | |
f9bb4bdf | 76 | ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o |
0af65aac | 77 | CFLAGS += -fforce-addr -freduce-all-givs |
1e98dffb NK |
78 | endif |
79 | ||
59925ef2 | 80 | ifeq ($(TARGET_ARCH_POWERPC),yes) |
05c4072b | 81 | OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o |
ab6c65f6 BF |
82 | endif |
83 | ||
d46aba26 | 84 | ifeq ($(TARGET_MMI),yes) |
5917d17c | 85 | OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o |
d46aba26 LS |
86 | endif |
87 | ||
ab6c65f6 | 88 | ifeq ($(TARGET_ALTIVEC),yes) |
3b991c54 | 89 | ifeq ($(TARGET_OS),Darwin) |
59925ef2 | 90 | CFLAGS += -faltivec |
3b991c54 RD |
91 | else |
92 | CFLAGS += -maltivec -mabi=altivec | |
93 | endif | |
8d268a7d | 94 | OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \ |
e629ab68 | 95 | ppc/fft_altivec.o ppc/gmc_altivec.o |
59925ef2 BF |
96 | endif |
97 | ||
bb7d4939 | 98 | SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) |
ff4ec49e | 99 | OBJS := $(OBJS) $(ASM_OBJS) |
980fc7b8 | 100 | |
f3ec2d46 | 101 | LIB= $(LIBPREF)avcodec$(LIBSUF) |
0fd94442 | 102 | ifeq ($(BUILD_SHARED),yes) |
f3ec2d46 | 103 | SLIB= $(SLIBPREF)avcodec$(SLIBSUF) |
0fd94442 | 104 | endif |
6d2abd6b | 105 | TESTS= imgresample-test dct-test motion-test fft-test |
de6d9b64 | 106 | |
0fd94442 | 107 | all: $(LIB) $(SLIB) |
ff4ec49e | 108 | |
c10e9f70 | 109 | tests: apiexample cpuid_test $(TESTS) |
de6d9b64 | 110 | |
e51d4def | 111 | $(LIB): .depend $(OBJS) |
de6d9b64 | 112 | rm -f $@ |
be7109c1 | 113 | $(AR) rc $@ $(OBJS) |
f3ec2d46 | 114 | ifneq ($(CONFIG_OS2),yes) |
be7109c1 | 115 | $(RANLIB) $@ |
f3ec2d46 | 116 | endif |
ff4ec49e | 117 | |
e51d4def | 118 | $(SLIB): .depend $(OBJS) |
e1707f52 | 119 | $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) |
de6d9b64 FB |
120 | |
121 | dsputil.o: dsputil.c dsputil.h | |
122 | ||
123 | %.o: %.c | |
124 | $(CC) $(CFLAGS) -c -o $@ $< | |
125 | ||
3d03c0a2 FB |
126 | %.o: %.S |
127 | $(CC) $(CFLAGS) -c -o $@ $< | |
128 | ||
0af65aac FH |
129 | # motion_est_alpha uses the MVI extension, which is not available with |
130 | # -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those | |
131 | # cases. | |
132 | ifeq ($(TARGET_ARCH_ALPHA),yes) | |
133 | alpha/motion_est_alpha.o: alpha/motion_est_alpha.c | |
134 | cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \ | |
135 | case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \ | |
136 | echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\ | |
137 | $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $< | |
138 | endif | |
139 | ||
e51d4def | 140 | .depend: $(SRCS) |
a968e365 | 141 | $(CC) -MM $(CFLAGS) $^ 1>.depend |
e51d4def | 142 | |
980fc7b8 FB |
143 | dep: depend |
144 | ||
e51d4def | 145 | depend: .depend |
980fc7b8 | 146 | |
de6d9b64 | 147 | clean: |
77b71ddc | 148 | rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \ |
3d03c0a2 | 149 | armv4l/*.o armv4l/*~ \ |
c34270f5 | 150 | mlib/*.o mlib/*~ \ |
1e98dffb | 151 | alpha/*.o alpha/*~ \ |
59925ef2 | 152 | ppc/*.o ppc/*~ \ |
d46aba26 | 153 | ps2/*.o ps2/*~ \ |
57514323 ZK |
154 | liba52/*.o liba52/*~ \ |
155 | apiexample $(TESTS) | |
de6d9b64 | 156 | |
800d7ceb | 157 | distclean: clean |
980fc7b8 FB |
158 | rm -f Makefile.bak .depend |
159 | ||
de6d9b64 FB |
160 | # api example program |
161 | apiexample: apiexample.c $(LIB) | |
cfda33cb | 162 | $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm |
de6d9b64 | 163 | |
c10e9f70 NK |
164 | # cpuid test |
165 | cpuid_test: i386/cputest.c | |
166 | $(CC) $(CFLAGS) -D__TEST__ -o $@ $< | |
167 | ||
de6d9b64 FB |
168 | # testing progs |
169 | ||
170 | imgresample-test: imgresample.c | |
6acce86b | 171 | $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm |
de6d9b64 | 172 | |
9ebc63a9 | 173 | dct-test: dct-test.o fdctref.o $(LIB) |
90cee0c3 | 174 | $(CC) -o $@ $^ -lm |
d771bcae | 175 | |
4300403e | 176 | motion-test: motion_test.o $(LIB) |
6acce86b | 177 | $(CC) -o $@ $^ -lm |
4300403e | 178 | |
923ceff8 | 179 | fft-test: fft-test.o $(LIB) |
6d2abd6b FB |
180 | $(CC) -o $@ $^ -lm |
181 | ||
0fd94442 | 182 | install: all |
0fd94442 | 183 | ifeq ($(BUILD_SHARED),yes) |
c1325d18 | 184 | install -d $(prefix)/lib |
ff4ec49e | 185 | install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so |
c1325d18 VM |
186 | ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so |
187 | ldconfig || true | |
ff4ec49e | 188 | mkdir -p $(prefix)/include/ffmpeg |
3565eeaa FH |
189 | install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h |
190 | install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h | |
0fd94442 | 191 | endif |
773cefc6 FB |
192 | |
193 | installlib: all | |
194 | install -m 644 $(LIB) $(prefix)/lib | |
195 | mkdir -p $(prefix)/include/ffmpeg | |
196 | install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \ | |
197 | $(prefix)/include/ffmpeg | |
198 | ||
d771bcae FB |
199 | # |
200 | # include dependency files if they exist | |
201 | # | |
202 | ifneq ($(wildcard .depend),) | |
203 | include .depend | |
204 | endif |