largefile support patch by Roy Sigurd Karlsbakk <roy at karlsbakk.net>
[libav.git] / 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 \
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
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 ASM_OBJS += alpha/dsputil_alpha_asm.o
67 CFLAGS += -Wa,-mpca56 -finline-limit=8000 -fforce-addr -freduce-all-givs
68 endif
69
70 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
71 OBJS := $(OBJS) $(ASM_OBJS)
72
73 LIB= libavcodec.a
74 ifeq ($(BUILD_SHARED),yes)
75 SLIB= libavcodec.so
76 endif
77 TESTS= imgresample-test dct-test motion-test
78
79 all: $(LIB) $(SLIB)
80
81 tests: apiexample cpuid_test $(TESTS)
82
83 $(LIB): $(OBJS)
84 rm -f $@
85 $(AR) rc $@ $(OBJS)
86
87 $(SLIB): $(OBJS)
88 $(CC) -shared -o $@ $(OBJS) $(EXTRALIBS)
89
90 dsputil.o: dsputil.c dsputil.h
91
92 %.o: %.c
93 $(CC) $(CFLAGS) -c -o $@ $<
94
95 %.o: %.S
96 $(CC) $(CFLAGS) -c -o $@ $<
97
98 # depend only used by mplayer now
99 dep: depend
100
101 depend:
102 $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
103
104 clean:
105 rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
106 armv4l/*.o armv4l/*~ \
107 mlib/*.o mlib/*~ \
108 alpha/*.o alpha/*~ \
109 liba52/*.o liba52/*~ \
110 apiexample $(TESTS)
111
112 distclean: clean
113 rm -f Makefile.bak .depend
114
115 # api example program
116 apiexample: apiexample.c $(LIB)
117 $(CC) $(CFLAGS) -o $@ $< $(LIB) -lm
118
119 # cpuid test
120 cpuid_test: i386/cputest.c
121 $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
122
123 # testing progs
124
125 imgresample-test: imgresample.c
126 $(CC) $(CFLAGS) -DTEST -o $@ $^
127
128 dct-test: dct-test.o jfdctfst.o i386/fdct_mmx.o \
129 fdctref.o jrevdct.o i386/idct_mmx.o
130 $(CC) -o $@ $^
131
132 motion-test: motion_test.o $(LIB)
133 $(CC) -o $@ $^
134
135 install: all
136 ifeq ($(BUILD_SHARED),yes)
137 install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
138 ln -sf $(prefix)/lib/libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
139 ldconfig
140 mkdir -p $(prefix)/include/ffmpeg
141 install -m 644 avcodec.h $(prefix)/include/ffmpeg/avcodec.h
142 install -m 644 common.h $(prefix)/include/ffmpeg/common.h
143 endif
144
145 installlib: all
146 install -m 644 $(LIB) $(prefix)/lib
147 mkdir -p $(prefix)/include/ffmpeg
148 install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
149 $(prefix)/include/ffmpeg
150
151 #
152 # include dependency files if they exist
153 #
154 ifneq ($(wildcard .depend),)
155 include .depend
156 endif