Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jul 2023 21:56:23 GMT
From:      "Simon J. Gerraty" <sjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: da6620e49543 - main - mk: fix unnecessary library relinking with incremental builds
Message-ID:  <202307272156.36RLuNVp053223@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=da6620e49543a9e6e11aac7b29f370c8b31ee7e0

commit da6620e49543a9e6e11aac7b29f370c8b31ee7e0
Author:     Val Packett <val@packett.cool>
AuthorDate: 2023-07-27 21:55:16 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2023-07-27 21:55:16 +0000

    mk: fix unnecessary library relinking with incremental builds
    
    Initial libs such as csu are always built (.PHONY), and their
    installation to WORLDTMP was causing all the subsequent libraries to
    be considered out-of-date even when in reality they were not. Use
    install -C more consistently everywhere to avoid unnecessarily
    updating the mtimes in WORLDTMP, fixing this problem.
    
    This cut down my no-change buildworld time from 30 to 15 seconds.
    
    Fixes: https://lists.freebsd.org/pipermail/freebsd-current/2016-May/061481.html
    TODO.1
    
    Reviewed by: sjg
    Sponsored by: https://www.patreon.com/valpackett
    Differential Revision:  https://reviews.freebsd.org/D39980
---
 share/mk/bsd.files.mk | 2 +-
 share/mk/bsd.lib.mk   | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk
index f611694fa3b4..4c3b9f248f2d 100644
--- a/share/mk/bsd.files.mk
+++ b/share/mk/bsd.files.mk
@@ -116,7 +116,7 @@ stage_as.${${_${group}DIR_${file}}:C,[/*],_,g}: ${file}
 
 installfiles-${group}: _${group}INS_${file}
 _${group}INS_${file}: ${file} installdirs-${_${group}DIR_${file}}
-	${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \
+	${INSTALL} -C ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \
 	    -g ${${group}GRP_${file}} -m ${${group}MODE_${file}} \
 	    ${.ALLSRC:Ninstalldirs-*} ${${group}PREFIX_${file}}/${${group}NAME_${file}}
 .endfor # file in ${${group}}
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 4e653a7bcb20..6750e683da0e 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -444,6 +444,7 @@ _EXTRADEPEND:
 
 .if !target(install)
 
+INSTALLFLAGS+= -C
 .if defined(PRECIOUSLIB)
 .if !defined(NO_FSCHG)
 SHLINSTALLFLAGS+= -fschg
@@ -494,10 +495,10 @@ realinstall: _libinstall installpcfiles
 .ORDER: beforeinstall _libinstall
 _libinstall:
 .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
-	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
 	    ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a ${DESTDIR}${_LIBDIR}/
 .if ${MK_PROFILE} != "no"
-	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
 	    ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}/
 .endif
 .endif
@@ -515,7 +516,7 @@ _libinstall:
 .endif
 .if defined(SHLIB_LINK)
 .if commands(${SHLIB_LINK:R}.ld)
-	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -S -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
 	    ${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \
 	    ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
 .for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307272156.36RLuNVp053223>