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) $(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) $(libdir)
44 $(INSTALL_PROGRAM) $(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).so.$(SOVERSION)
46 install-lib-dll: $(LIBNAME).dll dummy
47 $(MKINSTALLDIRS) $(libdir)
48 $(INSTALL_DATA) $(LIBNAME).dll $(libdir)/$(LIBNAME).dll
50 install-lib-dylib: $(LIBNAME).$(SOVERSION).dylib dummy
51 $(MKINSTALLDIRS) $(libdir)
52 $(INSTALL_PROGRAM) $(LIBNAME).$(SOVERSION).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
55 $(MKINSTALLDIRS) $(libdir)
56 cd $(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
58 install-dev-dll: $(LIBNAME).a dummy
59 $(MKINSTALLDIRS) $(libdir)
60 $(INSTALL_DATA) $(LIBNAME).a $(libdir)/$(LIBNAME).a
62 install-dev-dylib: dummy
63 $(MKINSTALLDIRS) $(libdir)
64 cd $(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 $(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
73 $(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll $(LIBNAME).$(SOVERSION).dylib