Permalink
Browse files

Made the code easier to read.

  • Loading branch information...
1 parent 832dc9c commit e279f1ef9c8bc50575c70e4006bff96f0fc8e12b rillig committed Feb 10, 2008
Showing with 14 additions and 11 deletions.
  1. +14 −11 mk/find-prefix.mk
View
25 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_

0 comments on commit e279f1e

Please sign in to comment.