Add MAKEDIRPREFIX shell macro to <bsd.own.mk>.

Usage:  ${MAKEDIRTARGET} dir target [params]
		Runs "cd $${dir} && ${MAKE} [params] $${target}",
		displaying a "pretty" message whilst doing so.

Use MAKEDIRPREFIX to implement the __recurse .USE macro in <bsd.subdir.mk>
This commit is contained in:
lukem 2004-04-13 12:25:03 +00:00
parent ef66f543d0
commit c6ab7e7128
3 changed files with 32 additions and 15 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.README,v 1.149 2004/03/18 03:26:55 jmc Exp $
# $NetBSD: bsd.README,v 1.150 2004/04/13 12:25:03 lukem Exp $
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
This is the README file for the new make "include" files for the BSD
@ -429,6 +429,11 @@ COPY The flag passed to the install program to cause the binary
can either be installed with copies, or with moves using
a single knob. [-c]
MAKEDIRTARGET dir target [params]
Runs "cd $${dir} && ${MAKE} [params] $${target}",
displaying a "pretty" message whilst doing so.
Additionally, the following variables may be set by <bsd.own.mk> or in a
make configuration file to modify the behaviour of the system build
process (default values are in brackets along with comments, if set by

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.own.mk,v 1.413 2004/03/08 06:30:33 jmc Exp $
# $NetBSD: bsd.own.mk,v 1.414 2004/04/13 12:25:03 lukem Exp $
.if !defined(_BSD_OWN_MK_)
_BSD_OWN_MK_=1
@ -678,6 +678,29 @@ X11USRLIBDIR?= ${X11ROOTDIR}/lib
X11DRI?= no
#
# MAKEDIRTARGET dir target [extra make(1) params]
# run "cd $${dir} && ${MAKE} [params] $${target}", with a pretty message
#
MAKEDIRTARGET=\
@_makedirtarget() { \
dir="$$1"; shift; \
target="$$1"; shift; \
case "$${dir}" in \
/*) this="$${dir}/"; \
real="$${dir}" ;; \
.) this="${_THISDIR_}"; \
real="${.CURDIR}" ;; \
*) this="${_THISDIR_}$${dir}/"; \
real="${.CURDIR}/$${dir}" ;; \
esac; \
show=$${this:-.}; \
echo "$${target} ===> $${show%/}$${1:+ (with: $$@)}"; \
cd "$${real}" \
&& ${MAKE} _THISDIR_="$${this}" "$$@" $${target}; \
}; \
_makedirtarget
#
# MAKEVERBOSE support. Levels are:
# 0 No messages

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.subdir.mk,v 1.47 2004/01/29 01:48:45 lukem Exp $
# $NetBSD: bsd.subdir.mk,v 1.48 2004/04/13 12:25:03 lukem Exp $
# @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93
.include <bsd.init.mk>
@ -12,18 +12,7 @@ __REALSUBDIR+=${dir}
.endfor
__recurse: .USE
@targ=${.TARGET:C/-.*$//};dir=${.TARGET:C/^[^-]*-//}; \
case "$$dir" in /*) \
echo "$$targ ===> $$dir"; \
cd "$$dir"; \
${MAKE} "_THISDIR_=$$dir/" $$targ; \
;; \
*) \
echo "$$targ ===> ${_THISDIR_}$$dir"; \
cd "${.CURDIR}/$$dir"; \
${MAKE} "_THISDIR_=${_THISDIR_}$$dir/" $$targ; \
;; \
esac
@${MAKEDIRTARGET} ${.TARGET:C/^[^-]*-//} ${.TARGET:C/-.*$//}
.if make(cleandir)
__RECURSETARG= ${TARGETS:Nclean}