summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-07-19 20:45:31 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-07-19 20:45:31 +0000
commitffbfe414eda6b8ccf1c7ce4e6577af21b67eaeb8 (patch)
tree5dbe7c6428bb2503f78ec721936206759ce24b30
parentd77e4cacad27ab3d40de4c30e87148b5e867555e (diff)
Add infrastructure for specifying a "version script" for the shared library
being built. ok kettenis@ zhuk@ millert@
-rw-r--r--share/mk/bsd.lib.mk19
1 files changed, 12 insertions, 7 deletions
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index a06fce6d360..4270e7e5277 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -1,4 +1,4 @@
-# $OpenBSD: bsd.lib.mk,v 1.72 2015/05/14 02:56:01 jsg Exp $
+# $OpenBSD: bsd.lib.mk,v 1.73 2015/07/19 20:45:30 guenther Exp $
# $NetBSD: bsd.lib.mk,v 1.67 1996/01/17 20:39:26 mycroft Exp $
# @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
@@ -170,7 +170,13 @@ _LIBS+=lib${LIB}_p.a
.if !defined(NOPIC)
.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
-_LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
+FULLSHLIBNAME=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
+_LIBS+=${FULLSHLIBNAME}
+.endif
+
+.if defined(VERSION_SCRIPT)
+${FULLSHLIBNAME}: ${VERSION_SCRIPT}
+LDADD+= -Wl,--version-script=${VERSION_SCRIPT}
.endif
.endif
@@ -199,11 +205,10 @@ lib${LIB}_p.a: ${POBJS}
${RANLIB} lib${LIB}_p.a
SOBJS+= ${OBJS:.o=.so}
-lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: ${SOBJS} ${DPADD}
+${FULLSHLIBNAME}: ${SOBJS} ${DPADD}
@echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
- @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
- ${CC} -shared ${PICFLAG} \
- -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
+ @rm -f ${.TARGET}
+ ${CC} -shared ${PICFLAG} -o ${.TARGET} \
`${LORDER} ${SOBJS}|tsort -q` ${LDADD}
# all .do files...
@@ -284,7 +289,7 @@ realinstall:
.endif
.if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
${INSTALL} ${INSTALL_COPY} -S -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR}
+ ${FULLSHLIBNAME} ${DESTDIR}${LIBDIR}
.endif
.if defined(LINKS) && !empty(LINKS)
. for lnk file in ${LINKS}