1 # $NetBSD: find-prefix.mk,v 1.2 2005/05/12 21:56:11 jlam Exp $
3 # This is a "subroutine" that can be included to find the installation
6 # The input variable is FIND_PREFIX, which is a list of VARNAME=<package>
7 # pairs, where "VARNAME" is the variable that will be set to the
8 # installation prefix for the package, and <package> is the ${PKGNAME}
13 # FIND_PREFIX:= M4DIR=gm4
14 # .include "../../mk/find-prefix.mk"
15 # # ${M4DIR} now contains the installation prefix for the "gm4" package
18 .for _def_ in ${FIND_PREFIX}
19 . if !defined(${_def_:C/=.*$//})
20 ${_def_:C/=.*$//}_DEFAULT?= ${LOCALBASE}
21 _${_def_:C/=.*$//}_cmd= \
22 ${PKG_INFO} -qp ${_def_:C/^.*=//} 2>/dev/null | \
25 "") ${ECHO} ${${_def_:C/=.*$//}_DEFAULT:Q} ;; \
26 *) ${ECHO} "$$arg" ;; \
28 ${_def_:C/=.*$//}= ${_${_def_:C/=.*$//}_cmd:sh}
30 MAKEVARS+= ${_def_:C/=.*$//}