Module Name: src Committed By: mrg Date: Thu Jun 4 06:01:24 UTC 2015
Modified Files: src/share/mk: bsd.lib.mk Log Message: 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.357 -r1.358 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.357 src/share/mk/bsd.lib.mk:1.358 --- src/share/mk/bsd.lib.mk:1.357 Tue Jun 2 23:00:25 2015 +++ src/share/mk/bsd.lib.mk Thu Jun 4 06:01:24 2015 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.lib.mk,v 1.357 2015/06/02 23:00:25 christos Exp $ +# $NetBSD: bsd.lib.mk,v 1.358 2015/06/04 06:01:24 mrg 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,16 +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} \ - ${_LIB.so.full}.tmp && mv -f ${_LIB.so.full}.tmp ${_LIB.so.full} \ - ) || (rm -f ${.TARGET}; false) -.endif - .if !empty(LOBJS) # { LLIBS?= -lc ${_LIB.ln}: ${LOBJS}