Module Name: src Committed By: snj Date: Fri Jun 5 17:03:43 UTC 2015
Modified Files: src/share/mk [netbsd-7]: bsd.lib.mk Log Message: Pull up following revision(s) (requested by riz in ticket #825): share/mk/bsd.lib.mk: revision 1.358 via patch fix MKDEBUG vs parallel builds. split the creation of the final .so file from the main link of it, and use the main file as the input for both the .so output and the .so.debug file. for MKDEBUG builds we now: (a) create the (new) .so.full file (d) create the .so.debug file (c) create the (installable) .so file for other builds, we simply use the same rule for (a) to create (c). this stops the .so.debug rule from modifying the .so rule's target and leading to mayhem. see this thread for more details: http://mail-index.netbsd.org/tech-toolchain/2015/06/03/msg002616.html To generate a diff of this commit: cvs rdiff -u -r1.355 -r1.355.2.1 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.355 src/share/mk/bsd.lib.mk:1.355.2.1 --- src/share/mk/bsd.lib.mk:1.355 Fri Jun 13 01:17:45 2014 +++ src/share/mk/bsd.lib.mk Fri Jun 5 17:03:43 2015 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.lib.mk,v 1.355 2014/06/13 01:17:45 mrg Exp $ +# $NetBSD: bsd.lib.mk,v 1.355.2.1 2015/06/05 17:03:43 snj Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 .include <bsd.init.mk> @@ -406,6 +406,7 @@ _LIB.ln:=llib-l${LIB}.ln _LIB.so:=${_LIB}.so _LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR} _LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION} +_LIB.so.link:=${_LIB}.so.${SHLIB_FULLVERSION}.link .if ${MKDEBUG} != "no" _LIB.so.debug:=${_LIB.so.full}.debug .endif @@ -614,8 +615,25 @@ LIBCC:= ${CC} _LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}} _LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}} -${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPLIBC} \ - ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} +_MAINLIBDEPS= ${SOLIB} ${DPADD} ${DPLIBC} \ + ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} + +.if defined(_LIB.so.debug) +${_LIB.so.debug}: ${_LIB.so.link} + ${_MKTARGET_CREATE} + ( ${OBJCOPY} --only-keep-debug \ + ${_LIB.so.link} ${_LIB.so.debug} \ + ) || (rm -f ${.TARGET}; false) +${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug} + ${_MKTARGET_CREATE} + ( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ + --add-gnu-debuglink=${_LIB.so.debug} \ + ${_LIB.so.link} ${_LIB.so.full} \ + ) || (rm -f ${.TARGET}; false) +${_LIB.so.link}: ${_MAINLIBDEPS} +.else # aka no MKDEBUG +${_LIB.so.full}: ${_MAINLIBDEPS} +.endif ${_MKTARGET_BUILD} rm -f ${.TARGET} ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \ @@ -625,6 +643,8 @@ ${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPL # We don't use INSTALL_SYMLINK here because this is just # happening inside the build directory/objdir. XXX Why does # this spend so much effort on libraries that aren't live??? XXX +# XXX Also creates dead symlinks until the .full rule runs +# above and creates the main link .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \ "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp @@ -636,15 +656,6 @@ ${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPL ${OBJCOPY} -R .ident ${.TARGET} .endif -.if defined(_LIB.so.debug) -${_LIB.so.debug}: ${_LIB.so.full} - ${_MKTARGET_CREATE} - ( ${OBJCOPY} --only-keep-debug ${_LIB.so.full} ${_LIB.so.debug} \ - && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ - --add-gnu-debuglink=${_LIB.so.debug} ${_LIB.so.full} \ - ) || (rm -f ${.TARGET}; false) -.endif - .if !empty(LOBJS) # { LLIBS?= -lc ${_LIB.ln}: ${LOBJS}