From 75766799863334570acf7a65510361f470ce3b3e Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 8 Sep 2020 00:44:35 +0000 Subject: [PATCH] Add WITH_/WITHOUT_CLEAN option to replace NO_CLEAN This allows use of the standard src.conf configuration for controlling whether the tree is cleaned before build or not. The default is still to clean. Setting either NOCLEAN or NO_CLEAN will mention the new src.conf option. NOCLEAN remains a .warning, while for now NO_CLEAN is .info. Reviewed by: bdrewery (earlier version) MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22762 --- Makefile.inc1 | 28 ++++++++++++++++------------ Makefile.libcompat | 4 ++-- share/mk/src.opts.mk | 1 + tools/build/options/WITHOUT_CLEAN | 2 ++ 4 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 tools/build/options/WITHOUT_CLEAN diff --git a/Makefile.inc1 b/Makefile.inc1 index b5d7035c7295..4c4fdf601ce0 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -441,8 +441,12 @@ SUBDIR+=etc .endif # !empty(SUBDIR_OVERRIDE) .if defined(NOCLEAN) -.warning NOCLEAN option is deprecated. Use NO_CLEAN instead. -NO_CLEAN= ${NOCLEAN} +.warning The src.conf WITHOUT_CLEAN option can now be used instead of NOCLEAN. +MK_CLEAN:= no +.endif +.if defined(NO_CLEAN) +.info The src.conf WITHOUT_CLEAN option can now be used instead of NO_CLEAN. +MK_CLEAN:= no .endif .if defined(NO_CLEANDIR) CLEANDIR= clean cleandepend @@ -451,7 +455,7 @@ CLEANDIR= cleandir .endif .if defined(WORLDFAST) -NO_CLEAN= t +MK_CLEAN:= no NO_OBJWALK= t .endif @@ -460,7 +464,7 @@ NO_OBJWALK= t # The .meta files will also track the build command and rebuild should # it change. .if empty(.MAKE.MODE:Mnofilemon) -NO_CLEAN= t +MK_CLEAN:= no .endif .endif .if defined(NO_OBJWALK) || ${MK_AUTO_OBJ} == "yes" @@ -837,7 +841,7 @@ _LIBCOMPAT= SOFT # timestamps (see NO_META_IGNORE_HOST in sys.mk). There are known times # when the ABI breaks though that we want to force rebuilding WORLDTMP # to get updated host tools. -.if ${MK_META_MODE} == "yes" && defined(NO_CLEAN) && \ +.if ${MK_META_MODE} == "yes" && ${MK_CLEAN} == "no" && \ !defined(NO_META_IGNORE_HOST) && !defined(NO_META_IGNORE_HOST_HEADERS) && \ !defined(_MKSHOWCONFIG) # r318736 - ino64 major ABI breakage @@ -869,7 +873,7 @@ NO_META_IGNORE_HOST_HEADERS= 1 .export NO_META_IGNORE_HOST_HEADERS .endif # defined(_meta_mode_need_rebuild) .endif # defined(OBJDIR_HOST_OSRELDATE) -.endif # ${MK_META_MODE} == "yes" && defined(NO_CLEAN) ... +.endif # ${MK_META_MODE} == "yes" && ${MK_CLEAN} == "no" ... # This is only used for META_MODE+filemon to track what the oldest # __FreeBSD_version is in WORLDTMP. This purposely does NOT have # a make dependency on /usr/include/osreldate.h as the file should @@ -1013,7 +1017,7 @@ _worldtmp: .PHONY @echo "--------------------------------------------------------------" @echo ">>> Rebuilding the temporary build tree" @echo "--------------------------------------------------------------" -.if !defined(NO_CLEAN) +.if ${MK_CLEAN} == "yes" rm -rf ${WORLDTMP} .else # Note: for delete-old we need to set $PATH to also include the host $PATH @@ -1038,7 +1042,7 @@ _worldtmp: .PHONY .if ${USING_SYSTEM_LINKER} == "yes" @rm -f ${WORLDTMP}/usr/bin/ld ${WORLDTMP}/usr/bin/ld.lld .endif # ${USING_SYSTEM_LINKER} == "yes" -.endif # !defined(NO_CLEAN) +.endif # ${MK_CLEAN} == "yes" @mkdir -p ${WORLDTMP} @touch ${WORLDTMP}/${.TARGET} # We can't use mtree to create the worldtmp directories since it may not be @@ -1077,7 +1081,7 @@ _bootstrap-tools: ${WORLDTMP_MTREE} -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null .endfor _cleanobj: -.if !defined(NO_CLEAN) +.if ${MK_CLEAN} == "yes" @echo @echo "--------------------------------------------------------------" @echo ">>> stage 2.1: cleaning up the object tree" @@ -1090,7 +1094,7 @@ _cleanobj: .endif .else ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t _cleanobj_fast_depend_hack -.endif # !defined(NO_CLEAN) +.endif # ${MK_CLEAN} == "yes" _obj: @echo @echo "--------------------------------------------------------------" @@ -1672,7 +1676,7 @@ buildkernel: .MAKE .PHONY -I '${KERNCONFDIR}' -I '${KRNLCONFDIR}' \ '${KERNCONFDIR}/${_kernel}' .endif -.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) +.if ${MK_CLEAN} == "yes" && !defined(NO_KERNELCLEAN) @echo @echo "--------------------------------------------------------------" @echo ">>> stage 2.1: cleaning up the object tree" @@ -2478,7 +2482,7 @@ _jevents=lib/libpmc/pmu-events # kernel-toolchain skips _cleanobj, so handle cleaning up previous # build-tools directories if needed. -.if !defined(NO_CLEAN) && make(kernel-toolchain) +.if ${MK_CLEAN} == "yes" && make(kernel-toolchain) _bt_clean= ${CLEANDIR} .endif diff --git a/Makefile.libcompat b/Makefile.libcompat index ad67fd114b34..08630e9909b2 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -62,7 +62,7 @@ build${libcompat}: .PHONY @echo "--------------------------------------------------------------" @echo ">>> stage 4.3: building lib${libcompat} shim libraries" @echo "--------------------------------------------------------------" -.if !defined(NO_CLEAN) +.if ${MK_CLEAN} == "yes" rm -rf ${LIBCOMPATTMP} .else ${_+_}@if [ -e "${LIBCOMPATTMP}" ]; then \ @@ -71,7 +71,7 @@ build${libcompat}: .PHONY DESTDIR=${LIBCOMPATTMP} \ delete-old delete-old-libs >/dev/null; \ fi -.endif # !defined(NO_CLEAN) +.endif # MK_CLEAN == "yes" mkdir -p ${LIBCOMPATTMP}/usr/include ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 619bfc3c9c58..2f8fb61d2091 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -80,6 +80,7 @@ __DEFAULT_YES_OPTIONS = \ CLANG \ CLANG_BOOTSTRAP \ CLANG_IS_CC \ + CLEAN \ CPP \ CROSS_COMPILER \ CRYPT \ diff --git a/tools/build/options/WITHOUT_CLEAN b/tools/build/options/WITHOUT_CLEAN new file mode 100644 index 000000000000..b55caa4b4bfd --- /dev/null +++ b/tools/build/options/WITHOUT_CLEAN @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Do not clean before building world and/or kernel.