diff --git a/share/mk/bsd.obj.mk b/share/mk/bsd.obj.mk index 89e56ab88eef..920d2005a616 100644 --- a/share/mk/bsd.obj.mk +++ b/share/mk/bsd.obj.mk @@ -97,11 +97,11 @@ whereobj: .endif cleanobj: - @if [ "${CANONICALOBJDIR}" != "${.CURDIR}" -a -d ${CANONICALOBJDIR}/ ]; then \ - rm -rf ${CANONICALOBJDIR}; \ - else \ - cd ${.CURDIR} && ${MAKE} clean cleandepend; \ - fi +.if ${CANONICALOBJDIR} != ${.CURDIR} && exists(${CANONICALOBJDIR}/) + @rm -rf ${CANONICALOBJDIR} +.else + @cd ${.CURDIR} && ${MAKE} clean cleandepend +.endif @if [ -h ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi .if !target(clean)