3 .if ${MK_DIRDEPS_BUILD} == "yes" || ${MK_META_MODE} == "yes"
5 # Not in the below list as it may make sense for non-meta mode
6 # eventually. meta.sys.mk (DIRDEPS_BUILD) also already adds these in.
7 .if ${MK_DIRDEPS_BUILD} == "no" && ${MK_META_MODE} == "yes"
8 MAKE_PRINT_VAR_ON_ERROR += \
16 _ERROR_CMD_EXEC= ${sed -n '/^CMD/s,^CMD \(.*\),\1;,p' ${.ERROR_META_FILE}:L:sh}
17 _ERROR_CMD= ${!empty(.ERROR_META_FILE):?${_ERROR_CMD_EXEC}:.PHONY}
18 MAKE_PRINT_VAR_ON_ERROR+= \
34 ${MAKE_PRINT_VAR_ON_ERROR_XTRAS}
36 # Meta mode may rebuild targets that then fail. The next build won't detect
37 # the meta mode change. Not all targets have a 'rm ${.TARGET}' in them
41 .if ${.MAKE.LEVEL} > 0
42 MAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH
47 OBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP}
51 _PREMK_LIBDIR:= ${LIBDIR}
56 .if ${.MAKE.MODE:Mmeta*} != ""
57 # we can afford to use cookies to prevent some targets
58 # re-running needlessly but only when using filemon.
59 # Targets that should support the meta mode cookie handling should just be
60 # added to META_TARGETS. If bsd.sys.mk cannot be included then ${META_DEPS}
61 # should be added as a target dependency as well. Otherwise the target
62 # is added to in bsd.sys.mk since it comes last.
63 .if ${.MAKE.MODE:Mnofilemon} == ""
64 # Prepend .OBJDIR if not already there.
65 _META_COOKIE_COND= "${.TARGET:M${.OBJDIR}/*}" == ""
66 _META_COOKIE_DEFAULT= ${${_META_COOKIE_COND}:?${.OBJDIR}/${.TARGET}:${.TARGET}}
67 # Use the default if COOKIE.${.TARGET} is not defined.
68 META_COOKIE= ${COOKIE.${.TARGET}:U${_META_COOKIE_DEFAULT}}
69 META_COOKIE_RM= @rm -f ${META_COOKIE}
70 META_COOKIE_TOUCH= @touch ${META_COOKIE}
71 CLEANFILES+= ${META_TARGETS}
72 _meta_dep_before: .USEBEFORE .NOTMAIN
74 _meta_dep_after: .USE .NOTMAIN
76 # Attach this to a target to allow it to benefit from meta mode's
77 # not rerunning a command if it doesn't need to be considering its
78 # metafile/filemon-tracked dependencies.
79 META_DEPS= _meta_dep_before _meta_dep_after .META
82 # some targets need to be .PHONY - but not in meta mode
88 META_DEPS+= ${META_NOPHONY}