build: Support customizable library names.

This is primarily for Mac OS X at the moment, but may come
in handy for other targets in the future.
ck_pring
Samy Al Bahra 11 years ago
parent 79fb6176bb
commit 54ba247c18

@ -9,6 +9,9 @@ PREFIX=@PREFIX@
LIBRARY=@LIBRARY@
HEADERS=@HEADERS@
PKGCONFIG_DATA=@LIBRARY@/pkgconfig
LDNAME=@LDNAME@
LDNAME_VERSION=@LDNAME_VERSION@
LDNAME_MAJOR=@LDNAME_MAJOR@
all: doc
$(MAKE) -C src all || exit
@ -46,10 +49,12 @@ install-headers:
install: all install-headers
$(MAKE) -C doc install
mkdir -p $(DESTDIR)/$(LIBRARY) || exit
cp src/libck.so $(DESTDIR)/$(LIBRARY)/libck.so.$(VERSION) || exit
ln -s libck.so.$(VERSION) $(DESTDIR)/$(LIBRARY)/libck.so
ln -s libck.so.$(VERSION) $(DESTDIR)/$(LIBRARY)/libck.so.$(VERSION_MAJOR)
chmod 744 $(DESTDIR)/$(LIBRARY)/libck.so* || exit
cp src/libck.so $(DESTDIR)/$(LIBRARY)/$(LDNAME_VERSION) || exit
ln -s $(LDNAME_VERSION) $(DESTDIR)/$(LIBRARY)/$(LDNAME)
ln -s $(LDNAME_VERSION) $(DESTDIR)/$(LIBRARY)/$(LDNAME_MAJOR)
chmod 744 $(DESTDIR)/$(LIBRARY)/$(LDNAME_VERSION) \
$(DESTDIR)/$(LIBRARY)/$(LDNAME) \
$(DESTDIR)/$(LIBRARY)/$(LDNAME_MAJOR)
mkdir -p $(DESTDIR)/$(PKGCONFIG_DATA) || exit
chmod 755 $(DESTDIR)/$(PKGCONFIG_DATA)
cp build/ck.pc $(DESTDIR)/$(PKGCONFIG_DATA)/ck.pc || exit
@ -61,6 +66,9 @@ install: all install-headers
uninstall:
$(MAKE) -C doc uninstall
rm -f $(DESTDIR)/$(LIBRARY)/$(LDNAME_VERSION) \
$(DESTDIR)/$(LIBRARY)/$(LDNAME) \
$(DESTDIR)/$(LIBRARY)/$(LDNAME_MAJOR)
rm -f $(DESTDIR)/$(LIBRARY)/libck.so*
rm -f $(DESTDIR)/$(LIBRARY)/libck.a
rm -f $(DESTDIR)/$(HEADERS)/ck_*.h

14
configure vendored

@ -37,6 +37,9 @@ VERSION=${VERSION:-'0.3.5'}
VERSION_MAJOR='0'
BUILD="$PWD/build/ck.build"
PREFIX=${PREFIX:-"/usr/local"}
LDNAME="libck.so"
LDNAME_VERSION="libck.so.$VERSION"
LDNAME_MAJOR="libck.so.$VERSION_MAJOR"
export CFLAGS
export PREFIX
@ -100,6 +103,9 @@ generate()
-e "s#@MM@#$MM#g" \
-e "s#@BUILD_DIR@#$P_PWD#g" \
-e "s#@SRC_DIR@#$BUILD_DIR#g" \
-e "s#@LDNAME@#$LDNAME#g" \
-e "s#@LDNAME_MAJOR@#$LDNAME_MAJOR#g" \
-e "s#@LDNAME_VERSION@#$LDNAME_VERSION#g" \
$1 > $2
}
@ -117,6 +123,9 @@ generate_stdout()
echo " CFLAGS = $CFLAGS"
echo " PTHREAD_CFLAGS = $PTHREAD_CFLAGS"
echo " LD = $LD"
echo " LDNAME = $LDNAME"
echo " LDNAME_VERSION = $LDNAME_VERSION"
echo " LDNAME_MAJOR = $LDNAME_MAJOR"
echo " LDFLAGS = $LDFLAGS"
echo " GZIP = $GZIP"
echo " CORES = $CORES"
@ -524,10 +533,13 @@ elif test "$COMPILER" = "gcc" || test "$COMPILER" = "clang" || test "$COMPILER"
LD=$CC
if test "$SYSTEM" = "darwin"; then
CC_WL_OPT="-install_name"
LDNAME="libck.dylib"
LDNAME_VERSION="libck.$VERSION.dylib"
LDNAME_MAJOR="libck.$VERSION_MAJOR.dylib"
else
CC_WL_OPT="-soname"
fi
LDFLAGS="-shared -fPIC -Wl,$CC_WL_OPT,libck.so.$VERSION_MAJOR $LDFLAGS"
LDFLAGS="-shared -fPIC -Wl,$CC_WL_OPT,$LDNAME_MAJOR $LDFLAGS"
CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses $CFLAGS"
PTHREAD_CFLAGS="-pthread"
if test "$COMPILER" = "mingw64"; then

Loading…
Cancel
Save