Makefile 4.9 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 \
14
      mpegvideo.o h263.o jrevdct.o jfdctfst.o jfdctint.o\
15
      mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
F
Fabrice Bellard 已提交
16
      motion_est.o imgconvert.o imgresample.o msmpeg4.o \
N
Nick Kurshev 已提交
17
      mpeg12.o h263dec.o svq1.o rv10.o mpegaudiodec.o pcm.o simple_idct.o \
18
      ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
M
huffyuv  
Michael Niedermayer 已提交
19
      wmadec.o fft.o mdct.o mace.o huffyuv.o
20
ASM_OBJS=
F
Fabrice Bellard 已提交
21

Z
Zdenek Kabelac 已提交
22
# currently using liba52 for ac3 decoding
23
ifeq ($(CONFIG_AC3),yes)
Z
Zdenek Kabelac 已提交
24 25 26
OBJS+= a52dec.o

# using builtin liba52 or runtime linked liba52.so.0
F
Fabrice Bellard 已提交
27
ifneq ($(CONFIG_A52BIN),yes)
Z
Zdenek Kabelac 已提交
28 29
OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
	liba52/imdct.o  liba52/parse.o
30
endif
F
Fabrice Bellard 已提交
31
endif
F
Fabrice Bellard 已提交
32

33 34
ifeq ($(CONFIG_MP3LAME),yes)
OBJS += mp3lameaudio.o
Z
Zdenek Kabelac 已提交
35
EXTRALIBS += -lmp3lame
36 37
endif

38 39 40 41 42
ifeq ($(CONFIG_VORBIS),yes)
OBJS += oggvorbis.o
EXTRALIBS += -lvorbis -lvorbisenc
endif

43 44 45 46 47
ifeq ($(TARGET_GPROF),yes)
CFLAGS+=-p
LDFLAGS+=-p
endif

F
Fabrice Bellard 已提交
48
# i386 mmx specific stuff
49
ifeq ($(TARGET_MMX),yes)
F
Fabrice Bellard 已提交
50
OBJS += i386/fdct_mmx.o i386/cputest.o \
F
Fabrice Bellard 已提交
51
	i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
Z
Zdenek Kabelac 已提交
52
	i386/idct_mmx.o i386/motion_est_mmx.o \
53
	i386/simple_idct_mmx.o i386/fft_sse.o
54 55 56
ifdef TARGET_BUILTIN_VECTOR
i386/fft_sse.o: CFLAGS+= -msse
endif
F
Fabrice Bellard 已提交
57 58
endif

F
Fabrice Bellard 已提交
59 60 61
# armv4l specific stuff
ifeq ($(TARGET_ARCH_ARMV4L),yes)
ASM_OBJS += armv4l/jrevdct_arm.o
62
OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
F
Fabrice Bellard 已提交
63 64
endif

F
Fabrice Bellard 已提交
65 66 67 68 69 70 71
# 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

72 73
# alpha specific stuff
ifeq ($(TARGET_ARCH_ALPHA),yes)
74 75
OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
	alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
76
ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
77
CFLAGS += -fforce-addr -freduce-all-givs
78 79
endif

80
ifeq ($(TARGET_ARCH_POWERPC),yes)
81
OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
82 83
endif

84
ifeq ($(TARGET_MMI),yes)
85
OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
86 87
endif

88
ifeq ($(TARGET_ALTIVEC),yes)
89
CFLAGS += -faltivec
90
OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
91
        ppc/fft_altivec.o ppc/gmc_altivec.o
92 93
endif

94
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
F
Fabrice Bellard 已提交
95
OBJS := $(OBJS) $(ASM_OBJS)
96

97
LIB= $(LIBPREF)avcodec$(LIBSUF)
N
Nick Kurshev 已提交
98
ifeq ($(BUILD_SHARED),yes)
99
SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
N
Nick Kurshev 已提交
100
endif
101
TESTS= imgresample-test dct-test motion-test fft-test
F
Fabrice Bellard 已提交
102

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

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

107
$(LIB): .depend $(OBJS)
F
Fabrice Bellard 已提交
108
	rm -f $@
M
Michael Niedermayer 已提交
109
	$(AR) rc $@ $(OBJS)
110
ifneq ($(CONFIG_OS2),yes)
M
Michael Niedermayer 已提交
111
	$(RANLIB) $@
112
endif
F
Fabrice Bellard 已提交
113

114
$(SLIB): .depend $(OBJS)
115
	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
F
Fabrice Bellard 已提交
116 117 118 119 120 121

dsputil.o: dsputil.c dsputil.h

%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $< 

F
Fabrice Bellard 已提交
122 123 124
%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

125 126 127 128 129 130 131 132 133 134 135
# 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

136
.depend: $(SRCS)
137
	$(CC) -MM $(CFLAGS) $^ 1>.depend
138

139 140
dep:	depend

141
depend: .depend
142

F
Fabrice Bellard 已提交
143
clean: 
144
	rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
F
Fabrice Bellard 已提交
145
	   armv4l/*.o armv4l/*~ \
F
Fabrice Bellard 已提交
146
	   mlib/*.o mlib/*~ \
147
	   alpha/*.o alpha/*~ \
148
	   ppc/*.o ppc/*~ \
149
	   ps2/*.o ps2/*~ \
Z
Zdenek Kabelac 已提交
150 151
	   liba52/*.o liba52/*~ \
	   apiexample $(TESTS)
F
Fabrice Bellard 已提交
152

153
distclean: clean
154 155
	rm -f Makefile.bak .depend

F
Fabrice Bellard 已提交
156 157
# api example program
apiexample: apiexample.c $(LIB)
M
Michael Niedermayer 已提交
158
	$(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
F
Fabrice Bellard 已提交
159

N
Nick Kurshev 已提交
160 161 162 163
# cpuid test
cpuid_test: i386/cputest.c
	$(CC) $(CFLAGS) -D__TEST__ -o $@ $<

F
Fabrice Bellard 已提交
164 165 166
# testing progs

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

F
Fabrice Bellard 已提交
169
dct-test: dct-test.o fdctref.o $(LIB)
170
	$(CC) -o $@ $^ -lm
171

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

175
fft-test: fft-test.o $(LIB)
176 177
	$(CC) -o $@ $^ -lm

N
Nick Kurshev 已提交
178 179
install: all
ifeq ($(BUILD_SHARED),yes)
180
	install -d $(prefix)/lib
F
Fabrice Bellard 已提交
181
	install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
182 183
	ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
	ldconfig || true
F
Fabrice Bellard 已提交
184
	mkdir -p $(prefix)/include/ffmpeg
185 186
	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 已提交
187
endif
188 189 190 191 192 193 194

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

195 196 197 198 199 200
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif