1# $FreeBSD$ 2 3.if ${MK_DIRDEPS_BUILD} == "yes" 4MAKE_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 22MAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH 23.endif 24.endif 25 26.if !empty(.OBJDIR) 27OBJTOP?= ${.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} == "" 40META_COOKIE_COND= empty(.TARGET:M${.OBJDIR}) 41META_COOKIE= ${COOKIE.${.TARGET}:U${${META_COOKIE_COND}:?${.OBJDIR}/${.TARGET}:${.TARGET}}} 42META_COOKIE_RM= @rm -f ${META_COOKIE} 43META_COOKIE_TOUCH= @touch ${META_COOKIE} 44CLEANFILES+= ${META_TARGETS} 45_meta_dep_before: .USEBEFORE .NOTMAIN 46 ${META_COOKIE_RM} 47_meta_dep_after: .USE .NOTMAIN 48 ${META_COOKIE_TOUCH} 49# Attach this to a target to allow it to benefit from meta mode's 50# not rerunning a command if it doesn't need to be considering its 51# metafile/filemon-tracked dependencies. 52META_DEPS= _meta_dep_before _meta_dep_after .META 53.endif 54.else 55# some targets need to be .PHONY - but not in meta mode 56META_NOPHONY= .PHONY 57.endif 58META_NOPHONY?= 59META_COOKIE_RM?= 60META_COOKIE_TOUCH?= 61META_DEPS+= ${META_NOPHONY} 62