tech-toolchain archive

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

re: make vs MKDEBUG vs parallel builds



this implements the split-rules for MKDEBUG case.


.mrg.


Index: bsd.lib.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.lib.mk,v
retrieving revision 1.357
diff -p -u -r1.357 bsd.lib.mk
--- bsd.lib.mk	2 Jun 2015 23:00:25 -0000	1.357
+++ bsd.lib.mk	3 Jun 2015 05:56:28 -0000
@@ -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}


Home | Main Index | Thread Index | Old Index