Add versioned symlinks for install target

This commit is contained in:
Pieter Noordhuis 2011-04-22 12:54:19 +02:00
parent dd9f0810dc
commit 81c00aab32

View File

@ -6,6 +6,9 @@ OBJ=net.o hiredis.o sds.o async.o
BINS=hiredis-example hiredis-test BINS=hiredis-example hiredis-test
LIBNAME=libhiredis LIBNAME=libhiredis
HIREDIS_MAJOR=0
HIREDIS_MINOR=10
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
OPTIMIZATION?=-O3 OPTIMIZATION?=-O3
ifeq ($(uname_S),SunOS) ifeq ($(uname_S),SunOS)
@ -14,8 +17,10 @@ ifeq ($(uname_S),SunOS)
LDFLAGS?=-L. LDFLAGS?=-L.
DYLIBSUFFIX=so DYLIBSUFFIX=so
STLIBSUFFIX=a STLIBSUFFIX=a
DYLIB_MINOR_NAME?=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR).$(HIREDIS_MINOR)
DYLIB_MAJOR_NAME?=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR)
DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX) DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX)
DYLIB_MAKE_CMD?=$(CC) -G -o $(DYLIBNAME) DYLIB_MAKE_CMD?=$(CC) -G -o $(DYLIBNAME) -h $(DYLIB_MINOR_NAME)
STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX) STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD?=ar rcs $(STLIBNAME) STLIB_MAKE_CMD?=ar rcs $(STLIBNAME)
else else
@ -26,8 +31,10 @@ ifeq ($(uname_S),Darwin)
OBJARCH?=-arch i386 -arch x86_64 OBJARCH?=-arch i386 -arch x86_64
DYLIBSUFFIX=dylib DYLIBSUFFIX=dylib
STLIBSUFFIX=a STLIBSUFFIX=a
DYLIB_MINOR_NAME?=$(LIBNAME).$(HIREDIS_MAJOR).$(HIREDIS_MINOR).$(DYLIBSUFFIX)
DYLIB_MAJOR_NAME?=$(LIBNAME).$(HIREDIS_MAJOR).$(DYLIBSUFFIX)
DYLIBNAME?=$(LIBNAME).$(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) STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD?=libtool -static -o $(STLIBNAME) - STLIB_MAKE_CMD?=libtool -static -o $(STLIBNAME) -
else else
@ -36,8 +43,10 @@ else
LDFLAGS?=-L. LDFLAGS?=-L.
DYLIBSUFFIX=so DYLIBSUFFIX=so
STLIBSUFFIX=a STLIBSUFFIX=a
DYLIB_MINOR_NAME?=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR).$(HIREDIS_MINOR)
DYLIB_MAJOR_NAME?=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR)
DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX) 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) STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD?=ar rcs $(STLIBNAME) STLIB_MAKE_CMD?=ar rcs $(STLIBNAME)
endif endif
@ -106,7 +115,11 @@ dep:
install: $(DYLIBNAME) $(STLIBNAME) install: $(DYLIBNAME) $(STLIBNAME)
mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH) mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
$(INSTALL) hiredis.h async.h adapters $(INSTALL_INCLUDE_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: 32bit:
@echo "" @echo ""