Makefile 3.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 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
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
F
Fabrice Bellard 已提交
71
OBJS := $(OBJS) $(ASM_OBJS)
72

F
Fabrice Bellard 已提交
73
LIB= libavcodec.a
N
Nick Kurshev 已提交
74
ifeq ($(BUILD_SHARED),yes)
F
Fabrice Bellard 已提交
75
SLIB= libavcodec.so
N
Nick Kurshev 已提交
76
endif
F
Fabrice Bellard 已提交
77
TESTS= imgresample-test dct-test motion-test
F
Fabrice Bellard 已提交
78

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

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

F
Fabrice Bellard 已提交
83
$(LIB): $(OBJS)
F
Fabrice Bellard 已提交
84
	rm -f $@
85
	$(AR) rcs $@ $(OBJS)
F
Fabrice Bellard 已提交
86 87

$(SLIB): $(OBJS)
88
	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
F
Fabrice Bellard 已提交
89 90 91 92 93 94

dsputil.o: dsputil.c dsputil.h

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

F
Fabrice Bellard 已提交
95 96 97
%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

98 99 100 101 102 103
# depend only used by mplayer now
dep:	depend

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

F
Fabrice Bellard 已提交
104
clean: 
Z
Zdenek Kabelac 已提交
105
	rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
F
Fabrice Bellard 已提交
106
	   armv4l/*.o armv4l/*~ \
F
Fabrice Bellard 已提交
107
	   mlib/*.o mlib/*~ \
108
	   alpha/*.o alpha/*~ \
Z
Zdenek Kabelac 已提交
109 110
	   liba52/*.o liba52/*~ \
	   apiexample $(TESTS)
F
Fabrice Bellard 已提交
111

112
distclean: clean
113 114
	rm -f Makefile.bak .depend

F
Fabrice Bellard 已提交
115 116 117 118
# api example program
apiexample: apiexample.c $(LIB)
	$(CC) $(CFLAGS) -o $@ $< $(LIB) -lm

N
Nick Kurshev 已提交
119 120 121 122
# cpuid test
cpuid_test: i386/cputest.c
	$(CC) $(CFLAGS) -D__TEST__ -o $@ $<

F
Fabrice Bellard 已提交
123 124 125 126 127
# testing progs

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

F
Fabrice Bellard 已提交
128
dct-test: dct-test.o jfdctfst.o i386/fdct_mmx.o \
F
Fabrice Bellard 已提交
129
          fdctref.o jrevdct.o i386/idct_mmx.o
130
	$(CC) -o $@ $^ -lm
131

F
Fabrice Bellard 已提交
132 133 134
motion-test: motion_test.o $(LIB)
	$(CC) -o $@ $^

N
Nick Kurshev 已提交
135 136
install: all
ifeq ($(BUILD_SHARED),yes)
137
	install -d $(prefix)/lib
F
Fabrice Bellard 已提交
138
	install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
139 140
	ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
	ldconfig || true
F
Fabrice Bellard 已提交
141 142 143
	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 已提交
144
endif
145 146 147 148 149 150 151

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

152 153 154 155 156 157
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif