Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk fix MKDEBUG vs parallel builds. split the creation...



details:   https://anonhg.NetBSD.org/src/rev/69b477685c07
branches:  trunk
changeset: 808836:69b477685c07
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Jun 04 06:01:24 2015 +0000

description:
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

diffstat:

 share/mk/bsd.lib.mk |  36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diffs (71 lines):

diff -r dfa774ee6949 -r 69b477685c07 share/mk/bsd.lib.mk
--- a/share/mk/bsd.lib.mk       Thu Jun 04 05:58:17 2015 +0000
+++ b/share/mk/bsd.lib.mk       Thu Jun 04 06:01:24 2015 +0000
@@ -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.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 @@
 _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 @@
 #  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 @@
        ${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}



Home | Main Index | Thread Index | Old Index