Add a 'make cleanuniverse'.

This will remove all build files for the source directory
when MK_UNIFIED_OBJDIR is enabled.

Sponsored by:	Dell EMC Isilon
This commit is contained in:
Bryan Drewery 2017-11-01 21:22:10 +00:00
parent dfa099890c
commit c10062b9bf
3 changed files with 24 additions and 9 deletions

View File

@ -122,6 +122,7 @@
TGTS= all all-man buildenv buildenvvars buildkernel buildworld \ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
check check-old check-old-dirs check-old-files check-old-libs \ check check-old check-old-dirs check-old-files check-old-libs \
checkdpadd checkworld clean cleandepend cleandir cleanworld \ checkdpadd checkworld clean cleandepend cleandir cleanworld \
cleanuniverse \
delete-old delete-old-dirs delete-old-files delete-old-libs \ delete-old delete-old-dirs delete-old-files delete-old-libs \
depend distribute distributekernel distributekernel.debug \ depend distribute distributekernel distributekernel.debug \
distributeworld distrib-dirs distribution doxygen \ distributeworld distrib-dirs distribution doxygen \

View File

@ -2751,14 +2751,21 @@ builddtb: .PHONY
# in this makefile. We don't do a cleandir walk if MK_AUTO_OBJ is yes # in this makefile. We don't do a cleandir walk if MK_AUTO_OBJ is yes
# since it is not possible for files to land in the wrong place. # since it is not possible for files to land in the wrong place.
# #
BW_CANONICALOBJDIR:=${OBJTOP} .if make(cleanworld)
cleanworld: .PHONY BW_CANONICALOBJDIR:=${OBJTOP}/
.if exists(${BW_CANONICALOBJDIR}/) .elif make(cleanuniverse)
-rm -rf ${BW_CANONICALOBJDIR}/* BW_CANONICALOBJDIR:=${OBJROOT}
-chflags -R 0 ${BW_CANONICALOBJDIR} .if ${MK_UNIFIED_OBJDIR} == "no"
rm -rf ${BW_CANONICALOBJDIR}/* .error ${.TARGETS} only supported with WITH_UNIFIED_OBJDIR enabled.
.endif .endif
.if ${MK_AUTO_OBJ} == "no" .endif
cleanworld cleanuniverse: .PHONY
.if !empty(BW_CANONICALOBJDIR) && exists(${BW_CANONICALOBJDIR})
-rm -rf ${BW_CANONICALOBJDIR}*
-chflags -R 0 ${BW_CANONICALOBJDIR}
rm -rf ${BW_CANONICALOBJDIR}*
.endif
.if make(cleanworld) && ${MK_AUTO_OBJ} == "no"
.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} .if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
# To be safe in this case, fall back to a 'make cleandir' # To be safe in this case, fall back to a 'make cleandir'
${_+_}@cd ${.CURDIR}; ${MAKE} cleandir ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir

View File

@ -207,8 +207,15 @@ for cross builds and native builds with variable
set. set.
.It Cm cleanworld .It Cm cleanworld
Attempt to clean up targets built by a preceding Attempt to clean up targets built by a preceding
.Cm buildworld .Cm buildworld ,
step. or similar step built from this source directory.
.It Cm cleanuniverse
When
.Va WITH_UNIFIED_OBJDIR
is enabled, attempt to clean up targets built by a preceding
.Cm buildworld ,
.Cm universe ,
or similar step, for any architecture built from this source directory.
.It Cm distributeworld .It Cm distributeworld
Distribute everything compiled by a preceding Distribute everything compiled by a preceding
.Cm buildworld .Cm buildworld