Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 May 2014 18:25:46 +0000 (UTC)
From:      "Simon J. Gerraty" <sjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266473 - head/share/mk
Message-ID:  <201405201825.s4KIPkhh015749@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sjg
Date: Tue May 20 18:25:46 2014
New Revision: 266473
URL: http://svnweb.freebsd.org/changeset/base/266473

Log:
  Use an intermediate target to associate with _SUBDIR which is marked .MAKE
  this allows make -n to do tree walks as expected without
  doing anything else (as intended).
  Use prefix _sub. to help avoid conflict with any real target.
  
  Reviewed by:	imp

Modified:
  head/share/mk/bsd.subdir.mk

Modified: head/share/mk/bsd.subdir.mk
==============================================================================
--- head/share/mk/bsd.subdir.mk	Tue May 20 15:53:17 2014	(r266472)
+++ head/share/mk/bsd.subdir.mk	Tue May 20 18:25:46 2014	(r266473)
@@ -47,15 +47,15 @@ _SUBDIR: .USE .MAKE
 .if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
 	@${_+_}set -e; for entry in ${SUBDIR:N.WAIT}; do \
 		if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
-			${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:realinstall=install})"; \
+			${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \
 			edir=$${entry}.${MACHINE_ARCH}; \
 			cd ${.CURDIR}/$${edir}; \
 		else \
-			${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:realinstall=install})"; \
+			${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \
 			edir=$${entry}; \
 			cd ${.CURDIR}/$${edir}; \
 		fi; \
-		${MAKE} ${.TARGET:realinstall=install} \
+		${MAKE} ${.TARGET:S,realinstall,install,:S,^_sub.,,} \
 		    DIRPRFX=${DIRPRFX}$$edir/; \
 	done
 .endif
@@ -97,7 +97,8 @@ ${__target}_subdir_${__dir}: .MAKE
 .endfor
 ${__target}: ${__subdir_targets}
 .else
-${__target}: _SUBDIR
+${__target}: _sub.${__target}
+_sub.${__target}: _SUBDIR
 .endif
 .endfor
 
@@ -105,11 +106,14 @@ ${__target}: _SUBDIR
 .for __stage in build install
 ${__stage}${__target}:
 .if make(${__stage}${__target})
-${__stage}${__target}: _SUBDIR
+${__stage}${__target}: _sub.${__stage}${__target}
+_sub.${__stage}${__target}: _SUBDIR
 .endif
 .endfor
+.if !target(${__target})
 ${__target}: .MAKE
 	${_+_}set -e; cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target}
+.endif
 .endfor
 
 .if !target(install)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405201825.s4KIPkhh015749>