git: 9867b4af50c6 - main - Makefile.inc1: show time for `make installworld'

From: Wolfram Schneider <wosch_at_FreeBSD.org>
Date: Mon, 02 Sep 2024 09:56:27 UTC
The branch main has been updated by wosch:

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

commit 9867b4af50c627586c68b26ddc5a7344286eefaf
Author:     Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2024-09-02 09:55:10 +0000
Commit:     Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2024-09-02 09:55:10 +0000

    Makefile.inc1: show time for `make installworld'
    
    For years we display the time in seconds how long it takes to
    run `make buildworld' (see PR 224433). Now we will display the
    time for "installworld" and "installkernel" as well.
    
    e.g.:
    --------------------------------------------------------------
    >>> Installing everything completed on Sun Jul  7 16:11:37 UTC 2024
    >>> Install world completed in 110 seconds, ncpu: 2, make -j2
    --------------------------------------------------------------
    
    This is an improved version of commit e5a0202f96948a95bf1b879727e155a4f1d1da93
    
    PR: 280187
    Differential Revision: https://reviews.freebsd.org/D45912
---
 Makefile.inc1 | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 5400cb5e734a..a4e2889004b7 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1241,11 +1241,19 @@ WMAKE_TGTS+=	build${libcompat}
 .endif
 WMAKE_TGTS+=	everything
 
-# record buildworld time in seconds
+# record buildworld / install time in seconds
 .if make(buildworld)
 _BUILDWORLD_START!= date '+%s'
 .export _BUILDWORLD_START
 .endif
+.if make(reinstall) || make(restage)
+_INSTALLWORLD_START!= date '+%s'
+.export _INSTALLWORLD_START
+.endif
+.if make(*installkernel*)
+_INSTALLKERNEL_START!= date '+%s'
+.export _INSTALLKERNEL_START
+.endif
 
 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY
 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
@@ -1313,11 +1321,11 @@ kernel-toolchain: ${KERNEL_TOOLCHAIN_TGTS} .PHONY
 installcheck: _installcheck_world _installcheck_kernel .PHONY
 _installcheck_world: .PHONY
 	@echo "--------------------------------------------------------------"
-	@echo ">>> Install check world"
+	@echo ">>> Install check world started on `LC_ALL=C date`"
 	@echo "--------------------------------------------------------------"
 _installcheck_kernel: .PHONY
 	@echo "--------------------------------------------------------------"
-	@echo ">>> Install check kernel"
+	@echo ">>> Install check kernel started on `LC_ALL=C date`"
 	@echo "--------------------------------------------------------------"
 
 #
@@ -1641,6 +1649,8 @@ restage reinstall: .MAKE .PHONY
 .endfor
 	@echo "--------------------------------------------------------------"
 	@echo ">>> Installing everything completed on `LC_ALL=C date`"
+	@seconds=$$(($$(date '+%s') - ${_INSTALLWORLD_START})); \
+	  echo ">>> Install world completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
 	@echo "--------------------------------------------------------------"
 
 redistribute: .MAKE .PHONY
@@ -1873,6 +1883,9 @@ reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY
 	@echo "--------------------------------------------------------------"
 	@echo ">>> Installing kernel ${INSTALLKERNEL} completed on $$(LC_ALL=C date)"
 	@echo "--------------------------------------------------------------"
+	@seconds=$$(($$(date '+%s') - ${_INSTALLKERNEL_START})); \
+	  echo ">>> Install kernel(s) ${INSTALLKERNEL} completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
+	@echo "--------------------------------------------------------------"
 .endif
 .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
 .for _kernel in ${BUILDKERNELS:[2..-1]}
@@ -1887,6 +1900,9 @@ reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY
 	@echo ">>> Installing kernel ${_kernel} completed on $$(LC_ALL=C date)"
 	@echo "--------------------------------------------------------------"
 .endfor
+	@seconds=$$(($$(date '+%s') - ${_INSTALLKERNEL_START})); \
+	  echo ">>> Install kernel(s) ${BUILDKERNELS} completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
+	@echo "--------------------------------------------------------------"
 .endif
 
 distributekernel distributekernel.debug: .PHONY