Author: bdrewery
Date: Sun Nov  5 00:12:12 2017
New Revision: 325418
URL: https://svnweb.freebsd.org/changeset/base/325418

Log:
  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

Modified:
  head/share/mk/bsd.dep.mk
  head/share/mk/bsd.init.mk
  head/share/mk/bsd.obj.mk

Modified: head/share/mk/bsd.dep.mk
==============================================================================
--- head/share/mk/bsd.dep.mk    Sun Nov  5 00:12:09 2017        (r325417)
+++ head/share/mk/bsd.dep.mk    Sun Nov  5 00:12:12 2017        (r325418)
@@ -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}

Modified: head/share/mk/bsd.init.mk
==============================================================================
--- head/share/mk/bsd.init.mk   Sun Nov  5 00:12:09 2017        (r325417)
+++ head/share/mk/bsd.init.mk   Sun Nov  5 00:12:12 2017        (r325418)
@@ -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

Modified: head/share/mk/bsd.obj.mk
==============================================================================
--- head/share/mk/bsd.obj.mk    Sun Nov  5 00:12:09 2017        (r325417)
+++ head/share/mk/bsd.obj.mk    Sun Nov  5 00:12:12 2017        (r325418)
@@ -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>
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to