3 .if !target(_${_this}_)
6 .if ${MK_DIRDEPS_BUILD} == "yes" || ${MK_META_MODE} == "yes"
8 # Not in the below list as it may make sense for non-meta mode
9 # eventually. meta.sys.mk (DIRDEPS_BUILD) also already adds these in.
10 .if ${MK_DIRDEPS_BUILD} == "no" && ${MK_META_MODE} == "yes"
11 MAKE_PRINT_VAR_ON_ERROR += \
19 _ERROR_CMD_EXEC= ${sed -n '/^CMD/s,^CMD \(.*\),\1;,p' ${.ERROR_META_FILE}:L:sh}
20 _ERROR_CMD= ${!empty(.ERROR_META_FILE):?${_ERROR_CMD_EXEC}:.PHONY}
21 MAKE_PRINT_VAR_ON_ERROR+= \
39 ${MAKE_PRINT_VAR_ON_ERROR_XTRAS}
41 # Meta mode may rebuild targets that then fail. The next build won't detect
42 # the meta mode change. Not all targets have a 'rm ${.TARGET}' in them
46 .if ${.MAKE.LEVEL} > 0
47 MAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH
52 OBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP}
56 _PREMK_LIBDIR:= ${LIBDIR}
60 .-include <site.sys.mk>
62 .if make(*-jobs) && empty(JOB_MAX)
63 # provide a reasonable? default for JOB_MAX based on ncpu
65 NPROC?= ${(type nproc || true) 2> /dev/null:L:sh:M/*:[1]}
69 .elif ${.MAKE.OS:NDarwin:NFreeBSD} == ""
70 ncpu!= sysctl -n hw.ncpu
73 .if ${JOB_MAX_FACTOR} == 1
76 jm!= echo ${ncpu} \* ${JOB_MAX_FACTOR} | bc
82 # this will be set via local.meta.sys.env.mk if appropriate
85 .if ${.MAKE.MODE:Mmeta*} != ""
86 # we can afford to use cookies to prevent some targets
87 # re-running needlessly but only when using filemon.
88 # Targets that should support the meta mode cookie handling should just be
89 # added to META_TARGETS. If bsd.sys.mk cannot be included then ${META_DEPS}
90 # should be added as a target dependency as well. Otherwise the target
91 # is added to in bsd.sys.mk since it comes last.
92 .if ${.MAKE.MODE:Mnofilemon} == ""
93 # Prepend .OBJDIR if not already there.
94 _META_COOKIE_COND= "${.TARGET:M${.OBJDIR}/*}" == ""
95 _META_COOKIE_DEFAULT= ${${_META_COOKIE_COND}:?${.OBJDIR}/${.TARGET}:${.TARGET}}
96 # Use the default if COOKIE.${.TARGET} is not defined.
97 META_COOKIE= ${COOKIE.${.TARGET}:U${_META_COOKIE_DEFAULT}}
98 META_COOKIE_RM= @rm -f ${META_COOKIE}
99 META_COOKIE_TOUCH= @touch ${META_COOKIE}
100 CLEANFILES+= ${META_TARGETS}
101 _meta_dep_before: .USEBEFORE .NOTMAIN
103 _meta_dep_after: .USE .NOTMAIN
105 # Attach this to a target to allow it to benefit from meta mode's
106 # not rerunning a command if it doesn't need to be considering its
107 # metafile/filemon-tracked dependencies.
108 META_DEPS= _meta_dep_before _meta_dep_after .META
111 # some targets need to be .PHONY - but not in meta mode
117 META_DEPS+= ${META_NOPHONY}