]> git.sesse.net Git - ffmpeg/blob - libavcodec/Makefile
2b226bc44f51ff19e6d347fe27d979cde98a0412
[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 CFLAGS += -faltivec
77 OBJS += ppc/dsputil_altivec.o
78 endif
79
80 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
81 OBJS := $(OBJS) $(ASM_OBJS)
82
83 LIB= libavcodec.a
84 ifeq ($(BUILD_SHARED),yes)
85 SLIB= libavcodec.so
86 endif
87 TESTS= imgresample-test dct-test motion-test
88
89 all: $(LIB) $(SLIB)
90
91 tests: apiexample cpuid_test $(TESTS)
92
93 $(LIB): $(OBJS)
94         rm -f $@
95         $(AR) rcs $@ $(OBJS)
96
97 $(SLIB): $(OBJS)
98         $(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
99
100 dsputil.o: dsputil.c dsputil.h
101
102 %.o: %.c
103         $(CC) $(CFLAGS) -c -o $@ $< 
104
105 %.o: %.S
106         $(CC) $(CFLAGS) -c -o $@ $<
107
108 # depend only used by mplayer now
109 dep:    depend
110
111 depend:
112         $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
113
114 clean: 
115         rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
116            armv4l/*.o armv4l/*~ \
117            mlib/*.o mlib/*~ \
118            alpha/*.o alpha/*~ \
119            ppc/*.o ppc/*~ \
120            liba52/*.o liba52/*~ \
121            apiexample $(TESTS)
122
123 distclean: clean
124         rm -f Makefile.bak .depend
125
126 # api example program
127 apiexample: apiexample.c $(LIB)
128         $(CC) $(CFLAGS) -o $@ $< $(LIB) -lm
129
130 # cpuid test
131 cpuid_test: i386/cputest.c
132         $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
133
134 # testing progs
135
136 imgresample-test: imgresample.c
137         $(CC) $(CFLAGS) -DTEST -o $@ $^ 
138
139 dct-test: dct-test.o jfdctfst.o jfdctint.o i386/fdct_mmx.o\
140           fdctref.o jrevdct.o i386/idct_mmx.o simple_idct.o i386/simple_idct_mmx.o
141         $(CC) -o $@ $^ -lm
142
143 motion-test: motion_test.o $(LIB)
144         $(CC) -o $@ $^
145
146 install: all
147 ifeq ($(BUILD_SHARED),yes)
148         install -d $(prefix)/lib
149         install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
150         ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
151         ldconfig || true
152         mkdir -p $(prefix)/include/ffmpeg
153         install -m 644 avcodec.h $(prefix)/include/ffmpeg/avcodec.h
154         install -m 644 common.h $(prefix)/include/ffmpeg/common.h
155 endif
156
157 installlib: all
158         install -m 644 $(LIB) $(prefix)/lib
159         mkdir -p $(prefix)/include/ffmpeg
160         install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
161                 $(prefix)/include/ffmpeg
162
163 #
164 # include dependency files if they exist
165 #
166 ifneq ($(wildcard .depend),)
167 include .depend
168 endif