Add files from parent branch HEAD:
[pkgsrc.git] / mk / bsd.makevars.mk
1 # $NetBSD: bsd.makevars.mk,v 1.3 2005/06/05 04:35:45 rillig Exp $
2 #
3 # This Makefile fragment is included by bsd.prefs.mk to set all of
4 # the variables saved through MAKEVARS.  Typical usage is:
5 #
6 # .include "../../mk/bsd.prefs.mk"
7 #
8 # .if !defined(EXPENSIVE_VAR)
9 # EXPENSIVE_VAR!=       ( ... an expensive computation ... )
10 # .endif
11 # MAKEVARS+=    EXPENSIVE_VAR
12 #
13 # This causes EXPENSIVE_VAR to be computed, then subsequently stored in
14 # the variable cache file.  The next time through, EXPENSIVE_VAR is
15 # set by bsd.makevars.mk, which avoids running the expensive computation
16 # again.
17 #
18 # The cache files are created as we pass through each phase of the build,
19 # and we only include the latest cache file that was created.
20 #
21
22 _ALL_PHASES=            fetch tools extract patch                       \
23                         wrapper configure build install package
24 _REV_ALL_PHASES=        package install build configure wrapper         \
25                         patch extract tools fetch
26
27 # Try including the *.makevars.mk files in reverse order so that the
28 # latest file is included and no more.  We check for _MAKEVARS_MK since
29 # all of the *.makevars.mk files define this symbol at the top of the
30 # file.
31 #
32 .for _phase_ in ${_REV_ALL_PHASES}
33 _MAKEVARS_MK.${_phase_}=        ${WRKDIR}/.${_phase_}_makevars.mk
34 .  if !target(${_phase_}-vars)
35 ${_phase_}-vars: ${_MAKEVARS_MK.${_phase_}}
36 .  endif
37 .  if !defined(_MAKEVARS_MK)
38 .    sinclude "${_MAKEVARS_MK.${_phase_}}"
39 .  endif
40 .endfor