Skip to content

Commit

Permalink
Add a 'make cleanuniverse'.
Browse files Browse the repository at this point in the history
This will remove all build files for the source directory
when MK_UNIFIED_OBJDIR is enabled.

Sponsored by:	Dell EMC Isilon
  • Loading branch information
bdrewery committed Nov 1, 2017
1 parent dfa0998 commit c10062b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
check check-old check-old-dirs check-old-files check-old-libs \
checkdpadd checkworld clean cleandepend cleandir cleanworld \
cleanuniverse \
delete-old delete-old-dirs delete-old-files delete-old-libs \
depend distribute distributekernel distributekernel.debug \
distributeworld distrib-dirs distribution doxygen \
Expand Down
19 changes: 13 additions & 6 deletions Makefile.inc1
Original file line number Diff line number Diff line change
Expand Up @@ -2751,14 +2751,21 @@ builddtb: .PHONY
# 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.
#
BW_CANONICALOBJDIR:=${OBJTOP}
cleanworld: .PHONY
.if exists(${BW_CANONICALOBJDIR}/)
-rm -rf ${BW_CANONICALOBJDIR}/*
.if make(cleanworld)
BW_CANONICALOBJDIR:=${OBJTOP}/
.elif make(cleanuniverse)
BW_CANONICALOBJDIR:=${OBJROOT}
.if ${MK_UNIFIED_OBJDIR} == "no"
.error ${.TARGETS} only supported with WITH_UNIFIED_OBJDIR enabled.
.endif
.endif
cleanworld cleanuniverse: .PHONY
.if !empty(BW_CANONICALOBJDIR) && exists(${BW_CANONICALOBJDIR})
-rm -rf ${BW_CANONICALOBJDIR}*
-chflags -R 0 ${BW_CANONICALOBJDIR}
rm -rf ${BW_CANONICALOBJDIR}/*
rm -rf ${BW_CANONICALOBJDIR}*
.endif
.if ${MK_AUTO_OBJ} == "no"
.if make(cleanworld) && ${MK_AUTO_OBJ} == "no"
.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
# To be safe in this case, fall back to a 'make cleandir'
${_+_}@cd ${.CURDIR}; ${MAKE} cleandir
Expand Down
11 changes: 9 additions & 2 deletions share/man/man7/build.7
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,15 @@ for cross builds and native builds with variable
set.
.It Cm cleanworld
Attempt to clean up targets built by a preceding
.Cm buildworld
step.
.Cm buildworld ,
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
Distribute everything compiled by a preceding
.Cm buildworld
Expand Down

0 comments on commit c10062b

Please sign in to comment.