47ce5520ee8d911fc4e39af1779144ddce916678
[libav.git] / libavutil / Makefile
1 #
2 # libavutil Makefile
3 #
4 include ../config.mak
5
6 VPATH=$(SRC_PATH)/libavutil
7
8 # NOTE: -I.. is needed to include config.h
9 CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
10
11 OBJS= mathematics.o \
12 integer.o \
13 rational.o \
14 intfloat_readwrite.o \
15
16
17 ifeq ($(TARGET_ARCH_SPARC64),yes)
18 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
19 endif
20
21 SRCS := $(OBJS:.o=.c)
22
23 LIB= $(LIBPREF)avutil$(LIBSUF)
24 ifeq ($(BUILD_SHARED),yes)
25 LIBVERSION=$(LAVUMAJOR)
26 SLIBNAME= $(SLIBPREF)avutil$(SLIBSUF)
27 endif
28
29 all: $(LIB) $(SLIBNAME)
30
31 $(LIB): $(OBJS)
32 rm -f $@
33 $(AR) rc $@ $(OBJS)
34 $(RANLIB) $@
35
36 $(SLIBNAME): $(OBJS)
37 ifeq ($(CONFIG_WIN32),yes)
38 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
39 -lib /machine:i386 /def:$(@:.dll=.def)
40 else
41 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
42 endif
43
44 %.o: %.c
45 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
46
47 depend: $(SRCS)
48 $(CC) -MM $(CFLAGS) $^ 1>.depend
49
50 dep: depend
51
52 clean:
53 rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF)
54
55 distclean: clean
56 rm -f Makefile.bak .depend
57
58
59 ifeq ($(BUILD_SHARED),yes)
60 install: all install-headers
61 ifeq ($(CONFIG_WIN32),yes)
62 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
63 else
64 install -d $(libdir)
65 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/libavutil-$(VERSION)$(SLIBSUF)
66 ln -sf libavutil-$(VERSION)$(SLIBSUF) $(libdir)/$(SLIBNAME)
67 $(LDCONFIG) || true
68 endif
69 else
70 install:
71 endif
72
73 installlib: all install-headers
74 install -m 644 $(LIB) "$(libdir)"
75
76 install-headers:
77 mkdir -p "$(prefix)/include/ffmpeg"
78 install -m 644 $(SRC_PATH)/libavutil/avutil.h \
79 $(SRC_PATH)/libavutil/common.h \
80 $(SRC_PATH)/libavutil/mathematics.h \
81 $(SRC_PATH)/libavutil/integer.h \
82 $(SRC_PATH)/libavutil/rational.h \
83 $(SRC_PATH)/libavutil/intfloat_readwrite.h \
84 "$(prefix)/include/ffmpeg"
85 install -d "$(libdir)/pkgconfig"
86 install -m 644 ../libavutil.pc "$(libdir)/pkgconfig"
87
88 #
89 # include dependency files if they exist
90 #
91 ifneq ($(wildcard .depend),)
92 include .depend
93 endif