]> git.sesse.net Git - ffmpeg/blob - libavcodec/Makefile
added installlib target to install static libraries and includes
[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..
11 LDFLAGS= -g
12
13 OBJS= common.o utils.o mem.o allcodecs.o \
14       mpegvideo.o h263.o jrevdct.o jfdctfst.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 rv10.o mpegaudiodec.o pcm.o simple_idct.o \
18       ratecontrol.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 ($(TARGET_GPROF),yes)
38 CFLAGS+=-p
39 LDFLAGS+=-p
40 endif
41
42 # i386 mmx specific stuff
43 ifeq ($(TARGET_MMX),yes)
44 OBJS += i386/fdct_mmx.o i386/cputest.o \
45         i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
46         i386/idct_mmx.o i386/motion_est_mmx.o \
47         i386/simple_idct_mmx.o
48 endif
49
50 # armv4l specific stuff
51 ifeq ($(TARGET_ARCH_ARMV4L),yes)
52 ASM_OBJS += armv4l/jrevdct_arm.o
53 OBJS += armv4l/dsputil_arm.o
54 endif
55
56 # sun mediaLib specific stuff
57 # currently only works when libavcodec is used in mplayer
58 ifeq ($(HAVE_MLIB),yes)
59 OBJS += mlib/dsputil_mlib.o
60 CFLAGS += $(MLIB_INC)
61 endif
62
63 # alpha specific stuff
64 ifeq ($(TARGET_ARCH_ALPHA),yes)
65 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o
66 CFLAGS += -Wa,-mpca56
67 endif
68
69 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
70 OBJS := $(OBJS) $(ASM_OBJS)
71
72 LIB= libavcodec.a
73 ifeq ($(BUILD_SHARED),yes)
74 SLIB= libavcodec.so
75 endif
76 TESTS= imgresample-test dct-test motion-test
77
78 all: $(LIB) $(SLIB)
79
80 tests: apiexample cpuid_test $(TESTS)
81
82 $(LIB): $(OBJS)
83         rm -f $@
84         $(AR) rc $@ $(OBJS)
85
86 $(SLIB): $(OBJS)
87         $(CC) -shared -o $@ $(OBJS) $(EXTRALIBS)
88
89 dsputil.o: dsputil.c dsputil.h
90
91 %.o: %.c
92         $(CC) $(CFLAGS) -c -o $@ $< 
93
94 %.o: %.S
95         $(CC) $(CFLAGS) -c -o $@ $<
96
97 # depend only used by mplayer now
98 dep:    depend
99
100 depend:
101         $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
102
103 clean: 
104         rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
105            armv4l/*.o armv4l/*~ \
106            mlib/*.o mlib/*~ \
107            alpha/*.o alpha/*~ \
108            liba52/*.o liba52/*~ \
109            apiexample $(TESTS)
110
111 distclean: clean
112         rm -f Makefile.bak .depend
113
114 # api example program
115 apiexample: apiexample.c $(LIB)
116         $(CC) $(CFLAGS) -o $@ $< $(LIB) -lm
117
118 # cpuid test
119 cpuid_test: i386/cputest.c
120         $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
121
122 # testing progs
123
124 imgresample-test: imgresample.c
125         $(CC) $(CFLAGS) -DTEST -o $@ $^ 
126
127 dct-test: dct-test.o jfdctfst.o i386/fdct_mmx.o \
128           fdctref.o jrevdct.o i386/idct_mmx.o
129         $(CC) -o $@ $^
130
131 motion-test: motion_test.o $(LIB)
132         $(CC) -o $@ $^
133
134 install: all
135 ifeq ($(BUILD_SHARED),yes)
136         install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
137         ln -sf $(prefix)/lib/libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
138         ldconfig
139         mkdir -p $(prefix)/include/ffmpeg
140         install -m 644 avcodec.h $(prefix)/include/ffmpeg/avcodec.h
141         install -m 644 common.h $(prefix)/include/ffmpeg/common.h
142 endif
143
144 installlib: all
145         install -m 644 $(LIB) $(prefix)/lib
146         mkdir -p $(prefix)/include/ffmpeg
147         install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
148                 $(prefix)/include/ffmpeg
149
150 #
151 # include dependency files if they exist
152 #
153 ifneq ($(wildcard .depend),)
154 include .depend
155 endif