Sweden-Number/libs/Makelib.rules.in

74 lines
2.6 KiB
Makefile

# Global rules for building shared libraries -*-Makefile-*-
#
# Each individual makefile should define the following variables:
# LIBRARY : name of the library being built (without the lib prefix)
# SOVERSION : the .so file version
#
# plus all variables required by the global Make.rules.in
#
DEFS = $(EXTRADEFS)
DLLFLAGS = @DLLFLAGS@
LIBEXT = @LIBEXT@
LIBNAME = lib$(LIBRARY)
DEFNAME = $(LIBRARY).def
SONAME = $(LIBNAME).so.$(SOVERSION)
MODULE = $(LIBNAME).$(LIBEXT)
all: $(MODULE) $(MODULE:.dll=.a)
@MAKE_RULES@
$(LIBNAME).so.$(SOVERSION): $(OBJS) $(VERSCRIPT) Makefile.in
$(LDSHARED) $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
$(LIBNAME).so: $(LIBNAME).so.$(SOVERSION)
$(RM) $@ && $(LN_S) $(LIBNAME).so.$(SOVERSION) $@
$(LIBNAME).a: $(DEFNAME)
$(DLLTOOL) -l $@ -d $(SRCDIR)/$(DEFNAME)
$(LIBNAME).dll: $(OBJS) $(DEFNAME) Makefile.in
$(DLLWRAP) --def $(SRCDIR)/$(DEFNAME) -o $@ $(OBJS) $(EXTRALIBS)
$(LIBNAME).$(SOVERSION).dylib: $(OBJS) Makefile.in
$(LDSHARED) -install_name $(libdir)/$(LIBNAME).$(SOVERSION).dylib $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
$(LIBNAME).dylib: $(LIBNAME).$(SOVERSION).dylib
$(RM) $@ && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $@
.PHONY: install-lib-so install-lib-dll install-lib-dylib install-dev-so install-dev-dll install-dev-dylib
install-lib-so: $(LIBNAME).so.$(SOVERSION) dummy
$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
$(INSTALL_PROGRAM) $(LIBNAME).so.$(SOVERSION) $(DESTDIR)$(libdir)/$(LIBNAME).so.$(SOVERSION)
install-lib-dll: $(LIBNAME).dll dummy
$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
$(INSTALL_DATA) $(LIBNAME).dll $(DESTDIR)$(libdir)/$(LIBNAME).dll
install-lib-dylib: $(LIBNAME).$(SOVERSION).dylib dummy
$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
$(INSTALL_PROGRAM) $(LIBNAME).$(SOVERSION).dylib $(DESTDIR)$(libdir)/$(LIBNAME).$(SOVERSION).dylib
install-dev-so: dummy
$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
cd $(DESTDIR)$(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
install-dev-dll: $(LIBNAME).a dummy
$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
$(INSTALL_DATA) $(LIBNAME).a $(DESTDIR)$(libdir)/$(LIBNAME).a
install-dev-dylib: dummy
$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
cd $(DESTDIR)$(libdir) && $(RM) $(LIBNAME).dylib && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $(LIBNAME).dylib
install install-lib:: $(LIBEXT:%=install-lib-%)
install install-dev:: $(LIBEXT:%=install-dev-%)
uninstall::
-cd $(DESTDIR)$(libdir) && $(RM) $(LIBNAME).a $(LIBNAME).dll $(LIBNAME).so $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dylib $(LIBNAME).$(SOVERSION).dylib
clean::
$(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll $(LIBNAME).$(SOVERSION).dylib