diff options
-rw-r--r-- | mk/find-prefix.mk | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/mk/find-prefix.mk b/mk/find-prefix.mk index 90d2cd90bcb..7b0966a8ca6 100644 --- a/mk/find-prefix.mk +++ b/mk/find-prefix.mk @@ -1,4 +1,4 @@ -# $NetBSD: find-prefix.mk,v 1.6 2008/02/10 10:12:13 rillig Exp $ +# $NetBSD: find-prefix.mk,v 1.7 2008/02/10 10:30:58 rillig Exp $ # # This is a "subroutine" that can be included to find the installation # prefix of an installed package. @@ -25,23 +25,26 @@ # # ${M4DIR} now contains the installation prefix for the "gm4" package. # -.for _def_ in ${FIND_PREFIX} -. if !defined(${_def_:C/=.*$//}) +.for i in ${FIND_PREFIX} +. for varname in ${i:C/=.*$//} +. for pattern in ${i:C/^[^=]*=//} +. if !defined(${varname}) # XXX: Is this *_DEFAULT variable really necessary? The default value # can be easily embedded in the shell code. What if VARNAME is set to # PKG_APACHE, for example? # -${_def_:C/=.*$//}_DEFAULT?= ${LOCALBASE} -_${_def_:C/=.*$//}_cmd= \ - ${PKG_INFO} -qp ${_def_:C/^[^=]*=//:Q} 2>/dev/null | \ +${varname}_DEFAULT?= ${LOCALBASE} +_${varname}_cmd= \ + ${PKG_INFO} -qp ${pattern:Q} 2>/dev/null | \ { read cmd arg; \ case "$$arg" in \ - "") ${ECHO} ${${_def_:C/=.*$//}_DEFAULT:Q} ;; \ + "") ${ECHO} ${${varname}_DEFAULT:Q} ;; \ *) ${ECHO} "$$arg" ;; \ esac; } -${_def_:C/=.*$//}= ${_${_def_:C/=.*$//}_cmd:sh} -. endif -MAKEVARS+= ${_def_:C/=.*$//} +${varname}= ${_${varname}_cmd:sh} +. endif +MAKEVARS+= ${varname} +. endfor +. endfor .endfor -.undef _def_ |