SONAME support for shared libs
[ffmpeg.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 ifeq ($(CONFIG_DARWIN),yes)
28 SHFLAGS += -Wl,-install_name,$(libdir)/$(SLIBNAME),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION)
29 endif
30 endif
31
32 all: $(LIB) $(SLIBNAME)
33
34 $(LIB): $(OBJS)
35         rm -f $@
36         $(AR) rc $@ $(OBJS)
37         $(RANLIB) $@
38
39 $(SLIBNAME): $(OBJS)
40 ifeq ($(CONFIG_WIN32),yes)
41         $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
42         -lib /machine:i386 /def:$(@:.dll=.def)
43 else
44         $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
45 endif
46
47 %.o: %.c
48         $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< 
49
50 depend: $(SRCS)
51         $(CC) -MM $(CFLAGS) $^ 1>.depend
52
53 dep:    depend
54
55 clean:
56         rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF)
57
58 distclean: clean
59         rm -f Makefile.bak .depend
60
61
62 ifeq ($(BUILD_SHARED),yes)
63 install: all install-headers
64 ifeq ($(CONFIG_WIN32),yes)
65         install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
66 else
67         install -d $(libdir)
68         install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/libavutil-$(VERSION)$(SLIBSUF)
69         ln -sf libavutil-$(VERSION)$(SLIBSUF) $(libdir)/$(SLIBNAME)
70         $(LDCONFIG) || true
71 endif
72 else
73 install:
74 endif
75
76 installlib: all install-headers
77         install -m 644 $(LIB) "$(libdir)"
78
79 install-headers:
80         mkdir -p "$(prefix)/include/ffmpeg"
81         install -m 644 $(SRC_PATH)/libavutil/avutil.h \
82                        $(SRC_PATH)/libavutil/common.h \
83                        $(SRC_PATH)/libavutil/mathematics.h \
84                        $(SRC_PATH)/libavutil/integer.h \
85                        $(SRC_PATH)/libavutil/rational.h \
86                        $(SRC_PATH)/libavutil/intfloat_readwrite.h \
87                 "$(prefix)/include/ffmpeg"
88         install -d "$(libdir)/pkgconfig"
89         install -m 644 ../libavutil.pc "$(libdir)/pkgconfig"
90
91 #
92 # include dependency files if they exist
93 #
94 ifneq ($(wildcard .depend),)
95 include .depend
96 endif