summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam>2005-06-01 03:04:16 +0000
committerjlam <jlam>2005-06-01 03:04:16 +0000
commitecca24b0eafb61968a888c351f2be608b09c766d (patch)
tree6aaeaa76798bb23e32433c2f97c18559ee6d2803
parent48e449a6c69a44e89da831f29eceae508996eb7a (diff)
downloadpkgsrc-ecca24b0eafb61968a888c351f2be608b09c766d.tar.gz
Separate out the logic to include the correct <phase>.makevars.mk file
into a new file bsd.makevars.mk that can be included by other Makefiles.
-rw-r--r--mk/bsd.makevars.mk40
-rw-r--r--mk/bsd.pkg.mk24
2 files changed, 42 insertions, 22 deletions
diff --git a/mk/bsd.makevars.mk b/mk/bsd.makevars.mk
new file mode 100644
index 00000000000..2fe63a99171
--- /dev/null
+++ b/mk/bsd.makevars.mk
@@ -0,0 +1,40 @@
+# $NetBSD: bsd.makevars.mk,v 1.1 2005/06/01 03:04:16 jlam Exp $
+#
+# This Makefile fragment is included by other Makefiles to set all of
+# the variables saved through MAKEVARS. Typical usage is:
+#
+# .include "../../mk/bsd.makevars.mk"
+# .if !define(EXPENSIVE_VAR)
+# EXPENSIVE_VAR!= ( ... an expensive computation ... )
+# .endif
+# MAKEVARS+= EXPENSIVE_VAR
+#
+# This causes EXPENSIVE_VAR to be computed, then subsequently stored in
+# the variable cache file. The next time through, EXPENSIVE_VAR is
+# set by bsd.makevars.mk, which avoids running the expensive computation
+# again.
+#
+# The cache files are created as we pass through each phase of the build,
+# and we only include the latest cache file that was created.
+#
+
+.if !defined(_REV_ALL_PHASES)
+_REV_ALL_PHASES= # empty
+. for _phase_ in ${ALL_PHASES}
+_REV_ALL_PHASES:= ${_phase_} ${_REV_ALL_PHASES}
+. endfor
+.endif
+MAKEVARS+= _REV_ALL_PHASES
+
+# Try including the .makevars.mk.* files in reverse order so that the
+# latest file is included and no more.
+#
+.for _phase_ in ${_REV_ALL_PHASES}
+_MAKEVARS_MK.${_phase_}= ${WRKDIR}/.${_phase_}_makevars.mk
+. if !target(${_phase_}-vars)
+${_phase_}-vars: ${_MAKEVARS_MK.${_phase_}}
+. endif
+. if !defined(_MAKEVARS_MK)
+. sinclude "${_MAKEVARS_MK.${_phase_}}"
+. endif
+.endfor
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index ae491f9fc68..462c8840d70 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1681 2005/05/31 21:53:26 jlam Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1682 2005/06/01 03:04:16 jlam Exp $
#
# This file is in the public domain.
#
@@ -20,27 +20,7 @@
.include "../../mk/bsd.prefs.mk"
.include "../../mk/bsd.hacks.mk"
-
-.if !defined(_REV_ALL_PHASES)
-_REV_ALL_PHASES= # empty
-. for _phase_ in ${ALL_PHASES}
-_REV_ALL_PHASES:= ${_phase_} ${_REV_ALL_PHASES}
-. endfor
-. undef _phase_
-.endif
-MAKEVARS+= _REV_ALL_PHASES
-
-# Try including the .makevars.mk.* files in reverse order so that the
-# latest file is included and no more.
-#
-.for _phase_ in ${_REV_ALL_PHASES}
-_MAKEVARS_MK.${_phase_}= ${WRKDIR}/.${_phase_}_makevars.mk
-${_phase_}-vars: ${_MAKEVARS_MK.${_phase_}}
-. if !defined(_MAKEVARS_MK)
-. sinclude "${_MAKEVARS_MK.${_phase_}}"
-. endif
-.endfor
-.undef _phase_
+.include "../../mk/bsd.makevars.mk"
# This has to come first to avoid showing all BUILD_DEFS added by this
# Makefile, which are usually not customizable.