[BACK]Return to bsd.makevars.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / mk

File: [cvs.NetBSD.org] / pkgsrc / mk / bsd.makevars.mk (download)

Revision 1.2, Wed Jun 1 17:05:19 2005 UTC (18 years, 10 months ago) by jlam
Branch: MAIN
Changes since 1.1: +8 -5 lines

Include bsd.makevars.mk in bsd.prefs.mk instead of bsd.pkg.mk.  This
allows the saved make variables to be re-set whenever bsd.prefs.mk is
included, and is a shortcut for the common case where a Makefile
includes both.

# $NetBSD: bsd.makevars.mk,v 1.2 2005/06/01 17:05:19 jlam Exp $
#
# This Makefile fragment is included by bsd.prefs.mk to set all of
# the variables saved through MAKEVARS.  Typical usage is:
#
# .include "../../mk/bsd.prefs.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.  We check for _MAKEVARS_MK since
# all of the *.makevars.mk files define this symbol at the top of the
# file.
#
.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