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
This commit is contained in:
Ed Maste 2020-09-08 00:44:35 +00:00
parent 1fde305191
commit 7576679986
4 changed files with 21 additions and 14 deletions

View File

@ -441,8 +441,12 @@ SUBDIR+=etc
.endif # !empty(SUBDIR_OVERRIDE) .endif # !empty(SUBDIR_OVERRIDE)
.if defined(NOCLEAN) .if defined(NOCLEAN)
.warning NOCLEAN option is deprecated. Use NO_CLEAN instead. .warning The src.conf WITHOUT_CLEAN option can now be used instead of NOCLEAN.
NO_CLEAN= ${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 .endif
.if defined(NO_CLEANDIR) .if defined(NO_CLEANDIR)
CLEANDIR= clean cleandepend CLEANDIR= clean cleandepend
@ -451,7 +455,7 @@ CLEANDIR= cleandir
.endif .endif
.if defined(WORLDFAST) .if defined(WORLDFAST)
NO_CLEAN= t MK_CLEAN:= no
NO_OBJWALK= t NO_OBJWALK= t
.endif .endif
@ -460,7 +464,7 @@ NO_OBJWALK= t
# The .meta files will also track the build command and rebuild should # The .meta files will also track the build command and rebuild should
# it change. # it change.
.if empty(.MAKE.MODE:Mnofilemon) .if empty(.MAKE.MODE:Mnofilemon)
NO_CLEAN= t MK_CLEAN:= no
.endif .endif
.endif .endif
.if defined(NO_OBJWALK) || ${MK_AUTO_OBJ} == "yes" .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 # 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 # when the ABI breaks though that we want to force rebuilding WORLDTMP
# to get updated host tools. # 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(NO_META_IGNORE_HOST) && !defined(NO_META_IGNORE_HOST_HEADERS) && \
!defined(_MKSHOWCONFIG) !defined(_MKSHOWCONFIG)
# r318736 - ino64 major ABI breakage # r318736 - ino64 major ABI breakage
@ -869,7 +873,7 @@ NO_META_IGNORE_HOST_HEADERS= 1
.export NO_META_IGNORE_HOST_HEADERS .export NO_META_IGNORE_HOST_HEADERS
.endif # defined(_meta_mode_need_rebuild) .endif # defined(_meta_mode_need_rebuild)
.endif # defined(OBJDIR_HOST_OSRELDATE) .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 # This is only used for META_MODE+filemon to track what the oldest
# __FreeBSD_version is in WORLDTMP. This purposely does NOT have # __FreeBSD_version is in WORLDTMP. This purposely does NOT have
# a make dependency on /usr/include/osreldate.h as the file should # a make dependency on /usr/include/osreldate.h as the file should
@ -1013,7 +1017,7 @@ _worldtmp: .PHONY
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Rebuilding the temporary build tree" @echo ">>> Rebuilding the temporary build tree"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
.if !defined(NO_CLEAN) .if ${MK_CLEAN} == "yes"
rm -rf ${WORLDTMP} rm -rf ${WORLDTMP}
.else .else
# Note: for delete-old we need to set $PATH to also include the host $PATH # 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" .if ${USING_SYSTEM_LINKER} == "yes"
@rm -f ${WORLDTMP}/usr/bin/ld ${WORLDTMP}/usr/bin/ld.lld @rm -f ${WORLDTMP}/usr/bin/ld ${WORLDTMP}/usr/bin/ld.lld
.endif # ${USING_SYSTEM_LINKER} == "yes" .endif # ${USING_SYSTEM_LINKER} == "yes"
.endif # !defined(NO_CLEAN) .endif # ${MK_CLEAN} == "yes"
@mkdir -p ${WORLDTMP} @mkdir -p ${WORLDTMP}
@touch ${WORLDTMP}/${.TARGET} @touch ${WORLDTMP}/${.TARGET}
# We can't use mtree to create the worldtmp directories since it may not be # 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 ${WORLDTMP_MTREE} -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
.endfor .endfor
_cleanobj: _cleanobj:
.if !defined(NO_CLEAN) .if ${MK_CLEAN} == "yes"
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> stage 2.1: cleaning up the object tree" @echo ">>> stage 2.1: cleaning up the object tree"
@ -1090,7 +1094,7 @@ _cleanobj:
.endif .endif
.else .else
${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t _cleanobj_fast_depend_hack ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t _cleanobj_fast_depend_hack
.endif # !defined(NO_CLEAN) .endif # ${MK_CLEAN} == "yes"
_obj: _obj:
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@ -1672,7 +1676,7 @@ buildkernel: .MAKE .PHONY
-I '${KERNCONFDIR}' -I '${KRNLCONFDIR}' \ -I '${KERNCONFDIR}' -I '${KRNLCONFDIR}' \
'${KERNCONFDIR}/${_kernel}' '${KERNCONFDIR}/${_kernel}'
.endif .endif
.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) .if ${MK_CLEAN} == "yes" && !defined(NO_KERNELCLEAN)
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> stage 2.1: cleaning up the object tree" @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 # kernel-toolchain skips _cleanobj, so handle cleaning up previous
# build-tools directories if needed. # build-tools directories if needed.
.if !defined(NO_CLEAN) && make(kernel-toolchain) .if ${MK_CLEAN} == "yes" && make(kernel-toolchain)
_bt_clean= ${CLEANDIR} _bt_clean= ${CLEANDIR}
.endif .endif

View File

@ -62,7 +62,7 @@ build${libcompat}: .PHONY
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> stage 4.3: building lib${libcompat} shim libraries" @echo ">>> stage 4.3: building lib${libcompat} shim libraries"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
.if !defined(NO_CLEAN) .if ${MK_CLEAN} == "yes"
rm -rf ${LIBCOMPATTMP} rm -rf ${LIBCOMPATTMP}
.else .else
${_+_}@if [ -e "${LIBCOMPATTMP}" ]; then \ ${_+_}@if [ -e "${LIBCOMPATTMP}" ]; then \
@ -71,7 +71,7 @@ build${libcompat}: .PHONY
DESTDIR=${LIBCOMPATTMP} \ DESTDIR=${LIBCOMPATTMP} \
delete-old delete-old-libs >/dev/null; \ delete-old delete-old-libs >/dev/null; \
fi fi
.endif # !defined(NO_CLEAN) .endif # MK_CLEAN == "yes"
mkdir -p ${LIBCOMPATTMP}/usr/include mkdir -p ${LIBCOMPATTMP}/usr/include
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \

View File

@ -80,6 +80,7 @@ __DEFAULT_YES_OPTIONS = \
CLANG \ CLANG \
CLANG_BOOTSTRAP \ CLANG_BOOTSTRAP \
CLANG_IS_CC \ CLANG_IS_CC \
CLEAN \
CPP \ CPP \
CROSS_COMPILER \ CROSS_COMPILER \
CRYPT \ CRYPT \

View File

@ -0,0 +1,2 @@
.\" $FreeBSD$
Do not clean before building world and/or kernel.