svn commit: r301880 - head/share/mk

Bryan Drewery bdrewery at FreeBSD.org
Tue Jun 14 16:19:45 UTC 2016


Author: bdrewery
Date: Tue Jun 14 16:19:44 2016
New Revision: 301880
URL: https://svnweb.freebsd.org/changeset/base/301880

Log:
  WITH_META_MODE+WITH_DEBUG_FILES: Fix library symlinks causing bogus rebuilds.
  
  A simplified example of the library targets with WITH_DEBUG_FILES is:
  
    libgeom.so.5: libgeom.so.5.full
       cp libgeom.so.5.full libgeom.so.5
  
    libgeom.so.5.full:
       ln -s libgeom.so.5 libgeom.so
       cc -o libgeom.so.5.full *.o
  
  Before, or without, WITH_DEBUG_FILES it is:
  
    libgeom.so.5:
       ln -s libgeom.so.5 libgeom.so
       cc -o libgeom.so.5 *.o
  
  The problem is that bmake considers the link source for the libgeom.so
  link in the libgeom.so.5.full target as being a dependency for
  libgeom.so.5.full.  That resolves to libgeom.so.5.  Thus a cyclic
  dependency is created.  The result of this is that if libgeom.so.5 is
  created with a newer timestamp than libgeom.so.5.full, then
  libgeom.so.5.full will be rebuilt on the next build.  This causes a
  chain reaction of everything in the build relinking, or hitting the
  problem itself.
  
  Moving the link creation to the target that actually creates
  libgeom.so.5 fixes the problem.  The simplest fix here is to just
  duplicate the logic.
  
  Submitted by:	sjg
  Approved by:	re (implicit)

Modified:
  head/share/mk/bsd.lib.mk

Modified: head/share/mk/bsd.lib.mk
==============================================================================
--- head/share/mk/bsd.lib.mk	Tue Jun 14 14:03:28 2016	(r301879)
+++ head/share/mk/bsd.lib.mk	Tue Jun 14 16:19:44 2016	(r301880)
@@ -244,7 +244,7 @@ CLEANFILES+=	${SHLIB_LINK}
 ${SHLIB_NAME_FULL}: ${SOBJS}
 	@${ECHO} building shared library ${SHLIB_NAME}
 	@rm -f ${SHLIB_NAME} ${SHLIB_LINK}
-.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld)
+.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) && ${MK_DEBUG_FILES} == "no"
 	@${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK}
 .endif
 	${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
@@ -259,6 +259,9 @@ CLEANFILES+=	${SHLIB_NAME_FULL} ${SHLIB_
 ${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug
 	${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \
 	    ${SHLIB_NAME_FULL} ${.TARGET}
+.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld)
+	@${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK}
+.endif
 
 ${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL}
 	${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET}


More information about the svn-src-all mailing list