Makefile 6.1 KB
Newer Older
1 2
#
# libavcodec Makefile
F
Fabrice Bellard 已提交
3
# (c) 2000, 2001, 2002 Fabrice Bellard
4
#
5 6
include ../config.mak

7 8
VPATH=$(SRC_PATH)/libavcodec

F
Fabrice Bellard 已提交
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
F
Fabrice Bellard 已提交
11 12
LDFLAGS= -g

13
OBJS= common.o utils.o mem.o allcodecs.o \
M
Michael Niedermayer 已提交
14
      mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
15
      mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
M
Michael Niedermayer 已提交
16
      motion_est.o imgconvert.o imgresample.o \
I
Ivan Kalvachev 已提交
17
      mpeg12.o xvmcvideo.o mpegaudiodec.o pcm.o simple_idct.o \
18
      ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
19
      fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
M
Michael Niedermayer 已提交
20
      vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o
21 22

ifeq ($(AMR_NB),yes)
Z
Zdenek Kabelac 已提交
23
ifeq ($(AMR_NB_FIXED),yes)
24
OBJS+= amr.o
Z
Zdenek Kabelac 已提交
25 26 27 28 29 30 31
AMREXTRALIBS+= amr/*.o
AMRLIBS=amrlibs
CLEANAMR=cleanamr
else
OBJS+= amr.o amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
CLEANAMR=cleanamrfloat
endif
32 33
endif

34
ASM_OBJS=
F
Fabrice Bellard 已提交
35

M
Michael Niedermayer 已提交
36 37
# codecs which are patented in some non free countries like the us
ifeq ($(CONFIG_RISKY),yes)
38
OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
M
Michael Niedermayer 已提交
39 40
endif

Z
Zdenek Kabelac 已提交
41
# currently using liba52 for ac3 decoding
42
ifeq ($(CONFIG_AC3),yes)
Z
Zdenek Kabelac 已提交
43 44 45
OBJS+= a52dec.o

# using builtin liba52 or runtime linked liba52.so.0
F
Fabrice Bellard 已提交
46
ifneq ($(CONFIG_A52BIN),yes)
Z
Zdenek Kabelac 已提交
47
OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
A
Arpi 已提交
48
	liba52/imdct.o  liba52/parse.o liba52/crc.o liba52/resample.o
49
endif
F
Fabrice Bellard 已提交
50
endif
F
Fabrice Bellard 已提交
51

52 53
ifeq ($(CONFIG_FAAD),yes)
OBJS+= faad.o
Z
Zdenek Kabelac 已提交
54 55 56 57 58
ifeq ($(CONFIG_FAADBIN),yes)
# no libs needed
else
EXTRALIBS += -lfaad
endif
59 60
endif

61 62 63 64 65 66 67 68 69
ifeq ($(CONFIG_PP),yes)
ifeq ($(SHARED_PP),yes)
EXTRALIBS += -lpostproc
else
# LIBS += libpostproc/libpostproc.a ... should be fixed
OBJS += libpostproc/postprocess.o
endif
endif

70 71
ifeq ($(CONFIG_MP3LAME),yes)
OBJS += mp3lameaudio.o
Z
Zdenek Kabelac 已提交
72
EXTRALIBS += -lmp3lame
73 74
endif

75 76 77 78 79
ifeq ($(CONFIG_VORBIS),yes)
OBJS += oggvorbis.o
EXTRALIBS += -lvorbis -lvorbisenc
endif

80 81 82 83 84
ifeq ($(TARGET_GPROF),yes)
CFLAGS+=-p
LDFLAGS+=-p
endif

F
Fabrice Bellard 已提交
85
# i386 mmx specific stuff
86
ifeq ($(TARGET_MMX),yes)
F
Fabrice Bellard 已提交
87
OBJS += i386/fdct_mmx.o i386/cputest.o \
F
Fabrice Bellard 已提交
88
	i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
Z
Zdenek Kabelac 已提交
89
	i386/idct_mmx.o i386/motion_est_mmx.o \
90
	i386/simple_idct_mmx.o i386/fft_sse.o
91 92 93
ifdef TARGET_BUILTIN_VECTOR
i386/fft_sse.o: CFLAGS+= -msse
endif
F
Fabrice Bellard 已提交
94 95
endif

F
Fabrice Bellard 已提交
96 97
# armv4l specific stuff
ifeq ($(TARGET_ARCH_ARMV4L),yes)
98
ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
99
OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
F
Fabrice Bellard 已提交
100 101
endif

F
Fabrice Bellard 已提交
102 103 104 105 106 107 108
# sun mediaLib specific stuff
# currently only works when libavcodec is used in mplayer
ifeq ($(HAVE_MLIB),yes)
OBJS += mlib/dsputil_mlib.o
CFLAGS += $(MLIB_INC)
endif

109 110
# alpha specific stuff
ifeq ($(TARGET_ARCH_ALPHA),yes)
111 112
OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
	alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
113
ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
114
CFLAGS += -fforce-addr -freduce-all-givs
115 116
endif

117
ifeq ($(TARGET_ARCH_POWERPC),yes)
118
OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
119 120
endif

121
ifeq ($(TARGET_MMI),yes)
122
OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
123 124
endif

125
ifeq ($(TARGET_ALTIVEC),yes)
126
ifeq ($(TARGET_OS),Darwin)
127
CFLAGS += -faltivec
128 129 130
else
CFLAGS += -maltivec -mabi=altivec
endif
131
OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
132
        ppc/fft_altivec.o ppc/gmc_altivec.o
133 134
endif

135 136 137 138 139
ifeq ($(TARGET_ARCH_SH4),yes)
OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
endif


140
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
F
Fabrice Bellard 已提交
141
OBJS := $(OBJS) $(ASM_OBJS)
142

143
LIB= $(LIBPREF)avcodec$(LIBSUF)
N
Nick Kurshev 已提交
144
ifeq ($(BUILD_SHARED),yes)
145
SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
N
Nick Kurshev 已提交
146
endif
147
TESTS= imgresample-test dct-test motion-test fft-test
F
Fabrice Bellard 已提交
148

N
Nick Kurshev 已提交
149
all: $(LIB) $(SLIB)
F
Fabrice Bellard 已提交
150

Z
Zdenek Kabelac 已提交
151 152 153
amrlibs:
	$(MAKE) -C amr spclib fipoplib

N
Nick Kurshev 已提交
154
tests: apiexample cpuid_test $(TESTS)
F
Fabrice Bellard 已提交
155

Z
Zdenek Kabelac 已提交
156
$(LIB): $(OBJS) $(AMRLIBS)
F
Fabrice Bellard 已提交
157
	rm -f $@
Z
Zdenek Kabelac 已提交
158
	$(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
M
Michael Niedermayer 已提交
159
	$(RANLIB) $@
F
Fabrice Bellard 已提交
160

161
$(SLIB): $(OBJS)
Z
Zdenek Kabelac 已提交
162
	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
F
Fabrice Bellard 已提交
163 164 165

dsputil.o: dsputil.c dsputil.h

166 167 168
libpostproc/libpostproc.a:
	$(MAKE) -C libpostproc

F
Fabrice Bellard 已提交
169 170 171
%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $< 

F
Fabrice Bellard 已提交
172 173 174
%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

175 176 177 178 179 180 181 182 183 184 185
# motion_est_alpha uses the MVI extension, which is not available with
# -mcpu=ev4 (default) or ev5/ev56. Thus, force -mcpu=pca56 in those
# cases.
ifeq ($(TARGET_ARCH_ALPHA),yes)
alpha/motion_est_alpha.o: alpha/motion_est_alpha.c
	cpu=`echo "$(CFLAGS)" | sed -n 's,.*-mcpu=\([a-zA-Z0-9]*\).*,\1,p'`; \
	case x"$$cpu" in x|xev[45]*) newcpu=pca56;; *) newcpu=$$cpu;; esac; \
	echo $(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<;\
	$(CC) $(CFLAGS) -mcpu=$$newcpu -c -o $@ $<
endif

186
depend: $(SRCS)
187
	$(CC) -MM $(CFLAGS) $^ 1>.depend
188

189 190
dep:	depend

Z
Zdenek Kabelac 已提交
191
clean: $(CLEANAMR)
192
	rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
F
Fabrice Bellard 已提交
193
	   armv4l/*.o armv4l/*~ \
F
Fabrice Bellard 已提交
194
	   mlib/*.o mlib/*~ \
195
	   alpha/*.o alpha/*~ \
196
	   ppc/*.o ppc/*~ \
197
	   ps2/*.o ps2/*~ \
198
	   sh4/*.o sh4/*~ \
Z
Zdenek Kabelac 已提交
199 200
	   liba52/*.o liba52/*~ \
	   apiexample $(TESTS)
Z
Zdenek Kabelac 已提交
201
	$(MAKE) -C libpostproc clean
F
Fabrice Bellard 已提交
202

203
distclean: clean
204 205
	rm -f Makefile.bak .depend

Z
Zdenek Kabelac 已提交
206 207 208 209 210 211
cleanamr:
	$(MAKE) -C amr clean

cleanamrfloat:
	rm -f amr_float/*.o

F
Fabrice Bellard 已提交
212 213
# api example program
apiexample: apiexample.c $(LIB)
M
Michael Niedermayer 已提交
214
	$(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
F
Fabrice Bellard 已提交
215

N
Nick Kurshev 已提交
216 217 218 219
# cpuid test
cpuid_test: i386/cputest.c
	$(CC) $(CFLAGS) -D__TEST__ -o $@ $<

F
Fabrice Bellard 已提交
220 221 222
# testing progs

imgresample-test: imgresample.c
M
Michael Niedermayer 已提交
223
	$(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
F
Fabrice Bellard 已提交
224

F
Fabrice Bellard 已提交
225
dct-test: dct-test.o fdctref.o $(LIB)
226
	$(CC) -o $@ $^ -lm
227

F
Fabrice Bellard 已提交
228
motion-test: motion_test.o $(LIB)
M
Michael Niedermayer 已提交
229
	$(CC) -o $@ $^ -lm
F
Fabrice Bellard 已提交
230

231
fft-test: fft-test.o $(LIB)
232 233
	$(CC) -o $@ $^ -lm

N
Nick Kurshev 已提交
234 235
install: all
ifeq ($(BUILD_SHARED),yes)
236
	install -d $(prefix)/lib
F
Fabrice Bellard 已提交
237
	install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
238 239
	ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
	ldconfig || true
F
Fabrice Bellard 已提交
240
	mkdir -p $(prefix)/include/ffmpeg
241 242
	install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
	install -m 644 $(VPATH)/common.h $(prefix)/include/ffmpeg/common.h
N
Nick Kurshev 已提交
243
endif
244 245 246 247 248 249 250

installlib: all
	install -m 644 $(LIB) $(prefix)/lib
	mkdir -p $(prefix)/include/ffmpeg
	install -m 644 $(SRC_PATH)/libavcodec/avcodec.h $(SRC_PATH)/libavcodec/common.h \
                $(prefix)/include/ffmpeg

251 252 253 254 255 256
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif