Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk Add MAKEDIRPREFIX shell macro to <bsd.own.mk>.



details:   https://anonhg.NetBSD.org/src/rev/c8af83246b25
branches:  trunk
changeset: 565576:c8af83246b25
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Apr 13 12:25:03 2004 +0000

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

diffstat:

 share/mk/bsd.README    |   7 ++++++-
 share/mk/bsd.own.mk    |  25 ++++++++++++++++++++++++-
 share/mk/bsd.subdir.mk |  15 ++-------------
 3 files changed, 32 insertions(+), 15 deletions(-)

diffs (89 lines):

diff -r 92b0372ca927 -r c8af83246b25 share/mk/bsd.README
--- a/share/mk/bsd.README       Tue Apr 13 11:40:06 2004 +0000
+++ b/share/mk/bsd.README       Tue Apr 13 12:25:03 2004 +0000
@@ -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 @@
                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
diff -r 92b0372ca927 -r c8af83246b25 share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk       Tue Apr 13 11:40:06 2004 +0000
+++ b/share/mk/bsd.own.mk       Tue Apr 13 12:25:03 2004 +0000
@@ -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
@@ -679,6 +679,29 @@
 
 
 #
+# 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
 #      1       Enable info messages, suppress command output
diff -r 92b0372ca927 -r c8af83246b25 share/mk/bsd.subdir.mk
--- a/share/mk/bsd.subdir.mk    Tue Apr 13 11:40:06 2004 +0000
+++ b/share/mk/bsd.subdir.mk    Tue Apr 13 12:25:03 2004 +0000
@@ -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 @@
 .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}



Home | Main Index | Thread Index | Old Index