e5a8cfb3adeaf6ebb71074d9d96f7f382b38360a
[libav.git] / libavcodec / Makefile
1 include ../config.mak
2
3 CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I. -I..
4 LDFLAGS= -g
5
6 OBJS= common.o utils.o mpegvideo.o h263.o jrevdct.o jfdctfst.o \
7 mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
8 motion_est.o imgconvert.o imgresample.o msmpeg4.o \
9 mpeg12.o h263dec.o rv10.o mpegaudiodec.o pcm.o simple_idct.o \
10 ratecontrol.o
11 ASM_OBJS=
12
13 # currently using liba52 for ac3 decoding
14 ifeq ($(CONFIG_AC3),yes)
15 OBJS+= a52dec.o
16 endif
17
18 # using builtin liba52 or runtime linked liba52.so.0
19 ifeq ($(CONFIG_A52BIN),no)
20 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
21 liba52/imdct.o liba52/parse.o
22 endif
23
24 ifeq ($(CONFIG_MP3LAME),yes)
25 OBJS += mp3lameaudio.o
26 endif
27
28 ifeq ($(TARGET_GPROF),yes)
29 CFLAGS+=-p
30 LDFLAGS+=-p
31 endif
32
33 # i386 mmx specific stuff
34 ifeq ($(TARGET_MMX),yes)
35 OBJS += i386/fdct_mmx.o i386/cputest.o \
36 i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
37 i386/idct_mmx.o i386/motion_est_mmx.o \
38 i386/simple_idct_mmx.o
39 endif
40
41 # armv4l specific stuff
42 ifeq ($(TARGET_ARCH_ARMV4L),yes)
43 ASM_OBJS += armv4l/jrevdct_arm.o
44 OBJS += armv4l/dsputil_arm.o
45 endif
46
47 # sun mediaLib specific stuff
48 # currently only works when libavcodec is used in mplayer
49 ifeq ($(HAVE_MLIB),yes)
50 OBJS += mlib/dsputil_mlib.o
51 CFLAGS += $(MLIB_INC)
52 endif
53
54 # alpha specific stuff
55 ifeq ($(TARGET_ARCH_ALPHA),yes)
56 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o
57 CFLAGS += -Wa,-mpca56
58 endif
59
60 SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
61
62 LIB= libavcodec.a
63 ifeq ($(BUILD_SHARED),yes)
64 SLIB= libffmpeg-$(VERSION).so
65 endif
66 TESTS= imgresample-test dct-test motion-test
67
68 all: $(LIB) $(SLIB)
69 tests: apiexample cpuid_test $(TESTS)
70
71 $(LIB): $(OBJS) $(ASM_OBJS)
72 rm -f $@
73 $(AR) rcs $@ $(OBJS) $(ASM_OBJS)
74
75 $(SLIB): $(OBJS) $(ASM_OBJS)
76 rm -f $@
77 $(CC) -shared -o $@ $(OBJS) $(ASM_OBJS)
78 ln -sf $@ libffmpeg.so
79 dsputil.o: dsputil.c dsputil.h
80
81 %.o: %.c
82 $(CC) $(CFLAGS) -c -o $@ $<
83
84 %.o: %.S
85 $(CC) $(CFLAGS) -c -o $@ $<
86
87 # depend only used by mplayer now
88 dep: depend
89
90 depend:
91 $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
92
93 clean:
94 rm -f *.o *~ $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
95 armv4l/*.o armv4l/*~ \
96 mlib/*.o mlib/*~ \
97 alpha/*.o alpha/*~ \
98 liba52/*.o liba52/*~ \
99 apiexample $(TESTS)
100
101 distclean: clean
102 rm -f Makefile.bak .depend
103
104 # api example program
105 apiexample: apiexample.c $(LIB)
106 $(CC) $(CFLAGS) -o $@ $< $(LIB) -lm
107
108 # cpuid test
109 cpuid_test: i386/cputest.c
110 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
111
112 # testing progs
113
114 imgresample-test: imgresample.c
115 $(CC) $(CFLAGS) -DTEST -o $@ $^
116
117 dct-test: dct-test.o jfdctfst.o i386/fdct_mmx.o \
118 fdctref.o jrevdct.o i386/idct_mmx.o
119 $(CC) -o $@ $^
120
121 motion-test: motion_test.o $(LIB)
122 $(CC) -o $@ $^
123
124 install: all
125 # install -m 644 $(LIB) $(prefix)/lib
126 ifeq ($(BUILD_SHARED),yes)
127 install -s -m 755 $(SLIB) $(prefix)/lib
128 ln -sf $(prefix)/lib/$(SLIB) $(prefix)/lib/libffmpeg.so
129 ldconfig
130 mkdir -p $(prefix)/include/libffmpeg
131 install -m 644 avcodec.h $(prefix)/include/libffmpeg/avcodec.h
132 install -m 644 common.h $(prefix)/include/libffmpeg/common.h
133 endif
134 #
135 # include dependency files if they exist
136 #
137 ifneq ($(wildcard .depend),)
138 include .depend
139 endif