Separate basename and suffix for library filename

This commit is contained in:
Pieter Noordhuis 2011-04-22 11:54:16 +02:00
parent 5c205359d9
commit 721e390de5

View File

@ -2,8 +2,9 @@
# Copyright (C) 2010 Salvatore Sanfilippo <antirez at gmail dot com> # Copyright (C) 2010 Salvatore Sanfilippo <antirez at gmail dot com>
# This file is released under the BSD license, see the COPYING file # This file is released under the BSD license, see the COPYING file
OBJ = net.o hiredis.o sds.o async.o OBJ=net.o hiredis.o sds.o async.o
BINS = hiredis-example hiredis-test BINS=hiredis-example hiredis-test
LIBNAME=libhiredis
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
@ -11,28 +12,34 @@ ifeq ($(uname_S),SunOS)
CFLAGS?=$(OPTIMIZATION) -fPIC -Wall -W -D__EXTENSIONS__ -D_XPG6 $(ARCH) $(PROF) CFLAGS?=$(OPTIMIZATION) -fPIC -Wall -W -D__EXTENSIONS__ -D_XPG6 $(ARCH) $(PROF)
CCLINK?=-ldl -lnsl -lsocket -lm -lpthread CCLINK?=-ldl -lnsl -lsocket -lm -lpthread
LDFLAGS?=-L. LDFLAGS?=-L.
DYLIBNAME?=libhiredis.so DYLIBSUFFIX=so
DYLIB_MAKE_CMD?=$(CC) -G -o ${DYLIBNAME} ${OBJ} STLIBSUFFIX=a
STLIBNAME?=libhiredis.a DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX)
STLIB_MAKE_CMD?=ar rcs ${STLIBNAME} ${OBJ} DYLIB_MAKE_CMD?=$(CC) -G -o $(DYLIBNAME) $(OBJ)
STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD?=ar rcs $(STLIBNAME) $(OBJ)
else else
ifeq ($(uname_S),Darwin) ifeq ($(uname_S),Darwin)
CFLAGS?=$(OPTIMIZATION) -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings $(ARCH) $(PROF) CFLAGS?=$(OPTIMIZATION) -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings $(ARCH) $(PROF)
CCLINK?=-lm -pthread CCLINK?=-lm -pthread
LDFLAGS?=-L. LDFLAGS?=-L.
OBJARCH?=-arch i386 -arch x86_64 OBJARCH?=-arch i386 -arch x86_64
DYLIBNAME?=libhiredis.dylib DYLIBSUFFIX=dylib
DYLIB_MAKE_CMD?=libtool -dynamic -o ${DYLIBNAME} -lm ${DEBUG} - ${OBJ} STLIBSUFFIX=a
STLIBNAME?=libhiredis.a DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX)
STLIB_MAKE_CMD?=libtool -static -o ${STLIBNAME} - ${OBJ} DYLIB_MAKE_CMD?=libtool -dynamic -o $(DYLIBNAME) -lm $(DEBUG) - $(OBJ)
STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD?=libtool -static -o $(STLIBNAME) - $(OBJ)
else else
CFLAGS?=$(OPTIMIZATION) -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings $(ARCH) $(PROF) CFLAGS?=$(OPTIMIZATION) -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings $(ARCH) $(PROF)
CCLINK?=-lm -pthread CCLINK?=-lm -pthread
LDFLAGS?=-L. LDFLAGS?=-L.
DYLIBNAME?=libhiredis.so DYLIBSUFFIX=so
DYLIB_MAKE_CMD?=gcc -shared -Wl,-soname,${DYLIBNAME} -o ${DYLIBNAME} ${OBJ} STLIBSUFFIX=a
STLIBNAME?=libhiredis.a DYLIBNAME?=$(LIBNAME).$(DYLIBSUFFIX)
STLIB_MAKE_CMD?=ar rcs ${STLIBNAME} ${OBJ} DYLIB_MAKE_CMD?=gcc -shared -Wl,-soname,$(DYLIBNAME) -o $(DYLIBNAME) $(OBJ)
STLIBNAME?=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD?=ar rcs $(STLIBNAME) $(OBJ)
endif endif
endif endif