AUTO_OBJ: Allow 'make cleandir obj all' combinations.

The cleanobj target will not really remove the OBJDIR in this case,
it will only remove the OBJDIR if only clean targets are ran.

Sponsored by:	Dell EMC Isilon
This commit is contained in:
bdrewery 2017-11-05 00:12:12 +00:00
parent 9bd6f65470
commit 602b873130
3 changed files with 12 additions and 2 deletions

View File

@ -327,6 +327,10 @@ cleandepend:
.endif
.ORDER: cleandepend all
.ORDER: cleandepend depend
.if ${MK_AUTO_OBJ} == "yes"
.ORDER: cleanobj depend
.ORDER: cleandir depend
.endif
.if !target(checkdpadd) && (defined(DPADD) || defined(LDADD))
_LDADD_FROM_DPADD= ${DPADD:R:T:C;^lib(.*)$;-l\1;g}

View File

@ -64,7 +64,8 @@ _SKIP_BUILD= not building at level 0
${.TARGETS:M*install*} == ${.TARGETS} || \
${.TARGETS:Mclean*} == ${.TARGETS} || \
${.TARGETS:Mdestroy*} == ${.TARGETS} || \
make(obj) || make(analyze) || make(print-dir)
${.TARGETS:Mobj} == ${.TARGETS} || \
make(analyze) || make(print-dir)
# Skip building, but don't show a warning.
_SKIP_BUILD=
.endif

View File

@ -164,7 +164,8 @@ whereobj:
.endif
# Same check in bsd.progs.mk
.if ${CANONICALOBJDIR} != ${.CURDIR} && exists(${CANONICALOBJDIR}/)
.if ${CANONICALOBJDIR} != ${.CURDIR} && exists(${CANONICALOBJDIR}/) && \
(${MK_AUTO_OBJ} == "no" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} == "")
cleanobj:
-rm -rf ${CANONICALOBJDIR}
.else
@ -188,6 +189,10 @@ clean:
.endif
.endif
.ORDER: clean all
.if ${MK_AUTO_OBJ} == "yes"
.ORDER: cleanobj all
.ORDER: cleandir all
.endif
.include <bsd.subdir.mk>