Sun Dec 13 09:10:16 2009 UTC ()
enable MAKEDIRTARGET to be called with a separate environment,
called $MAKEDIRTARGETENV, defaulting to nothing.


(mrg)
diff -r1.611 -r1.612 src/share/mk/bsd.own.mk

cvs diff -r1.611 -r1.612 src/share/mk/bsd.own.mk (expand / switch to unified diff)

--- src/share/mk/bsd.own.mk 2009/12/13 09:01:46 1.611
+++ src/share/mk/bsd.own.mk 2009/12/13 09:10:16 1.612
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: bsd.own.mk,v 1.611 2009/12/13 09:01:46 mrg Exp $ 1# $NetBSD: bsd.own.mk,v 1.612 2009/12/13 09:10:16 mrg Exp $
2 2
3# This needs to be before bsd.init.mk 3# This needs to be before bsd.init.mk
4.if defined(BSD_MK_COMPAT_FILE) 4.if defined(BSD_MK_COMPAT_FILE)
5.include <${BSD_MK_COMPAT_FILE}> 5.include <${BSD_MK_COMPAT_FILE}>
6.endif 6.endif
7 7
8.if !defined(_BSD_OWN_MK_) 8.if !defined(_BSD_OWN_MK_)
9_BSD_OWN_MK_=1 9_BSD_OWN_MK_=1
10 10
11MAKECONF?= /etc/mk.conf 11MAKECONF?= /etc/mk.conf
12.-include "${MAKECONF}" 12.-include "${MAKECONF}"
13 13
14# 14#
@@ -956,44 +956,45 @@ EXTSRCSRCDIR= /usr/extsrc @@ -956,44 +956,45 @@ EXTSRCSRCDIR= /usr/extsrc
956.endif 956.endif
957.endif # !defined(EXTSRCSRCDIR) 957.endif # !defined(EXTSRCSRCDIR)
958 958
959EXTSRCROOTDIR?= /usr/ext 959EXTSRCROOTDIR?= /usr/ext
960EXTSRCBINDIR?= ${EXTSRCROOTDIR}/bin 960EXTSRCBINDIR?= ${EXTSRCROOTDIR}/bin
961EXTSRCETCDIR?= /etc/ext 961EXTSRCETCDIR?= /etc/ext
962EXTSRCINCDIR?= ${EXTSRCROOTDIR}/include 962EXTSRCINCDIR?= ${EXTSRCROOTDIR}/include
963EXTSRCLIBDIR?= ${EXTSRCROOTDIR}/lib/ext 963EXTSRCLIBDIR?= ${EXTSRCROOTDIR}/lib/ext
964EXTSRCMANDIR?= ${EXTSRCROOTDIR}/man 964EXTSRCMANDIR?= ${EXTSRCROOTDIR}/man
965EXTSRCUSRLIBDIR?= ${EXTSRCROOTDIR}/lib 965EXTSRCUSRLIBDIR?= ${EXTSRCROOTDIR}/lib
966 966
967# 967#
968# MAKEDIRTARGET dir target [extra make(1) params] 968# MAKEDIRTARGET dir target [extra make(1) params]
969# run "cd $${dir} && ${MAKE} [params] $${target}", with a pretty message 969# run "cd $${dir} && ${MAKEDIRTARGETENV} ${MAKE} [params] $${target}", with a pretty message
970# 970#
 971MAKEDIRTARGETENV?=
971MAKEDIRTARGET=\ 972MAKEDIRTARGET=\
972 @_makedirtarget() { \ 973 @_makedirtarget() { \
973 dir="$$1"; shift; \ 974 dir="$$1"; shift; \
974 target="$$1"; shift; \ 975 target="$$1"; shift; \
975 case "$${dir}" in \ 976 case "$${dir}" in \
976 /*) this="$${dir}/"; \ 977 /*) this="$${dir}/"; \
977 real="$${dir}" ;; \ 978 real="$${dir}" ;; \
978 .) this="${_THISDIR_}"; \ 979 .) this="${_THISDIR_}"; \
979 real="${.CURDIR}" ;; \ 980 real="${.CURDIR}" ;; \
980 *) this="${_THISDIR_}$${dir}/"; \ 981 *) this="${_THISDIR_}$${dir}/"; \
981 real="${.CURDIR}/$${dir}" ;; \ 982 real="${.CURDIR}/$${dir}" ;; \
982 esac; \ 983 esac; \
983 show=$${this:-.}; \ 984 show=$${this:-.}; \
984 echo "$${target} ===> $${show%/}$${1:+ (with: $$@)}"; \ 985 echo "$${target} ===> $${show%/}$${1:+ (with: $$@)}"; \
985 cd "$${real}" \ 986 cd "$${real}" \
986 && ${MAKE} _THISDIR_="$${this}" "$$@" $${target}; \ 987 && ${MAKEDIRTARGETENV} ${MAKE} _THISDIR_="$${this}" "$$@" $${target}; \
987 }; \ 988 }; \
988 _makedirtarget 989 _makedirtarget
989 990
990# 991#
991# ${GENCMD} <generated name> <command and arguments> 992# ${GENCMD} <generated name> <command and arguments>
992# Extract only one output from generation command so that make rule is 993# Extract only one output from generation command so that make rule is
993# written straight and avoid race (duplicate generation). <generated 994# written straight and avoid race (duplicate generation). <generated
994# name> is usually ${.TARGET}; if you want foo.c from foo.y, yacc 995# name> is usually ${.TARGET}; if you want foo.c from foo.y, yacc
995# generates y.tab.c, so <generated name> is y.tab.c. See bin/sh/Makefile 996# generates y.tab.c, so <generated name> is y.tab.c. See bin/sh/Makefile
996# for examples. 997# for examples.
997# 998#
998GENCMD=\ 999GENCMD=\
999 @_gencmd() { \ 1000 @_gencmd() { \