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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365439
4 changed files with 21 additions and 14 deletions

View File

@ -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

View File

@ -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 \

View File

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

View File

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