From 500efa9480c5ecdad11537c0a3ca6b566dc54c87 Mon Sep 17 00:00:00 2001 From: jlam Date: Thu, 12 May 2005 20:59:29 +0000 Subject: Allow vars.mk to be included multiple times. We avoid excessive computation by caching the variables using MAKEVARS. --- lang/perl5/vars.mk | 69 +++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) (limited to 'lang/perl5') diff --git a/lang/perl5/vars.mk b/lang/perl5/vars.mk index 35cf9d50353..fa309e69ff2 100644 --- a/lang/perl5/vars.mk +++ b/lang/perl5/vars.mk @@ -1,12 +1,9 @@ -# $NetBSD: vars.mk,v 1.1 2005/02/24 22:38:42 jlam Exp $ +# $NetBSD: vars.mk,v 1.2 2005/05/12 20:59:29 jlam Exp $ # # This Makefile fragment exposes several Perl configuration variables # to the package Makefiles. The variables are only defined if the # ${PERL5} executable exists. -.if !defined(_PERL5_VARS_MK) -_PERL5_VARS_MK= yes - .include "../../mk/bsd.prefs.mk" _PERL5_SITEVARS= \ @@ -22,48 +19,50 @@ _PERL5_SITEVAR.INSTALLSITEMAN3DIR= installsiteman3dir _PERL5_SITEVAR.SITELIBEXP= sitelibexp _PERL5_SITEVAR.SITEARCHEXP= sitearchexp -.if exists(${PERL5}) -. if !defined(_PERL5_SITEPREFIX) +.if defined(PERL5) && exists(${PERL5:Q}) +# +# Locate some of the installation prefixes for ${PERL5} that are used to +# define later variables. +# +. if !defined(_PERL5_PREFIX) _PERL5_PREFIX!= \ - eval `${PERL5} -V:prefix 2>/dev/null`; ${ECHO} $$prefix + eval `${PERL5:Q} -V:prefix 2>/dev/null`; ${ECHO} $$prefix +. endif +MAKEVARS+= _PERL5_PREFIX +. if !defined(_PERL5_SITEPREFIX) _PERL5_SITEPREFIX!= \ - eval `${PERL5} -V:siteprefix 2>/dev/null`; ${ECHO} $$siteprefix -MAKEFLAGS+= _PERL5_PREFIX=${_PERL5_PREFIX:Q} -MAKEFLAGS+= _PERL5_SITEPREFIX=${_PERL5_SITEPREFIX:Q} - -. for _var_ in ${_PERL5_SITEVARS} -. if !defined(PERL5_SUB_${_var_}) + eval `${PERL5:Q} -V:siteprefix 2>/dev/null`; ${ECHO} $$siteprefix +. endif +MAKEVARS+= _PERL5_SITEPREFIX +# +# Define PERL5_SUB_* as the site variables minus the installation prefix +# define later variables. +# +. for _var_ in ${_PERL5_SITEVARS} +. if !defined(PERL5_SUB_${_var_}) PERL5_SUB_${_var_}!= \ - eval `${PERL5} -V:${_PERL5_SITEVAR.${_var_}} 2>/dev/null`; \ - ${ECHO} $${${_PERL5_SITEVAR.${_var_}}} | \ - ${SED} -e "s,^${_PERL5_SITEPREFIX}/,," -MAKEFLAGS+= PERL5_SUB_${_var_}=${PERL5_SUB_${_var_}:Q} -. endif -. endfor -. if !defined(PERL5_SUB_INSTALLARCHLIB) + eval `${PERL5:Q} -V:${_PERL5_SITEVAR.${_var_}} 2>/dev/null`; \ + ${ECHO} $${${_PERL5_SITEVAR.${_var_}}} | ${SED} -e "s,^${_PERL5_SITEPREFIX}/,," +. endif +MAKEVARS+= PERL5_SUB_${_var_} +. endfor + +. if !defined(PERL5_SUB_INSTALLARCHLIB) PERL5_SUB_INSTALLARCHLIB!= \ eval `${PERL5} -V:installarchlib 2>/dev/null`; \ - ${ECHO} $$installarchlib | \ - ${SED} -e "s,^${_PERL5_PREFIX}/,," -MAKEFLAGS+= PERL5_SUB_INSTALLARCHLIB=${PERL5_SUB_INSTALLARCHLIB:Q} -. endif -. if !defined(PERL5_SUB_INSTALLSCRIPT) + ${ECHO} $$installarchlib | ${SED} -e "s,^${_PERL5_PREFIX}/,," +. endif +MAKEVARS+= PERL5_SUB_INSTALLARCHLIB +. if !defined(PERL5_SUB_INSTALLSCRIPT) PERL5_SUB_INSTALLSCRIPT!= \ eval `${PERL5} -V:installscript 2>/dev/null`; \ - ${ECHO} $$installscript | \ - ${SED} -e "s,^${_PERL5_PREFIX}/,," -MAKEFLAGS+= PERL5_SUB_INSTALLSCRIPT=${PERL5_SUB_INSTALLSCRIPT:Q} -. endif + ${ECHO} $$installscript | ${SED} -e "s,^${_PERL5_PREFIX}/,," . endif -.endif +MAKEVARS+= PERL5_SUB_INSTALLSCRIPT +.endif # PERL5 .if ${PKG_INSTALLATION_TYPE} == "overwrite" . for _var_ in SITELIB SITEARCH ARCHLIB -. if defined(PERL5_SUB_INSTALL${_var_}) PERL5_${_var_}?= ${LOCALBASE}/${PERL5_SUB_INSTALL${_var_}} -MAKEFLAGS+= PERL5_${_var_}=${PERL5_${_var_}:Q} -. endif . endfor .endif - -.endif # _PERL5_VARS_MK -- cgit v1.2.3