Module Name: src
Committed By: christos
Date: Tue Jun 5 00:56:51 UTC 2018
Modified Files:
src/share/mk: bsd.lib.mk
Log Message:
Add rules for building relocatable objects to avoid having random Makefiles
use ${LD} ${LDFLAGS} -r which does not work if we specify MKRELRO since
LDFLAGS is supposed to be passed to LINK.c not LD directly (although some
of the flags work).
To generate a diff of this commit:
cvs rdiff -u -r1.372 -r1.373 src/share/mk/bsd.lib.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/share/mk/bsd.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.372 src/share/mk/bsd.lib.mk:1.373
--- src/share/mk/bsd.lib.mk:1.372 Sun May 28 23:52:43 2017
+++ src/share/mk/bsd.lib.mk Mon Jun 4 20:56:51 2018
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.lib.mk,v 1.372 2017/05/29 03:52:43 christos Exp $
+# $NetBSD: bsd.lib.mk,v 1.373 2018/06/05 00:56:51 christos Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.include <bsd.init.mk>
@@ -541,7 +541,7 @@ _INSTRANLIB=${empty(PRESERVE):?-a "${RAN
.if !target(__archivebuild)
__archivebuild: .USE
${_MKTARGET_BUILD}
- rm -f ${.TARGET}
+ @rm -f ${.TARGET}
${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
.endif
@@ -556,6 +556,21 @@ __archivesymlinkpic: .USE
${_MKTARGET_INSTALL}
${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
+.if !target(__buildstdlib)
+__buildstdlib: .USE
+ @echo building standard ${.TARGET:T:S/.o//:S/lib//} library
+ @rm -f ${.TARGET}
+ @${LINK.c} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
+.endif
+
+.if !target(__buildproflib)
+__buildproflib: .USE
+ @echo building profiled ${.TARGET:T:S/.o//:S/lib//} library
+ ${_MKTARGET_BUILD}
+ @rm -f ${.TARGET}
+ @${LINK.c} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*po} | ${TSORT}`
+.endif
+
DPSRCS+= ${_YLSRCS}
CLEANFILES+= ${_YLSRCS}