Makefile 3.93 KB
Newer Older
1 2
#
# libavcodec Makefile
Fabrice Bellard's avatar
Fabrice Bellard committed
3
# (c) 2000, 2001, 2002 Fabrice Bellard
4
#
5 6
include ../config.mak

7 8
VPATH=$(SRC_PATH)/libavcodec

Fabrice Bellard's avatar
Fabrice Bellard committed
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
Fabrice Bellard's avatar
Fabrice Bellard committed
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 \
Fabrice Bellard's avatar
Fabrice Bellard committed
16
      motion_est.o imgconvert.o imgresample.o msmpeg4.o \
Nick Kurshev's avatar
Nick Kurshev committed
17
      mpeg12.o h263dec.o svq1.o rv10.o mpegaudiodec.o pcm.o simple_idct.o \
Michael Niedermayer's avatar
Michael Niedermayer committed
18
      ratecontrol.o adpcm.o eval.o
19
ASM_OBJS=
Fabrice Bellard's avatar
Fabrice Bellard committed
20

Zdenek Kabelac's avatar
Zdenek Kabelac committed
21
# currently using liba52 for ac3 decoding
22
ifeq ($(CONFIG_AC3),yes)
Zdenek Kabelac's avatar
Zdenek Kabelac committed
23 24 25
OBJS+= a52dec.o

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

32 33
ifeq ($(CONFIG_MP3LAME),yes)
OBJS += mp3lameaudio.o
Zdenek Kabelac's avatar
Zdenek Kabelac committed
34
EXTRALIBS += -lmp3lame
35 36
endif

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

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

Fabrice Bellard's avatar
Fabrice Bellard committed
47
# i386 mmx specific stuff
48
ifeq ($(TARGET_MMX),yes)
Fabrice Bellard's avatar
Fabrice Bellard committed
49
OBJS += i386/fdct_mmx.o i386/cputest.o \
Fabrice Bellard's avatar
Fabrice Bellard committed
50
	i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
Zdenek Kabelac's avatar
Zdenek Kabelac committed
51
	i386/idct_mmx.o i386/motion_est_mmx.o \
52
	i386/simple_idct_mmx.o
Fabrice Bellard's avatar
Fabrice Bellard committed
53 54
endif

Fabrice Bellard's avatar
Fabrice Bellard committed
55 56 57 58 59 60
# armv4l specific stuff
ifeq ($(TARGET_ARCH_ARMV4L),yes)
ASM_OBJS += armv4l/jrevdct_arm.o
OBJS += armv4l/dsputil_arm.o
endif

Fabrice Bellard's avatar
Fabrice Bellard committed
61 62 63 64 65 66 67
# 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

68 69
# alpha specific stuff
ifeq ($(TARGET_ARCH_ALPHA),yes)
70
OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o alpha/motion_est_alpha.o
71
ASM_OBJS += alpha/dsputil_alpha_asm.o
Falk Hüffner's avatar
Falk Hüffner committed
72
CFLAGS += -Wa,-mpca56 -finline-limit=8000 -fforce-addr -freduce-all-givs
73 74
endif

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

ifeq ($(TARGET_ALTIVEC),yes)
80 81 82 83
CFLAGS += -faltivec
OBJS += ppc/dsputil_altivec.o
endif

84
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
Fabrice Bellard's avatar
Fabrice Bellard committed
85
OBJS := $(OBJS) $(ASM_OBJS)
86

Fabrice Bellard's avatar
Fabrice Bellard committed
87
LIB= libavcodec.a
Nick Kurshev's avatar
Nick Kurshev committed
88
ifeq ($(BUILD_SHARED),yes)
Fabrice Bellard's avatar
Fabrice Bellard committed
89
SLIB= libavcodec.so
Nick Kurshev's avatar
Nick Kurshev committed
90
endif
Fabrice Bellard's avatar
Fabrice Bellard committed
91
TESTS= imgresample-test dct-test motion-test
Fabrice Bellard's avatar
Fabrice Bellard committed
92

Nick Kurshev's avatar
Nick Kurshev committed
93
all: $(LIB) $(SLIB)
Fabrice Bellard's avatar
Fabrice Bellard committed
94

Nick Kurshev's avatar
Nick Kurshev committed
95
tests: apiexample cpuid_test $(TESTS)
Fabrice Bellard's avatar
Fabrice Bellard committed
96

Fabrice Bellard's avatar
Fabrice Bellard committed
97
$(LIB): $(OBJS)
Fabrice Bellard's avatar
Fabrice Bellard committed
98
	rm -f $@
Michael Niedermayer's avatar
Michael Niedermayer committed
99 100
	$(AR) rc $@ $(OBJS)
	$(RANLIB) $@
Fabrice Bellard's avatar
Fabrice Bellard committed
101 102

$(SLIB): $(OBJS)
103
	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS)
Fabrice Bellard's avatar
Fabrice Bellard committed
104 105 106 107 108 109

dsputil.o: dsputil.c dsputil.h

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

Fabrice Bellard's avatar
Fabrice Bellard committed
110 111 112
%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

113 114 115 116 117 118
# depend only used by mplayer now
dep:	depend

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

Fabrice Bellard's avatar
Fabrice Bellard committed
119
clean: 
Zdenek Kabelac's avatar
Zdenek Kabelac committed
120
	rm -f *.o *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
Fabrice Bellard's avatar
Fabrice Bellard committed
121
	   armv4l/*.o armv4l/*~ \
Fabrice Bellard's avatar
Fabrice Bellard committed
122
	   mlib/*.o mlib/*~ \
123
	   alpha/*.o alpha/*~ \
124
	   ppc/*.o ppc/*~ \
Zdenek Kabelac's avatar
Zdenek Kabelac committed
125 126
	   liba52/*.o liba52/*~ \
	   apiexample $(TESTS)
Fabrice Bellard's avatar
Fabrice Bellard committed
127

128
distclean: clean
129 130
	rm -f Makefile.bak .depend

Fabrice Bellard's avatar
Fabrice Bellard committed
131 132 133 134
# api example program
apiexample: apiexample.c $(LIB)
	$(CC) $(CFLAGS) -o $@ $< $(LIB) -lm

Nick Kurshev's avatar
Nick Kurshev committed
135 136 137 138
# cpuid test
cpuid_test: i386/cputest.c
	$(CC) $(CFLAGS) -D__TEST__ -o $@ $<

Fabrice Bellard's avatar
Fabrice Bellard committed
139 140 141 142 143
# testing progs

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

Michael Niedermayer's avatar
Michael Niedermayer committed
144 145
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
146
	$(CC) -o $@ $^ -lm
147

Fabrice Bellard's avatar
Fabrice Bellard committed
148 149 150
motion-test: motion_test.o $(LIB)
	$(CC) -o $@ $^

Nick Kurshev's avatar
Nick Kurshev committed
151 152
install: all
ifeq ($(BUILD_SHARED),yes)
153
	install -d $(prefix)/lib
Fabrice Bellard's avatar
Fabrice Bellard committed
154
	install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
155 156
	ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
	ldconfig || true
Fabrice Bellard's avatar
Fabrice Bellard committed
157 158 159
	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
Nick Kurshev's avatar
Nick Kurshev committed
160
endif
161 162 163 164 165 166 167

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

168 169 170 171 172 173
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif