Makefile 5.6 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 17
      motion_est.o imgconvert.o imgresample.o \
      mpeg12.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
21 22 23 24 25

ifeq ($(AMR_NB),yes)
OBJS+= amr.o
endif

26
ASM_OBJS=
F
Fabrice Bellard 已提交
27

M
Michael Niedermayer 已提交
28 29
# codecs which are patented in some non free countries like the us
ifeq ($(CONFIG_RISKY),yes)
30
OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
M
Michael Niedermayer 已提交
31 32
endif

Z
Zdenek Kabelac 已提交
33
# currently using liba52 for ac3 decoding
34
ifeq ($(CONFIG_AC3),yes)
Z
Zdenek Kabelac 已提交
35 36 37
OBJS+= a52dec.o

# using builtin liba52 or runtime linked liba52.so.0
F
Fabrice Bellard 已提交
38
ifneq ($(CONFIG_A52BIN),yes)
Z
Zdenek Kabelac 已提交
39
OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
A
Arpi 已提交
40
	liba52/imdct.o  liba52/parse.o liba52/crc.o liba52/resample.o
41
endif
F
Fabrice Bellard 已提交
42
endif
F
Fabrice Bellard 已提交
43

44 45
ifeq ($(CONFIG_FAAD),yes)
OBJS+= faad.o
Z
Zdenek Kabelac 已提交
46 47 48 49 50
ifeq ($(CONFIG_FAADBIN),yes)
# no libs needed
else
EXTRALIBS += -lfaad
endif
51 52
endif

53 54 55 56 57 58 59 60 61
ifeq ($(CONFIG_PP),yes)
ifeq ($(SHARED_PP),yes)
EXTRALIBS += -lpostproc
else
# LIBS += libpostproc/libpostproc.a ... should be fixed
OBJS += libpostproc/postprocess.o
endif
endif

62 63
ifeq ($(CONFIG_MP3LAME),yes)
OBJS += mp3lameaudio.o
Z
Zdenek Kabelac 已提交
64
EXTRALIBS += -lmp3lame
65 66
endif

67 68 69 70 71
ifeq ($(CONFIG_VORBIS),yes)
OBJS += oggvorbis.o
EXTRALIBS += -lvorbis -lvorbisenc
endif

72 73 74 75 76
ifeq ($(TARGET_GPROF),yes)
CFLAGS+=-p
LDFLAGS+=-p
endif

F
Fabrice Bellard 已提交
77
# i386 mmx specific stuff
78
ifeq ($(TARGET_MMX),yes)
F
Fabrice Bellard 已提交
79
OBJS += i386/fdct_mmx.o i386/cputest.o \
F
Fabrice Bellard 已提交
80
	i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
Z
Zdenek Kabelac 已提交
81
	i386/idct_mmx.o i386/motion_est_mmx.o \
82
	i386/simple_idct_mmx.o i386/fft_sse.o
83 84 85
ifdef TARGET_BUILTIN_VECTOR
i386/fft_sse.o: CFLAGS+= -msse
endif
F
Fabrice Bellard 已提交
86 87
endif

F
Fabrice Bellard 已提交
88 89 90
# armv4l specific stuff
ifeq ($(TARGET_ARCH_ARMV4L),yes)
ASM_OBJS += armv4l/jrevdct_arm.o
91
OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
F
Fabrice Bellard 已提交
92 93
endif

F
Fabrice Bellard 已提交
94 95 96 97 98 99 100
# 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

101 102
# alpha specific stuff
ifeq ($(TARGET_ARCH_ALPHA),yes)
103 104
OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
	alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
105
ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
106
CFLAGS += -fforce-addr -freduce-all-givs
107 108
endif

109
ifeq ($(TARGET_ARCH_POWERPC),yes)
110
OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
111 112
endif

113
ifeq ($(TARGET_MMI),yes)
114
OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
115 116
endif

117
ifeq ($(TARGET_ALTIVEC),yes)
118
ifeq ($(TARGET_OS),Darwin)
119
CFLAGS += -faltivec
120 121 122
else
CFLAGS += -maltivec -mabi=altivec
endif
123
OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
124
        ppc/fft_altivec.o ppc/gmc_altivec.o
125 126
endif

127 128 129 130 131
ifeq ($(TARGET_ARCH_SH4),yes)
OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
endif


132
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
F
Fabrice Bellard 已提交
133
OBJS := $(OBJS) $(ASM_OBJS)
134

135
LIB= $(LIBPREF)avcodec$(LIBSUF)
N
Nick Kurshev 已提交
136
ifeq ($(BUILD_SHARED),yes)
137
SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
N
Nick Kurshev 已提交
138
endif
139
TESTS= imgresample-test dct-test motion-test fft-test
F
Fabrice Bellard 已提交
140

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

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

145
$(LIB): $(OBJS)
F
Fabrice Bellard 已提交
146
	rm -f $@
M
Michael Niedermayer 已提交
147 148
	$(AR) rc $@ $(OBJS)
	$(RANLIB) $@
F
Fabrice Bellard 已提交
149

150
$(SLIB): $(OBJS)
151
	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
F
Fabrice Bellard 已提交
152 153 154

dsputil.o: dsputil.c dsputil.h

155 156 157
libpostproc/libpostproc.a:
	$(MAKE) -C libpostproc

F
Fabrice Bellard 已提交
158 159 160
%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $< 

F
Fabrice Bellard 已提交
161 162 163
%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

164 165 166 167 168 169 170 171 172 173 174
# 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

175
depend: $(SRCS)
176
	$(CC) -MM $(CFLAGS) $^ 1>.depend
177

178 179
dep:	depend

F
Fabrice Bellard 已提交
180
clean: 
181
	rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
F
Fabrice Bellard 已提交
182
	   armv4l/*.o armv4l/*~ \
F
Fabrice Bellard 已提交
183
	   mlib/*.o mlib/*~ \
184
	   alpha/*.o alpha/*~ \
185
	   ppc/*.o ppc/*~ \
186
	   ps2/*.o ps2/*~ \
187
	   sh4/*.o sh4/*~ \
Z
Zdenek Kabelac 已提交
188 189
	   liba52/*.o liba52/*~ \
	   apiexample $(TESTS)
Z
Zdenek Kabelac 已提交
190
	$(MAKE) -C libpostproc clean
F
Fabrice Bellard 已提交
191

192
distclean: clean
193 194
	rm -f Makefile.bak .depend

F
Fabrice Bellard 已提交
195 196
# api example program
apiexample: apiexample.c $(LIB)
M
Michael Niedermayer 已提交
197
	$(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
F
Fabrice Bellard 已提交
198

N
Nick Kurshev 已提交
199 200 201 202
# cpuid test
cpuid_test: i386/cputest.c
	$(CC) $(CFLAGS) -D__TEST__ -o $@ $<

F
Fabrice Bellard 已提交
203 204 205
# testing progs

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

F
Fabrice Bellard 已提交
208
dct-test: dct-test.o fdctref.o $(LIB)
209
	$(CC) -o $@ $^ -lm
210

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

214
fft-test: fft-test.o $(LIB)
215 216
	$(CC) -o $@ $^ -lm

N
Nick Kurshev 已提交
217 218
install: all
ifeq ($(BUILD_SHARED),yes)
219
	install -d $(prefix)/lib
F
Fabrice Bellard 已提交
220
	install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
221 222
	ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
	ldconfig || true
F
Fabrice Bellard 已提交
223
	mkdir -p $(prefix)/include/ffmpeg
224 225
	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 已提交
226
endif
227 228 229 230 231 232 233

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

234 235 236 237 238 239
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif