From 5a4121a80041eb194857d9ca77e77bc5298398c1 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Tue, 31 Oct 2017 19:02:14 +0000 Subject: [PATCH] kernel-toolchain: Skip world _obj and _cleanobj phases. There's no good reason to treewalk the entire tree removing old OBJDIRS and creating new ones when 'includes', 'libraries', and 'everything' are all skipped. The only shared directory in the existing toolchain target and world is build-tools. So handle cleaning in it directly if needed only for the directories it wants to build. The extra _obj/_cleanobj walks came in the initial kernel-toolchain addition in r128189. MFC after: 2 weeks Sponsored by: Dell EMC Isilon --- Makefile.inc1 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 53bff0771b20..17163a22fbbd 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -996,7 +996,7 @@ buildenv: .PHONY TOOLCHAIN_TGTS= ${WMAKE_TGTS:Neverything:Nbuild${libcompat}} toolchain: ${TOOLCHAIN_TGTS} .PHONY -kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} .PHONY +kernel-toolchain: ${TOOLCHAIN_TGTS:N_obj:N_cleanobj:N_includes:N_libraries} .PHONY # # installcheck @@ -1974,6 +1974,12 @@ _rescue=rescue/rescue _tcsh=bin/csh .endif +# kernel-toolchain skips _cleanobj, so handle cleaning up previous +# build-tools directories if needed. +.if !defined(NO_CLEAN) && make(kernel-toolchain) +_bt_clean= ${CLEANDIR} +.endif + .for _tool in \ ${_tcsh} \ bin/sh \ @@ -1989,8 +1995,9 @@ _tcsh=bin/csh usr.bin/vi/catalog \ ${_gcc_tools} build-tools_${_tool}: .PHONY - ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ + ${_+_}@${ECHODIR} "===> ${_tool} (${_bt_clean:D${_bt_clean},}obj,build-tools)"; \ cd ${.CURDIR}/${_tool}; \ + if [ -n "${_bt_clean}" ]; then ${MAKE} DIRPRFX=${_tool}/ ${_bt_clean}; fi; \ if [ -z "${NO_OBJ}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ ${MAKE} DIRPRFX=${_tool}/ build-tools build-tools: build-tools_${_tool}