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
10 DEFS = @DLLFLAGS@ $(EXTRADEFS)
12 LIBNAME = lib$(LIBRARY)
13 DEFNAME = $(LIBRARY).def
14 SONAME = $(LIBNAME).so.$(SOVERSION)
15 MODULE = $(LIBNAME).$(LIBEXT)
17 all: $(MODULE) $(MODULE:.dll=.a)
21 $(LIBNAME).so.$(SOVERSION): $(OBJS) Makefile.in
22 $(LDSHARED) $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
24 $(LIBNAME).so: $(LIBNAME).so.$(SOVERSION)
25 $(RM) $@ && $(LN_S) $(LIBNAME).so.$(SOVERSION) $@
27 $(LIBNAME).a: $(DEFNAME)
28 $(DLLTOOL) -l $@ -d $(SRCDIR)/$(DEFNAME)
30 $(LIBNAME).dll: $(OBJS) $(DEFNAME) Makefile.in
31 $(DLLWRAP) --def $(SRCDIR)/$(DEFNAME) -o $@ $(OBJS) $(EXTRALIBS)
33 .PHONY: install-lib-so install-lib-dll install-dev-so install-dev-dll
35 install-lib-so: $(LIBNAME).so.$(SOVERSION) dummy
36 $(MKINSTALLDIRS) $(libdir)
37 $(INSTALL_PROGRAM) $(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).so.$(SOVERSION)
39 install-lib-dll: $(LIBNAME).dll dummy
40 $(MKINSTALLDIRS) $(libdir)
41 $(INSTALL_DATA) $(LIBNAME).dll $(libdir)/$(LIBNAME).dll
44 $(MKINSTALLDIRS) $(libdir)
45 cd $(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
47 install-dev-dll: $(LIBNAME).a dummy
48 $(MKINSTALLDIRS) $(libdir)
49 $(INSTALL_DATA) $(LIBNAME).a $(libdir)/$(LIBNAME).a
51 install install-lib:: $(LIBEXT:%=install-lib-%)
52 install install-dev:: $(LIBEXT:%=install-dev-%)
55 $(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION)
58 $(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll