]> git.sesse.net Git - ffmpeg/blob - libavcodec/Makefile
ar -s -> ranlib
[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 h263.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 msmpeg4.o \
17       mpeg12.o h263dec.o svq1.o rv10.o mpegaudiodec.o pcm.o simple_idct.o \
18       ratecontrol.o adpcm.o eval.o
19 ASM_OBJS=
20
21 # currently using liba52 for ac3 decoding
22 ifeq ($(CONFIG_AC3),yes)
23 OBJS+= a52dec.o
24
25 # using builtin liba52 or runtime linked liba52.so.0
26 ifneq ($(CONFIG_A52BIN),yes)
27 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
28         liba52/imdct.o  liba52/parse.o
29 endif
30 endif
31
32 ifeq ($(CONFIG_MP3LAME),yes)
33 OBJS += mp3lameaudio.o
34 EXTRALIBS += -lmp3lame
35 endif
36
37 ifeq ($(CONFIG_VORBIS),yes)
38 OBJS += oggvorbis.o
39 EXTRALIBS += -lvorbis -lvorbisenc
40 endif
41
42 ifeq ($(TARGET_GPROF),yes)
43 CFLAGS+=-p
44 LDFLAGS+=-p
45 endif
46
47 # i386 mmx specific stuff
48 ifeq ($(TARGET_MMX),yes)
49 OBJS += i386/fdct_mmx.o i386/cputest.o \
50         i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
51         i386/idct_mmx.o i386/motion_est_mmx.o \
52         i386/simple_idct_mmx.o
53 endif
54
55 # armv4l specific stuff
56 ifeq ($(TARGET_ARCH_ARMV4L),yes)
57 ASM_OBJS += armv4l/jrevdct_arm.o
58 OBJS += armv4l/dsputil_arm.o
59 endif
60
61 # sun mediaLib specific stuff
62 # currently only works when libavcodec is used in mplayer
63 ifeq ($(HAVE_MLIB),yes)
64 OBJS += mlib/dsputil_mlib.o
65 CFLAGS += $(MLIB_INC)
66 endif
67
68 # alpha specific stuff
69 ifeq ($(TARGET_ARCH_ALPHA),yes)
70 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o alpha/motion_est_alpha.o
71 ASM_OBJS += alpha/dsputil_alpha_asm.o
72 CFLAGS += -Wa,-mpca56 -finline-limit=8000 -fforce-addr -freduce-all-givs
73 endif
74
75 ifeq ($(TARGET_ARCH_POWERPC),yes)
76 OBJS += ppc/dsputil_ppc.o
77 endif
78
79 ifeq ($(TARGET_ALTIVEC),yes)
80 CFLAGS += -faltivec
81 OBJS += ppc/dsputil_altivec.o
82 endif
83
84 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
85 OBJS := $(OBJS) $(ASM_OBJS)
86
87 LIB= libavcodec.a
88 ifeq ($(BUILD_SHARED),yes)
89 SLIB= libavcodec.so
90 endif
91 TESTS= imgresample-test dct-test motion-test
92
93 all: $(LIB) $(SLIB)
94
95 tests: apiexample cpuid_test $(TESTS)
96
97 $(LIB): $(OBJS)
98         rm -f $@
99         $(AR) rc $@ $(OBJS)
100         $(RANLIB) $@
101
102 $(SLIB): $(OBJS)
103         $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
104
105 dsputil.o: dsputil.c dsputil.h
106
107 %.o: %.c
108         $(CC) $(CFLAGS) -c -o $@ $< 
109
110 %.o: %.S
111         $(CC) $(CFLAGS) -c -o $@ $<
112
113 # depend only used by mplayer now
114 dep:    depend
115
116 depend:
117         $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
118
119 clean: 
120         rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
121            armv4l/*.o armv4l/*~ \
122            mlib/*.o mlib/*~ \
123            alpha/*.o alpha/*~ \
124            ppc/*.o ppc/*~ \
125            liba52/*.o liba52/*~ \
126            apiexample $(TESTS)
127
128 distclean: clean
129         rm -f Makefile.bak .depend
130
131 # api example program
132 apiexample: apiexample.c $(LIB)
133         $(CC) $(CFLAGS) -o $@ $< $(LIB) -lm
134
135 # cpuid test
136 cpuid_test: i386/cputest.c
137         $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
138
139 # testing progs
140
141 imgresample-test: imgresample.c
142         $(CC) $(CFLAGS) -DTEST -o $@ $^ 
143
144 dct-test: dct-test.o jfdctfst.o jfdctint.o i386/fdct_mmx.o\
145           fdctref.o jrevdct.o i386/idct_mmx.o simple_idct.o i386/simple_idct_mmx.o
146         $(CC) -o $@ $^ -lm
147
148 motion-test: motion_test.o $(LIB)
149         $(CC) -o $@ $^
150
151 install: all
152 ifeq ($(BUILD_SHARED),yes)
153         install -d $(prefix)/lib
154         install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
155         ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
156         ldconfig || true
157         mkdir -p $(prefix)/include/ffmpeg
158         install -m 644 avcodec.h $(prefix)/include/ffmpeg/avcodec.h
159         install -m 644 common.h $(prefix)/include/ffmpeg/common.h
160 endif
161
162 installlib: all
163         install -m 644 $(LIB) $(prefix)/lib
164         mkdir -p $(prefix)/include/ffmpeg
165         install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
166                 $(prefix)/include/ffmpeg
167
168 #
169 # include dependency files if they exist
170 #
171 ifneq ($(wildcard .depend),)
172 include .depend
173 endif