summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>1997-05-04 21:30:40 +0000
committerjdp <jdp@FreeBSD.org>1997-05-04 21:30:40 +0000
commit4b4c7c227f49528bcec89652575f748dfef144fb (patch)
treee82b09338bdb999aed1f8700f1085edd138c2029 /share
parent5947fe79142cd018791716d4ef4824ea4fb14843 (diff)
downloadFreeBSD-src-4b4c7c227f49528bcec89652575f748dfef144fb.zip
FreeBSD-src-4b4c7c227f49528bcec89652575f748dfef144fb.tar.gz
Use "gcc -shared" instead of "ld -Bshareable" for building shared
libraries. Remove the now-unneeded CPLUSPLUSLIB hack. I will also remove the CPLUSPLUSLIB definitions from the Makefiles that use it, after the dust settles. Use gcc's LIBRARY_PATH environment variable to handle DESTDIR, instead of -L flags in LDDESTDIR. LIBRARY_PATH is documented in the gcc info pages. It is better than using -L flags, because it modifies the search for start-up files as well as for libraries. A new variable LDDESTDIRENV is used to contain the normally-empty LIBRARY_PATH environment setting. LDDESTDIR is no longer set in <bsd.lib.mk>. It is still honored for the time being, because a couple of userland Makefiles still (wrongly) set it. These should be fixed, and LDDESTDIR should vanish. Removed the commented-out "LDDESTDIR+=-nostdlib", because "gcc -shared" doesn't link in any standard libraries anyway. Removed the ".if defined(LDADD)" around the _EXTRADEPEND target for shared libraries. This target is always necessary now, because c++rt0.o is linked into every shared library. Don't merge this into -2.2 without first merging the support for "gcc -shared".
Diffstat (limited to 'share')
-rw-r--r--share/mk/bsd.lib.mk16
1 files changed, 5 insertions, 11 deletions
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 25e102e..31091f4 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -1,5 +1,5 @@
# from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
-# $Id: bsd.lib.mk,v 1.53 1997/04/13 06:44:23 jkh Exp $
+# $Id: bsd.lib.mk,v 1.54 1997/04/23 10:26:18 bde Exp $
#
.if exists(${.CURDIR}/../Makefile.inc)
@@ -145,20 +145,15 @@ lib${LIB}_p.a:: ${POBJS}
.endif
.if defined(DESTDIR)
-LDDESTDIR?= -L${DESTDIR}${SHLIBDIR} -L${DESTDIR}/usr/lib
-# LDDESTDIR+= -nostdlib
+LDDESTDIRENV?= LIBRARY_PATH=${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib
.endif
.if !defined(NOPIC)
-.if defined(CPLUSPLUSLIB) && !make(clean) && !make(cleandir)
-SOBJS+= ${DESTDIR}/usr/lib/c++rt0.o
-.endif
-
SOBJS+= ${OBJS:.o=.so}
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: ${SOBJS}
@${ECHO} building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
- @${LD} -Bshareable -x \
+ @${LDDESTDIRENV} ${CC} -shared -Wl,-x \
-o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
`lorder ${SOBJS} | tsort -q` ${LDDESTDIR} ${LDADD}
@@ -191,11 +186,10 @@ _EXTRADEPEND::
> $$TMP; \
mv $$TMP ${DEPENDFILE}
.endif
-.if defined(LDADD)
_EXTRADEPEND::
echo lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: \
- `ld -Bshareable -x -f ${LDDESTDIR} ${LDADD}` >> ${DEPENDFILE}
-.endif
+ `${LDDESTDIRENV} ${CC} -shared -Wl,-f ${LDDESTDIR} ${LDADD}` \
+ >> ${DEPENDFILE}
.if !target(install)
.if !target(beforeinstall)
OpenPOWER on IntegriCloud