summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile21
1 files changed, 17 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index d7f2c12..4c50eca 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,9 @@ OBJ=net.o hiredis.o sds.o async.o
BINS=hiredis-example hiredis-test
LIBNAME=libhiredis
+HIREDIS_MAJOR=0
+HIREDIS_MINOR=10
+
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
OPTIMIZATION?=-O3
ifeq ($(uname_S),SunOS)
@@ -14,8 +17,10 @@ ifeq ($(uname_S),SunOS)
LDFLAGS?=-L.
DYLIBSUFFIX=so
STLIBSUFFIX=a
+ DYLIB_MINOR_NAME?=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR).$(HIREDIS_MINOR)
+ DYLIB_MAJOR_NAME?=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR)
DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX)
- DYLIB_MAKE_CMD?=$(CC) -G -o $(DYLIBNAME)
+ DYLIB_MAKE_CMD?=$(CC) -G -o $(DYLIBNAME) -h $(DYLIB_MINOR_NAME)
STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD?=ar rcs $(STLIBNAME)
else
@@ -26,8 +31,10 @@ ifeq ($(uname_S),Darwin)
OBJARCH?=-arch i386 -arch x86_64
DYLIBSUFFIX=dylib
STLIBSUFFIX=a
+ DYLIB_MINOR_NAME?=$(LIBNAME).$(HIREDIS_MAJOR).$(HIREDIS_MINOR).$(DYLIBSUFFIX)
+ DYLIB_MAJOR_NAME?=$(LIBNAME).$(HIREDIS_MAJOR).$(DYLIBSUFFIX)
DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX)
- DYLIB_MAKE_CMD?=libtool -dynamic -o $(DYLIBNAME) -lm $(DEBUG) -
+ DYLIB_MAKE_CMD?=libtool -dynamic -o $(DYLIBNAME) -install_name $(DYLIB_MINOR_NAME) -lm $(DEBUG) -
STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD?=libtool -static -o $(STLIBNAME) -
else
@@ -36,8 +43,10 @@ else
LDFLAGS?=-L.
DYLIBSUFFIX=so
STLIBSUFFIX=a
+ DYLIB_MINOR_NAME?=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR).$(HIREDIS_MINOR)
+ DYLIB_MAJOR_NAME?=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR)
DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX)
- DYLIB_MAKE_CMD?=gcc -shared -Wl,-soname,$(DYLIBNAME) -o $(DYLIBNAME)
+ DYLIB_MAKE_CMD?=gcc -shared -Wl,-soname,$(DYLIB_MINOR_NAME) -o $(DYLIBNAME)
STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD?=ar rcs $(STLIBNAME)
endif
@@ -106,7 +115,11 @@ dep:
install: $(DYLIBNAME) $(STLIBNAME)
mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
$(INSTALL) hiredis.h async.h adapters $(INSTALL_INCLUDE_PATH)
- $(INSTALL) $(DYLIBNAME) $(STLIBNAME) $(INSTALL_LIBRARY_PATH)
+ $(INSTALL) $(DYLIBNAME) $(INSTALL_LIBRARY_PATH)/$(DYLIB_MINOR_NAME)
+ cd $(INSTALL_LIBRARY_PATH) && ln -sf $(DYLIB_MINOR_NAME) $(DYLIB_MAJOR_NAME)
+ cd $(INSTALL_LIBRARY_PATH) && ln -sf $(DYLIB_MAJOR_NAME) $(DYLIBNAME)
+ $(INSTALL) $(STLIBNAME) $(INSTALL_LIBRARY_PATH)
+
32bit:
@echo ""