summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2005-06-01 17:27:22 +0000
committerjlam <jlam@pkgsrc.org>2005-06-01 17:27:22 +0000
commitd811860c7bdf86cf985fc17b6cbbae259e111fa8 (patch)
tree65c5344fab529de5f9914b79bcefb3e14ce16df3 /mk
parenta72cd1c453fe743bb6f506dead7b434ac9cc77f4 (diff)
downloadpkgsrc-d811860c7bdf86cf985fc17b6cbbae259e111fa8.tar.gz
*.makevars.mk doesn't exist until after ${WRKDIR} is created, which
doesn't happen until after the package is extracted. Prior to extraction, cache the variables named in MAKEVARS using MAKEFLAGS instead. This avoids invoking each expensive computation up to four times before it gets cached. For packages that include lots of buildlink3.mk files, this saves a lot of CPU time.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk15
1 files changed, 14 insertions, 1 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index c724302daa4..a9bea62fdd5 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1683 2005/06/01 17:05:19 jlam Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1684 2005/06/01 17:27:22 jlam Exp $
#
# This file is in the public domain.
#
@@ -4836,6 +4836,19 @@ ${_MAKEVARS_MK.${_phase_}}: ${WRKDIR}
.endfor
.undef _phase_
+# *.makevars.mk doesn't exist until after ${WRKDIR} is created, which
+# doesn't happen until after the package is extracted. Prior to
+# extraction, cache the variables named in MAKEVARS using MAKEFLAGS
+# instead.
+#
+.if !exists(${EXTRACT_COOKIE})
+. for _var_ in ${MAKEVARS:O:u}
+. if defined(${_var_})
+MAKEFLAGS+= ${_var_}=${${_var_}:Q}
+. endif
+. endfor
+.endif
+
# show-tools emits a /bin/sh shell script that defines all known tools
# to the values they have in the pkgsrc infrastructure.
#