Index: Makefile =================================================================== --- Makefile +++ Makefile @@ -145,8 +145,8 @@ 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 \ + checkdpadd checkworld clean cleandepend cleandir cleankernel \ + cleanworld cleanuniverse \ delete-old delete-old-dirs delete-old-files delete-old-libs \ depend distribute distributekernel distributekernel.debug \ distributeworld distrib-dirs distribution doxygen \ Index: Makefile.inc1 =================================================================== --- Makefile.inc1 +++ Makefile.inc1 @@ -3392,18 +3392,20 @@ # .if make(cleanworld) BW_CANONICALOBJDIR:=${OBJTOP}/ +.elif make(cleankernel) +BW_CANONICALOBJDIR:=${KRNLOBJDIR}/${KERNCONF}/ .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 +cleanworld cleanuniverse cleankernel: .PHONY .if !empty(BW_CANONICALOBJDIR) && exists(${BW_CANONICALOBJDIR}) && \ ${.CURDIR:tA} != ${BW_CANONICALOBJDIR:tA} - -rm -rf ${BW_CANONICALOBJDIR}* + -rm -rf ${BW_CANONICALOBJDIR} -chflags -R 0 ${BW_CANONICALOBJDIR} - rm -rf ${BW_CANONICALOBJDIR}* + rm -rf ${BW_CANONICALOBJDIR} .endif .if make(cleanworld) && ${MK_AUTO_OBJ} == "no" && \ (empty(BW_CANONICALOBJDIR) || ${.CURDIR:tA} == ${BW_CANONICALOBJDIR:tA})