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
F
Fabrice Bellard 已提交
54 55
endif

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

F
Fabrice Bellard 已提交
62 63 64 65 66 67 68
# 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

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

77
ifeq ($(TARGET_ARCH_POWERPC),yes)
78
OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
79 80
endif

81
ifeq ($(TARGET_MMI),yes)
82
OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
83 84
endif

85
ifeq ($(TARGET_ALTIVEC),yes)
86
CFLAGS += -faltivec
87
OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o
88 89
endif

90
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
F
Fabrice Bellard 已提交
91
OBJS := $(OBJS) $(ASM_OBJS)
92

F
Fabrice Bellard 已提交
93
LIB= libavcodec.a
N
Nick Kurshev 已提交
94
ifeq ($(BUILD_SHARED),yes)
F
Fabrice Bellard 已提交
95
SLIB= libavcodec.so
N
Nick Kurshev 已提交
96
endif
97
TESTS= imgresample-test dct-test motion-test fft-test
F
Fabrice Bellard 已提交
98

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

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

F
Fabrice Bellard 已提交
103
$(LIB): $(OBJS)
F
Fabrice Bellard 已提交
104
	rm -f $@
M
Michael Niedermayer 已提交
105 106
	$(AR) rc $@ $(OBJS)
	$(RANLIB) $@
F
Fabrice Bellard 已提交
107 108

$(SLIB): $(OBJS)
109
	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
F
Fabrice Bellard 已提交
110 111 112

dsputil.o: dsputil.c dsputil.h

113 114 115 116 117 118 119 120
# specific sse code
%_sse.o : %_sse.c
	$(CC) $(CFLAGS) -msse -c -o $@ $< 

# specific 3dnow code
%_3dnow.o : %_3dnow.c
	$(CC) $(CFLAGS) -m3dnow -c -o $@ $< 

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

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

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

138 139 140 141 142 143
# depend only used by mplayer now
dep:	depend

depend:
	$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend

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

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

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

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

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

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

M
Michael Niedermayer 已提交
170 171
dct-test: dct-test.o jfdctfst.o jfdctint.o i386/fdct_mmx.o\
          fdctref.o jrevdct.o i386/idct_mmx.o simple_idct.o i386/simple_idct_mmx.o
172
	$(CC) -o $@ $^ -lm
173

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

177 178 179
fft-test: fft-test.o fft.o mdct.o
	$(CC) -o $@ $^ -lm

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

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

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