Sweden-Number/libs/Makelib.rules.in

74 lines
2.4 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) 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) $(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) $(libdir)
$(INSTALL_PROGRAM) $(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).so.$(SOVERSION)
install-lib-dll: $(LIBNAME).dll dummy
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) $(LIBNAME).dll $(libdir)/$(LIBNAME).dll
install-lib-dylib: $(LIBNAME).$(SOVERSION).dylib dummy
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_PROGRAM) $(LIBNAME).$(SOVERSION).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
install-dev-so: dummy
$(MKINSTALLDIRS) $(libdir)
cd $(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
install-dev-dll: $(LIBNAME).a dummy
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) $(LIBNAME).a $(libdir)/$(LIBNAME).a
install-dev-dylib: dummy
$(MKINSTALLDIRS) $(libdir)
cd $(libdir) && $(RM) $(LIBNAME).dylib && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $(LIBNAME).dylib
install install-lib:: $(LIBEXT:%=install-lib-%)
install install-dev:: $(LIBEXT:%=install-dev-%)
uninstall::
$(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
clean::
$(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll $(LIBNAME).$(SOVERSION).dylib