summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2011-04-22 11:54:16 +0200
committerPieter Noordhuis <pcnoordhuis@gmail.com>2011-04-22 11:54:16 +0200
commit721e390de524dce95de4fc71d8bd5275006c4728 (patch)
tree93093a50125d034140d5bd5427a248cc21a4f2a4
parent5c205359d9e0f8e03877b2a856473593f0117cf0 (diff)
Separate basename and suffix for library filename
-rw-r--r--Makefile35
1 files changed, 21 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index f739d64..f49ed45 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,9 @@
# Copyright (C) 2010 Salvatore Sanfilippo <antirez at gmail dot com>
# This file is released under the BSD license, see the COPYING file
-OBJ = net.o hiredis.o sds.o async.o
-BINS = hiredis-example hiredis-test
+OBJ=net.o hiredis.o sds.o async.o
+BINS=hiredis-example hiredis-test
+LIBNAME=libhiredis
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
OPTIMIZATION?=-O3
@@ -11,28 +12,34 @@ ifeq ($(uname_S),SunOS)
CFLAGS?=$(OPTIMIZATION) -fPIC -Wall -W -D__EXTENSIONS__ -D_XPG6 $(ARCH) $(PROF)
CCLINK?=-ldl -lnsl -lsocket -lm -lpthread
LDFLAGS?=-L.
- DYLIBNAME?=libhiredis.so
- DYLIB_MAKE_CMD?=$(CC) -G -o ${DYLIBNAME} ${OBJ}
- STLIBNAME?=libhiredis.a
- STLIB_MAKE_CMD?=ar rcs ${STLIBNAME} ${OBJ}
+ DYLIBSUFFIX=so
+ STLIBSUFFIX=a
+ DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX)
+ DYLIB_MAKE_CMD?=$(CC) -G -o $(DYLIBNAME) $(OBJ)
+ STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
+ STLIB_MAKE_CMD?=ar rcs $(STLIBNAME) $(OBJ)
else
ifeq ($(uname_S),Darwin)
CFLAGS?=$(OPTIMIZATION) -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings $(ARCH) $(PROF)
CCLINK?=-lm -pthread
LDFLAGS?=-L.
OBJARCH?=-arch i386 -arch x86_64
- DYLIBNAME?=libhiredis.dylib
- DYLIB_MAKE_CMD?=libtool -dynamic -o ${DYLIBNAME} -lm ${DEBUG} - ${OBJ}
- STLIBNAME?=libhiredis.a
- STLIB_MAKE_CMD?=libtool -static -o ${STLIBNAME} - ${OBJ}
+ DYLIBSUFFIX=dylib
+ STLIBSUFFIX=a
+ DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX)
+ DYLIB_MAKE_CMD?=libtool -dynamic -o $(DYLIBNAME) -lm $(DEBUG) - $(OBJ)
+ STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
+ STLIB_MAKE_CMD?=libtool -static -o $(STLIBNAME) - $(OBJ)
else
CFLAGS?=$(OPTIMIZATION) -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings $(ARCH) $(PROF)
CCLINK?=-lm -pthread
LDFLAGS?=-L.
- DYLIBNAME?=libhiredis.so
- DYLIB_MAKE_CMD?=gcc -shared -Wl,-soname,${DYLIBNAME} -o ${DYLIBNAME} ${OBJ}
- STLIBNAME?=libhiredis.a
- STLIB_MAKE_CMD?=ar rcs ${STLIBNAME} ${OBJ}
+ DYLIBSUFFIX=so
+ STLIBSUFFIX=a
+ DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX)
+ DYLIB_MAKE_CMD?=gcc -shared -Wl,-soname,$(DYLIBNAME) -o $(DYLIBNAME) $(OBJ)
+ STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
+ STLIB_MAKE_CMD?=ar rcs $(STLIBNAME) $(OBJ)
endif
endif