]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/local.sys.mk
Follow-up r297835: Let the intented default cookie work.
[FreeBSD/FreeBSD.git] / share / mk / local.sys.mk
1 # $FreeBSD$
2
3 .if ${MK_DIRDEPS_BUILD} == "yes"
4 MAKE_PRINT_VAR_ON_ERROR+= \
5         .CURDIR \
6         .MAKE \
7         .OBJDIR \
8         .TARGETS \
9         DESTDIR \
10         LD_LIBRARY_PATH \
11         MACHINE \
12         MACHINE_ARCH \
13         MAKEOBJDIRPREFIX \
14         MAKESYSPATH \
15         MAKE_VERSION\
16         PATH \
17         SRCTOP \
18         OBJTOP \
19         ${MAKE_PRINT_VAR_ON_ERROR_XTRAS}
20
21 .if ${.MAKE.LEVEL} > 0
22 MAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH
23 .endif
24 .endif
25
26 .if !empty(.OBJDIR)
27 OBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP}
28 .endif
29
30 .include "src.sys.mk"
31
32 .if ${.MAKE.MODE:Mmeta*} != ""
33 # we can afford to use cookies to prevent some targets
34 # re-running needlessly but only when using filemon.
35 # Targets that should support the meta mode cookie handling should just be
36 # added to META_TARGETS.  If bsd.sys.mk cannot be included then ${META_DEPS}
37 # should be added as a target dependency as well.  Otherwise the target
38 # is added to in bsd.sys.mk since it comes last.
39 .if ${.MAKE.MODE:Mnofilemon} == ""
40 # Prepend .OBJDIR if not already there.
41 _META_COOKIE_COND=      "${.TARGET:M${.OBJDIR}/*}" == ""
42 _META_COOKIE_DEFAULT=   ${${_META_COOKIE_COND}:?${.OBJDIR}/${.TARGET}:${.TARGET}}
43 # Use the default if COOKIE.${.TARGET} is not defined.
44 META_COOKIE=            ${COOKIE.${.TARGET}:U${_META_COOKIE_DEFAULT}}
45 META_COOKIE_RM=         @rm -f ${META_COOKIE}
46 META_COOKIE_TOUCH=      @touch ${META_COOKIE}
47 CLEANFILES+=            ${META_TARGETS}
48 _meta_dep_before:       .USEBEFORE .NOTMAIN
49         ${META_COOKIE_RM}
50 _meta_dep_after:        .USE .NOTMAIN
51         ${META_COOKIE_TOUCH}
52 # Attach this to a target to allow it to benefit from meta mode's
53 # not rerunning a command if it doesn't need to be considering its
54 # metafile/filemon-tracked dependencies.
55 META_DEPS=      _meta_dep_before _meta_dep_after .META
56 .endif
57 .else
58 # some targets need to be .PHONY - but not in meta mode
59 META_NOPHONY=   .PHONY
60 .endif
61 META_NOPHONY?=
62 META_COOKIE_RM?=
63 META_COOKIE_TOUCH?=
64 META_DEPS+=     ${META_NOPHONY}