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 \ |
d962f6fd | 53 | i386/simple_idct_mmx.o |
de6d9b64 FB |
54 | endif |
55 | ||
3d03c0a2 FB |
56 | # armv4l specific stuff |
57 | ifeq ($(TARGET_ARCH_ARMV4L),yes) | |
58 | ASM_OBJS += armv4l/jrevdct_arm.o | |
676e200c | 59 | OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o |
3d03c0a2 FB |
60 | endif |
61 | ||
c34270f5 FB |
62 | # sun mediaLib specific stuff |
63 | # currently only works when libavcodec is used in mplayer | |
64 | ifeq ($(HAVE_MLIB),yes) | |
65 | OBJS += mlib/dsputil_mlib.o | |
66 | CFLAGS += $(MLIB_INC) | |
67 | endif | |
68 | ||
1e98dffb NK |
69 | # alpha specific stuff |
70 | ifeq ($(TARGET_ARCH_ALPHA),yes) | |
8b313a47 FH |
71 | OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \ |
72 | alpha/simple_idct_alpha.o alpha/motion_est_alpha.o | |
f9bb4bdf | 73 | ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o |
0af65aac | 74 | CFLAGS += -fforce-addr -freduce-all-givs |
1e98dffb NK |
75 | endif |
76 | ||
59925ef2 | 77 | ifeq ($(TARGET_ARCH_POWERPC),yes) |
05c4072b | 78 | OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o |
ab6c65f6 BF |
79 | endif |
80 | ||
d46aba26 | 81 | ifeq ($(TARGET_MMI),yes) |
5917d17c | 82 | OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o |
d46aba26 LS |
83 | endif |
84 | ||
ab6c65f6 | 85 | ifeq ($(TARGET_ALTIVEC),yes) |
59925ef2 | 86 | CFLAGS += -faltivec |
05c4072b | 87 | OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o |
59925ef2 BF |
88 | endif |
89 | ||
bb7d4939 | 90 | SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) |
ff4ec49e | 91 | OBJS := $(OBJS) $(ASM_OBJS) |
980fc7b8 | 92 | |
de6d9b64 | 93 | LIB= libavcodec.a |
0fd94442 | 94 | ifeq ($(BUILD_SHARED),yes) |
ff4ec49e | 95 | SLIB= libavcodec.so |
0fd94442 | 96 | endif |
6d2abd6b | 97 | TESTS= imgresample-test dct-test motion-test fft-test |
de6d9b64 | 98 | |
0fd94442 | 99 | all: $(LIB) $(SLIB) |
ff4ec49e | 100 | |
c10e9f70 | 101 | tests: apiexample cpuid_test $(TESTS) |
de6d9b64 | 102 | |
ff4ec49e | 103 | $(LIB): $(OBJS) |
de6d9b64 | 104 | rm -f $@ |
be7109c1 MN |
105 | $(AR) rc $@ $(OBJS) |
106 | $(RANLIB) $@ | |
ff4ec49e FB |
107 | |
108 | $(SLIB): $(OBJS) | |
e1707f52 | 109 | $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) |
de6d9b64 FB |
110 | |
111 | dsputil.o: dsputil.c dsputil.h | |
112 | ||
6d2abd6b FB |
113 | # specific sse code |
114 | %_sse.o : %_sse.c | |
115 | $(CC) $(CFLAGS) -msse -c -o $@ $< | |
116 | ||
117 | # specific 3dnow code | |
118 | %_3dnow.o : %_3dnow.c | |
119 | $(CC) $(CFLAGS) -m3dnow -c -o $@ $< | |
120 | ||
de6d9b64 FB |
121 | %.o: %.c |
122 | $(CC) $(CFLAGS) -c -o $@ $< | |
123 | ||
3d03c0a2 FB |
124 | %.o: %.S |
125 | $(CC) $(CFLAGS) -c -o $@ $< | |
126 | ||
0af65aac FH |
127 | # motion_est_alpha uses the MVI extension, which is not available with |
128 | # -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those | |
129 | # cases. | |
130 | ifeq ($(TARGET_ARCH_ALPHA),yes) | |
131 | alpha/motion_est_alpha.o: alpha/motion_est_alpha.c | |
132 | cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \ | |
133 | case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \ | |
134 | echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\ | |
135 | $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $< | |
136 | endif | |
137 | ||
980fc7b8 FB |
138 | # depend only used by mplayer now |
139 | dep: depend | |
140 | ||
141 | depend: | |
142 | $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend | |
143 | ||
de6d9b64 | 144 | clean: |
1ac9248b | 145 | rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \ |
3d03c0a2 | 146 | armv4l/*.o armv4l/*~ \ |
c34270f5 | 147 | mlib/*.o mlib/*~ \ |
1e98dffb | 148 | alpha/*.o alpha/*~ \ |
59925ef2 | 149 | ppc/*.o ppc/*~ \ |
d46aba26 | 150 | ps2/*.o ps2/*~ \ |
57514323 ZK |
151 | liba52/*.o liba52/*~ \ |
152 | apiexample $(TESTS) | |
de6d9b64 | 153 | |
800d7ceb | 154 | distclean: clean |
980fc7b8 FB |
155 | rm -f Makefile.bak .depend |
156 | ||
de6d9b64 FB |
157 | # api example program |
158 | apiexample: apiexample.c $(LIB) | |
cfda33cb | 159 | $(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm |
de6d9b64 | 160 | |
c10e9f70 NK |
161 | # cpuid test |
162 | cpuid_test: i386/cputest.c | |
163 | $(CC) $(CFLAGS) -D__TEST__ -o $@ $< | |
164 | ||
de6d9b64 FB |
165 | # testing progs |
166 | ||
167 | imgresample-test: imgresample.c | |
6acce86b | 168 | $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm |
de6d9b64 | 169 | |
86748dbc MN |
170 | dct-test: dct-test.o jfdctfst.o jfdctint.o i386/fdct_mmx.o\ |
171 | fdctref.o jrevdct.o i386/idct_mmx.o simple_idct.o i386/simple_idct_mmx.o | |
90cee0c3 | 172 | $(CC) -o $@ $^ -lm |
d771bcae | 173 | |
4300403e | 174 | motion-test: motion_test.o $(LIB) |
6acce86b | 175 | $(CC) -o $@ $^ -lm |
4300403e | 176 | |
6d2abd6b FB |
177 | fft-test: fft-test.o fft.o mdct.o |
178 | $(CC) -o $@ $^ -lm | |
179 | ||
0fd94442 | 180 | install: all |
0fd94442 | 181 | ifeq ($(BUILD_SHARED),yes) |
c1325d18 | 182 | install -d $(prefix)/lib |
ff4ec49e | 183 | install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so |
c1325d18 VM |
184 | ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so |
185 | ldconfig || true | |
ff4ec49e | 186 | mkdir -p $(prefix)/include/ffmpeg |
3565eeaa FH |
187 | install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h |
188 | install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h | |
0fd94442 | 189 | endif |
773cefc6 FB |
190 | |
191 | installlib: all | |
192 | install -m 644 $(LIB) $(prefix)/lib | |
193 | mkdir -p $(prefix)/include/ffmpeg | |
194 | install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \ | |
195 | $(prefix)/include/ffmpeg | |
196 | ||
d771bcae FB |
197 | # |
198 | # include dependency files if they exist | |
199 | # | |
200 | ifneq ($(wildcard .depend),) | |
201 | include .depend | |
202 | endif |