pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Made the code easier to read.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b9f7f4922a20
branches:  trunk
changeset: 538492:b9f7f4922a20
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Feb 10 10:30:58 2008 +0000

description:
Made the code easier to read.

diffstat:

 mk/find-prefix.mk |  25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diffs (46 lines):

diff -r 2c6f3dce05f5 -r b9f7f4922a20 mk/find-prefix.mk
--- a/mk/find-prefix.mk Sun Feb 10 10:12:13 2008 +0000
+++ b/mk/find-prefix.mk Sun Feb 10 10:30:58 2008 +0000
@@ -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_



Home | Main Index | Thread Index | Old Index