Makefile 3.7 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 14
OBJS= common.o utils.o mem.o allcodecs.o \
      mpegvideo.o h263.o jrevdct.o jfdctfst.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 \
M
Michael Niedermayer 已提交
18
      ratecontrol.o adpcm.o eval.o
19
ASM_OBJS=
F
Fabrice Bellard 已提交
20

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

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

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

37 38 39 40 41
ifeq ($(TARGET_GPROF),yes)
CFLAGS+=-p
LDFLAGS+=-p
endif

F
Fabrice Bellard 已提交
42
# i386 mmx specific stuff
43
ifeq ($(TARGET_MMX),yes)
F
Fabrice Bellard 已提交
44
OBJS += i386/fdct_mmx.o i386/cputest.o \
F
Fabrice Bellard 已提交
45
	i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
Z
Zdenek Kabelac 已提交
46
	i386/idct_mmx.o i386/motion_est_mmx.o \
47
	i386/simple_idct_mmx.o
F
Fabrice Bellard 已提交
48 49
endif

F
Fabrice Bellard 已提交
50 51 52 53 54 55
# armv4l specific stuff
ifeq ($(TARGET_ARCH_ARMV4L),yes)
ASM_OBJS += armv4l/jrevdct_arm.o
OBJS += armv4l/dsputil_arm.o
endif

F
Fabrice Bellard 已提交
56 57 58 59 60 61 62
# 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

63 64
# alpha specific stuff
ifeq ($(TARGET_ARCH_ALPHA),yes)
65
OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o alpha/motion_est_alpha.o
66
ASM_OBJS += alpha/dsputil_alpha_asm.o
F
Falk Hüffner 已提交
67
CFLAGS += -Wa,-mpca56 -finline-limit=8000 -fforce-addr -freduce-all-givs
68 69
endif

70 71 72 73 74
ifeq ($(TARGET_ARCH_POWERPC),yes)
CFLAGS += -faltivec
OBJS += ppc/dsputil_altivec.o
endif

75
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
F
Fabrice Bellard 已提交
76
OBJS := $(OBJS) $(ASM_OBJS)
77

F
Fabrice Bellard 已提交
78
LIB= libavcodec.a
N
Nick Kurshev 已提交
79
ifeq ($(BUILD_SHARED),yes)
F
Fabrice Bellard 已提交
80
SLIB= libavcodec.so
N
Nick Kurshev 已提交
81
endif
F
Fabrice Bellard 已提交
82
TESTS= imgresample-test dct-test motion-test
F
Fabrice Bellard 已提交
83

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

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

F
Fabrice Bellard 已提交
88
$(LIB): $(OBJS)
F
Fabrice Bellard 已提交
89
	rm -f $@
90
	$(AR) rcs $@ $(OBJS)
F
Fabrice Bellard 已提交
91 92

$(SLIB): $(OBJS)
93
	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
F
Fabrice Bellard 已提交
94 95 96 97 98 99

dsputil.o: dsputil.c dsputil.h

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

F
Fabrice Bellard 已提交
100 101 102
%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

103 104 105 106 107 108
# depend only used by mplayer now
dep:	depend

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

F
Fabrice Bellard 已提交
109
clean: 
Z
Zdenek Kabelac 已提交
110
	rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
F
Fabrice Bellard 已提交
111
	   armv4l/*.o armv4l/*~ \
F
Fabrice Bellard 已提交
112
	   mlib/*.o mlib/*~ \
113
	   alpha/*.o alpha/*~ \
114
	   ppc/*.o ppc/*~ \
Z
Zdenek Kabelac 已提交
115 116
	   liba52/*.o liba52/*~ \
	   apiexample $(TESTS)
F
Fabrice Bellard 已提交
117

118
distclean: clean
119 120
	rm -f Makefile.bak .depend

F
Fabrice Bellard 已提交
121 122 123 124
# api example program
apiexample: apiexample.c $(LIB)
	$(CC) $(CFLAGS) -o $@ $< $(LIB) -lm

N
Nick Kurshev 已提交
125 126 127 128
# cpuid test
cpuid_test: i386/cputest.c
	$(CC) $(CFLAGS) -D__TEST__ -o $@ $<

F
Fabrice Bellard 已提交
129 130 131 132 133
# testing progs

imgresample-test: imgresample.c
	$(CC) $(CFLAGS) -DTEST -o $@ $^ 

F
Fabrice Bellard 已提交
134
dct-test: dct-test.o jfdctfst.o i386/fdct_mmx.o \
F
Fabrice Bellard 已提交
135
          fdctref.o jrevdct.o i386/idct_mmx.o
136
	$(CC) -o $@ $^ -lm
137

F
Fabrice Bellard 已提交
138 139 140
motion-test: motion_test.o $(LIB)
	$(CC) -o $@ $^

N
Nick Kurshev 已提交
141 142
install: all
ifeq ($(BUILD_SHARED),yes)
143
	install -d $(prefix)/lib
F
Fabrice Bellard 已提交
144
	install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
145 146
	ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
	ldconfig || true
F
Fabrice Bellard 已提交
147 148 149
	mkdir -p $(prefix)/include/ffmpeg
	install -m 644 avcodec.h $(prefix)/include/ffmpeg/avcodec.h
	install -m 644 common.h $(prefix)/include/ffmpeg/common.h
N
Nick Kurshev 已提交
150
endif
151 152 153 154 155 156 157

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

158 159 160 161 162 163
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif