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) 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 .PHONY: install-lib-so install-lib-dll install-dev-so install-dev-dll
36 install-lib-so: $(LIBNAME).so.$(SOVERSION) dummy
37 $(MKINSTALLDIRS) $(libdir)
38 $(INSTALL_PROGRAM) $(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).so.$(SOVERSION)
40 install-lib-dll: $(LIBNAME).dll dummy
41 $(MKINSTALLDIRS) $(libdir)
42 $(INSTALL_DATA) $(LIBNAME).dll $(libdir)/$(LIBNAME).dll
45 $(MKINSTALLDIRS) $(libdir)
46 cd $(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
48 install-dev-dll: $(LIBNAME).a dummy
49 $(MKINSTALLDIRS) $(libdir)
50 $(INSTALL_DATA) $(LIBNAME).a $(libdir)/$(LIBNAME).a
52 install install-lib:: $(LIBEXT:%=install-lib-%)
53 install install-dev:: $(LIBEXT:%=install-dev-%)
56 $(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION)
59 $(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll