summaryrefslogtreecommitdiff
path: root/mk/find-prefix.mk
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2008-02-10 10:30:58 +0000
committerrillig <rillig@pkgsrc.org>2008-02-10 10:30:58 +0000
commit0f1f94115c56e374f36306cd8201abcecf10b506 (patch)
tree7a481a95884679e08f9cf42d35c4f6050bbc1932 /mk/find-prefix.mk
parent091ba5fb307533e52e0cf885f941d524919d5e7f (diff)
downloadpkgsrc-0f1f94115c56e374f36306cd8201abcecf10b506.tar.gz
Made the code easier to read.
Diffstat (limited to 'mk/find-prefix.mk')
-rw-r--r--mk/find-prefix.mk25
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_