Module Name: src Committed By: riastradh Date: Fri Jun 28 20:45:26 UTC 2024
Modified Files: src/share/mk: bsd.README bsd.lib.mk Log Message: bsd.lib.mk: New variable VERSION_MAP. This updates LDFLAGS with the right -Wl,--version-script=... argument as well as DPADD so that changing the version script causes the library to be rebuilt. Name chosen to match FreeBSD. PR lib/58376 To generate a diff of this commit: cvs rdiff -u -r1.447 -r1.448 src/share/mk/bsd.README cvs rdiff -u -r1.405 -r1.406 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.README diff -u src/share/mk/bsd.README:1.447 src/share/mk/bsd.README:1.448 --- src/share/mk/bsd.README:1.447 Fri Apr 5 01:16:00 2024 +++ src/share/mk/bsd.README Fri Jun 28 20:45:26 2024 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.README,v 1.447 2024/04/05 01:16:00 christos Exp $ +# $NetBSD: bsd.README,v 1.448 2024/06/28 20:45:26 riastradh Exp $ # @(#)bsd.README 8.2 (Berkeley) 4/2/94 This is the README file for the make "include" files for the NetBSD @@ -1013,6 +1013,13 @@ LIB_EXPSYM File listing all symbols expe During development, you can update the expected symbols from the actual ones with `make update-symbols'. +VERSION_MAP Path to an ld version script to use when linking the + library. If a relative path, interpreted relative to + the object directory; use ${.CURDIR}/foo.map if foo.map + is in the source directory. Interpretation of relative + path may be changed later to search .PATH like target + prerequisites. + The include file <bsd.lib.mk> includes the file named "../Makefile.inc" if it exists, as well as the include file <bsd.man.mk>. Index: src/share/mk/bsd.lib.mk diff -u src/share/mk/bsd.lib.mk:1.405 src/share/mk/bsd.lib.mk:1.406 --- src/share/mk/bsd.lib.mk:1.405 Wed May 8 20:38:55 2024 +++ src/share/mk/bsd.lib.mk Fri Jun 28 20:45:26 2024 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.lib.mk,v 1.405 2024/05/08 20:38:55 riastradh Exp $ +# $NetBSD: bsd.lib.mk,v 1.406 2024/06/28 20:45:26 riastradh Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 .include <bsd.init.mk> @@ -612,6 +612,41 @@ LIBDPLIBS+= stdc++ ${.CURDIR}/../../ LIBCC:= ${CC} .endif +# VERSION_MAP +# +# Path to an ld version script to use when linking the library. +# If a relative path, interpreted relative to the object +# directory; use ${.CURDIR}/foo.map if foo.map is in the source +# directory. Interpretation of relative path may be changed +# later to search .PATH like target prerequisites. +# +# Implemented by adding -Wl,--version-script=${VERSION_MAP} to +# LDFLAGS. +# +.if !empty(VERSION_MAP) +# It is tempting to use the make :P modifier here so that you can just +# write +# +# VERSION_MAP= foo.map +# +# instead of +# +# VERSION_MAP= ${.CURDIR}/foo.map +# +# but it appears that :P works _only_ with literal names, not with +# expansions, so while you could write +# +# VERSION_MAP= ${foo.map:P} +# +# in the makefile, we can't set +# +# LDFLAGS+= -Wl,--version-script=${${VERSION_MAP}:P} +# +# here. +DPADD+= ${VERSION_MAP} +LDFLAGS+= -Wl,--version-script=${VERSION_MAP} +.endif + _LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}} _LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}}