From d047afe61571d6b8fab6ffb896ff48f147cc8f07 Mon Sep 17 00:00:00 2001 From: Xianyi Zhang Date: Thu, 15 Mar 2012 01:07:34 +0800 Subject: [PATCH] Set shared library soname in Linux. --- Makefile | 1 + Makefile.install | 1 + Makefile.system | 1 + exports/Makefile | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index eb9c4ff31..a320112a5 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,7 @@ shared : ifeq ($(OSNAME), Linux) $(MAKE) -C exports so -ln -fs $(LIBSONAME) libopenblas.so + -ln -fs $(LIBSONAME) libopenblas.so.$(MAJOR_VERSION) endif ifeq ($(OSNAME), FreeBSD) $(MAKE) -C exports so diff --git a/Makefile.install b/Makefile.install index 2778a491f..dbc28c568 100644 --- a/Makefile.install +++ b/Makefile.install @@ -44,6 +44,7 @@ install : lib.grd ifeq ($(OSNAME), Linux) -cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR) -ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/libopenblas.so + -ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/libopenblas.so.$(MAJOR_VERSION) endif ifeq ($(OSNAME), FreeBSD) -cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR) diff --git a/Makefile.system b/Makefile.system index 3f5c7b4fa..9f994a716 100644 --- a/Makefile.system +++ b/Makefile.system @@ -637,6 +637,7 @@ MD5SUM = md5sum AWK = awk REVISION = -r$(VERSION) +MAJOR_VERSION = $(word 1,$(subst ., ,$(VERSION))) CFLAGS = $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR) PFLAGS = $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR) -DPROFILE $(COMMON_PROF) diff --git a/exports/Makefile b/exports/Makefile index 2db6b6daa..28a0882e3 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -100,7 +100,7 @@ so : ../$(LIBSONAME) ../$(LIBSONAME) : ../$(LIBNAME) linux.def linktest.c $(CC) $(CFLAGS) -shared -o ../$(LIBSONAME) \ -Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive \ - -Wl,--retain-symbols-file=linux.def $(EXTRALIB) + -Wl,--retain-symbols-file=linux.def -Wl,-soname,libopenblas.so.$(MAJOR_VERSION) $(EXTRALIB) $(CC) $(CFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK. rm -f linktest