# $Id$ # # special rules for ELF so linker invocation. # # Variables: # # prefix ... install prefix # DESTDIR ... temporary destination directory, where prefix resides. (Used by debian and rpm packagers) # LD ... path of linker (either CC or CXX) # OBJS ... objet files to be linked in. # EXT_LIBS ... pkg-config detected libraries. # LIBS ... list of optional additional libraries # SILENT_LIBS ... optional list of additional libraries, which are not propagated to pkg-config's .pc-file # LDFLAGS ... Additional linker flags # ARTIFACT ... The name of the build artifact # ABI_VERSION ... Version of the ABI for shared libraries. # NODEVRULES ... If non-empty don't generate install-dev rules. # LIBSUBDIR ... subdirectory where executable should be installed. # Will be set to $(ARCHLIBSUBDIR) or as a last fallback to'lib' if empty. # (Sometimes may be 'lib/foo' or 'lib64') # SOPERMS ... permission of installed .so. files. # Default is 644 under debian and 755 under redhat. # TARGET=lib$(ARTIFACT).so.$(ABI_VERSION) TARGET2=lib$(ARTIFACT).so ifeq ($(LIBSUBDIR),) ifeq ($(ARCHLIBSUBDIR),) LIBSUBDIR=lib else LIBSUBDIR=$(ARCHLIBSUBDIR) endif endif ifeq ($(SOPERMS),) SOPERMS=$(shell test -f /etc/redhat-release && echo 755 || echo 644) endif $(TARGET) $(TARGET2): $(OBJS) rm -f $(TARGET2) $(LD) -shared -Wl,-soname=$(TARGET) $(LDFLAGS) $(OBJS) $(SILENT_LIBS) $(LIBS) $(EXT_LIBS) -o $(TARGET) ln -s $(TARGET) $(TARGET2) link:: $(TARGET) $(TARGET2) install-bin:: $(TARGET) mkdir -p $(DESTDIR)$(prefix)/$(LIBSUBDIR) install -m $(SOPERMS) -p $(TARGET) $(DESTDIR)$(prefix)/$(LIBSUBDIR) ifeq ($(NODEVRULES),) install-dev:: $(TARGET2) mkdir -p $(DESTDIR)$(prefix)/$(LIBSUBDIR) cp -d --preserve=timestamps $(TARGET2) $(DESTDIR)$(prefix)/$(LIBSUBDIR) endif clean:: rm -f $(TARGET) $(TARGET2)