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 DYNAME = $(LIBNAME).$(SOVERSION).dylib
17 MODULE = $(LIBNAME).$(LIBEXT)
19 all: $(MODULE) $(MODULE:.dll=.a)
23 $(LIBNAME).so.$(SOVERSION): $(OBJS) $(VERSCRIPT) Makefile.in
24 $(LDSHARED) $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
26 $(LIBNAME).so: $(LIBNAME).so.$(SOVERSION)
27 $(RM) $@ && $(LN_S) $(LIBNAME).so.$(SOVERSION) $@
29 $(LIBNAME).a: $(DEFNAME)
30 $(DLLTOOL) -l $@ -d $(SRCDIR)/$(DEFNAME)
32 $(LIBNAME).dll: $(OBJS) $(DEFNAME) Makefile.in
33 $(DLLWRAP) --def $(SRCDIR)/$(DEFNAME) -o $@ $(OBJS) $(EXTRALIBS)
35 $(LIBNAME).$(SOVERSION).dylib: $(OBJS) $(RELPATH) Makefile.in
36 $(LDSHARED) $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
38 $(LIBNAME).dylib: $(LIBNAME).$(SOVERSION).dylib
39 $(RM) $@ && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $@
41 .PHONY: install-lib-so install-lib-dll install-lib-dylib install-dev-so install-dev-dll install-dev-dylib
43 install-lib-so: $(LIBNAME).so.$(SOVERSION) dummy
44 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
45 $(INSTALL_PROGRAM) $(LIBNAME).so.$(SOVERSION) $(DESTDIR)$(libdir)/$(LIBNAME).so.$(SOVERSION)
47 install-lib-dll: $(LIBNAME).dll dummy
48 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
49 $(INSTALL_DATA) $(LIBNAME).dll $(DESTDIR)$(libdir)/$(LIBNAME).dll
51 install-lib-dylib: $(LIBNAME).$(SOVERSION).dylib dummy
52 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
53 $(INSTALL_PROGRAM) $(LIBNAME).$(SOVERSION).dylib $(DESTDIR)$(libdir)/$(LIBNAME).$(SOVERSION).dylib
56 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
57 cd $(DESTDIR)$(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
59 install-dev-dll: $(LIBNAME).a dummy
60 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
61 $(INSTALL_DATA) $(LIBNAME).a $(DESTDIR)$(libdir)/$(LIBNAME).a
63 install-dev-dylib: dummy
64 $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
65 cd $(DESTDIR)$(libdir) && $(RM) $(LIBNAME).dylib && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $(LIBNAME).dylib
67 install install-lib:: $(LIBEXT:%=install-lib-%)
68 install install-dev:: $(LIBEXT:%=install-dev-%)
71 -cd $(DESTDIR)$(libdir) && $(RM) $(LIBNAME).a $(LIBNAME).dll $(LIBNAME).so $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dylib $(LIBNAME).$(SOVERSION).dylib
74 $(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll $(LIBNAME).$(SOVERSION).dylib
77 @cd $(TOOLSDIR)/tools && $(MAKE) relpath