Makefile 2.6 KB
Newer Older
1 2
include ../config.mak

3
CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H
F
Fabrice Bellard 已提交
4 5 6
LDFLAGS= -g

OBJS= common.o utils.o mpegvideo.o h263.o jrevdct.o jfdctfst.o \
7
      mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
F
Fabrice Bellard 已提交
8
      motion_est.o imgconvert.o imgresample.o msmpeg4.o \
F
Fabrice Bellard 已提交
9
      mpeg12.o h263dec.o rv10.o mpegaudiodec.o pcm.o
10
ASM_OBJS=
F
Fabrice Bellard 已提交
11 12

# currently using libac3 for ac3 decoding
13
ifeq ($(CONFIG_AC3),yes)
F
Fabrice Bellard 已提交
14 15 16
OBJS+= ac3dec.o \
       libac3/bit_allocate.o libac3/bitstream.o libac3/downmix.o \
       libac3/imdct.o  libac3/parse.o
17
endif
F
Fabrice Bellard 已提交
18 19

# i386 mmx specific stuff
20
ifeq ($(TARGET_MMX),yes)
F
Fabrice Bellard 已提交
21
OBJS += i386/fdct_mmx.o i386/cputest.o \
F
Fabrice Bellard 已提交
22
	i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
F
Fabrice Bellard 已提交
23
        i386/idct_mmx.o i386/motion_est_mmx.o
F
Fabrice Bellard 已提交
24 25
endif

F
Fabrice Bellard 已提交
26 27 28 29 30 31
# armv4l specific stuff
ifeq ($(TARGET_ARCH_ARMV4L),yes)
ASM_OBJS += armv4l/jrevdct_arm.o
OBJS += armv4l/dsputil_arm.o
endif

F
Fabrice Bellard 已提交
32 33 34 35 36 37 38
# 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

39 40
SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)

F
Fabrice Bellard 已提交
41
LIB= libavcodec.a
N
Nick Kurshev 已提交
42 43 44
ifeq ($(BUILD_SHARED),yes)
SLIB= libffmpeg-$(VERSION).so
endif
F
Fabrice Bellard 已提交
45
TESTS= imgresample-test dct-test motion-test
F
Fabrice Bellard 已提交
46

N
Nick Kurshev 已提交
47
all: $(LIB) $(SLIB)
N
Nick Kurshev 已提交
48
tests: apiexample cpuid_test $(TESTS)
F
Fabrice Bellard 已提交
49

50
$(LIB): $(OBJS) $(ASM_OBJS)
F
Fabrice Bellard 已提交
51
	rm -f $@
52
	$(AR) rcs $@ $(OBJS) $(ASM_OBJS)
F
Fabrice Bellard 已提交
53

N
Nick Kurshev 已提交
54 55 56 57
$(SLIB): $(OBJS) $(ASM_OBJS)
	rm -f $@
	$(CC) -shared -o $@ $(OBJS) $(ASM_OBJS)
	ln -sf $@ libffmpeg.so
F
Fabrice Bellard 已提交
58 59 60 61 62
dsputil.o: dsputil.c dsputil.h

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

F
Fabrice Bellard 已提交
63 64 65
%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

66 67 68 69 70 71
# depend only used by mplayer now
dep:	depend

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

F
Fabrice Bellard 已提交
72
clean: 
N
Nick Kurshev 已提交
73
	rm -f *.o *~ $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
F
Fabrice Bellard 已提交
74
	   armv4l/*.o armv4l/*~ \
F
Fabrice Bellard 已提交
75
	   mlib/*.o mlib/*~ \
F
Fabrice Bellard 已提交
76 77 78
           libac3/*.o libac3/*~ \
           apiexample $(TESTS)

79 80 81
distclean: clean
	rm -f Makefile.bak .depend

F
Fabrice Bellard 已提交
82 83 84 85
# api example program
apiexample: apiexample.c $(LIB)
	$(CC) $(CFLAGS) -o $@ $< $(LIB) -lm

N
Nick Kurshev 已提交
86 87 88 89
# cpuid test
cpuid_test: i386/cputest.c
	$(CC) $(CFLAGS) -D__TEST__ -o $@ $<

F
Fabrice Bellard 已提交
90 91 92 93 94
# testing progs

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

F
Fabrice Bellard 已提交
95
dct-test: dct-test.o jfdctfst.o i386/fdct_mmx.o \
F
Fabrice Bellard 已提交
96
          fdctref.o jrevdct.o i386/idct_mmx.o
F
Fabrice Bellard 已提交
97
	$(CC) -o $@ $^
98

F
Fabrice Bellard 已提交
99 100 101
motion-test: motion_test.o $(LIB)
	$(CC) -o $@ $^

N
Nick Kurshev 已提交
102
install: all
N
Nick Kurshev 已提交
103
#	install -m 644 $(LIB) $(prefix)/lib
N
Nick Kurshev 已提交
104 105 106 107
ifeq ($(BUILD_SHARED),yes)
	install -s -m 755 $(SLIB) $(prefix)/lib
	ln -sf $(prefix)/lib/$(SLIB) $(prefix)/lib/libffmpeg.so
	ldconfig
N
Nick Kurshev 已提交
108 109
	mkdir -p $(prefix)/include/libffmpeg
	install -m 644 avcodec.h $(prefix)/include/libffmpeg/avcodec.h
N
Nick Kurshev 已提交
110
	install -m 644 common.h $(prefix)/include/libffmpeg/common.h
N
Nick Kurshev 已提交
111
endif
112 113 114 115 116 117
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif