1 # Global rules for building shared libraries -*-Makefile-*-
3 # Each individual makefile should define the following variables:
4 # LIBRARY : name of the library being built (without the lib prefix)
5 # SOVERSION : the .so file version
7 # plus all variables required by the global Make.rules.in
13 LIBNAME = lib$(LIBRARY)
14 DEFNAME = $(LIBRARY).def
15 SONAME = $(LIBNAME).so.$(SOVERSION)
16 MODULE = $(LIBNAME).$(LIBEXT)
18 all: $(MODULE) $(MODULE:.dll=.a)
22 $(LIBNAME).so.$(SOVERSION): $(OBJS) $(VERSCRIPT) Makefile.in
23 $(LDSHARED) $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
25 $(LIBNAME).so: $(LIBNAME).so.$(SOVERSION)
26 $(RM) $@ && $(LN_S) $(LIBNAME).so.$(SOVERSION) $@
28 $(LIBNAME).a: $(DEFNAME)
29 $(DLLTOOL) -l $@ -d $(SRCDIR)/$(DEFNAME)
31 $(LIBNAME).dll: $(OBJS) $(DEFNAME) Makefile.in
32 $(DLLWRAP) --def $(SRCDIR)/$(DEFNAME) -o $@ $(OBJS) $(EXTRALIBS)
34 $(LIBNAME).$(SOVERSION).dylib: $(OBJS) Makefile.in
35 $(LDSHARED) -install_name $(libdir)/$(LIBNAME).$(SOVERSION).dylib $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
37 $(LIBNAME).dylib: $(LIBNAME).$(SOVERSION).dylib
38 $(RM) $@ && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $@
40 .PHONY: install-lib-so install-lib-dll install-lib-dylib install-dev-so install-dev-dll install-dev-dylib
42 install-lib-so: $(LIBNAME).so.$(SOVERSION) dummy
43 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
44 $(INSTALL_PROGRAM) $(LIBNAME).so.$(SOVERSION) $(DESTDIR)$(libdir)/$(LIBNAME).so.$(SOVERSION)
46 install-lib-dll: $(LIBNAME).dll dummy
47 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
48 $(INSTALL_DATA) $(LIBNAME).dll $(DESTDIR)$(libdir)/$(LIBNAME).dll
50 install-lib-dylib: $(LIBNAME).$(SOVERSION).dylib dummy
51 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
52 $(INSTALL_PROGRAM) $(LIBNAME).$(SOVERSION).dylib $(DESTDIR)$(libdir)/$(LIBNAME).$(SOVERSION).dylib
55 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
56 cd $(DESTDIR)$(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
58 install-dev-dll: $(LIBNAME).a dummy
59 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
60 $(INSTALL_DATA) $(LIBNAME).a $(DESTDIR)$(libdir)/$(LIBNAME).a
62 install-dev-dylib: dummy
63 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
64 cd $(DESTDIR)$(libdir) && $(RM) $(LIBNAME).dylib && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $(LIBNAME).dylib
66 install install-lib:: $(LIBEXT:%=install-lib-%)
67 install install-dev:: $(LIBEXT:%=install-dev-%)
70 -cd $(DESTDIR)$(libdir) && $(RM) $(LIBNAME).a $(LIBNAME).dll $(LIBNAME).so $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dylib $(LIBNAME).$(SOVERSION).dylib
73 $(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll $(LIBNAME).$(SOVERSION).dylib