17750ad47SMarcel Moolenaar 249b6bc83SStephen J. Kiernan.if !target(_${_this}_) 349b6bc83SStephen J. Kiernan_${_this}_: .NOTMAIN 449b6bc83SStephen J. Kiernan 529f227c1SBryan Drewery.if ${MK_DIRDEPS_BUILD} == "yes" || ${MK_META_MODE} == "yes" 629f227c1SBryan Drewery 729f227c1SBryan Drewery# Not in the below list as it may make sense for non-meta mode 829f227c1SBryan Drewery# eventually. meta.sys.mk (DIRDEPS_BUILD) also already adds these in. 929f227c1SBryan Drewery.if ${MK_DIRDEPS_BUILD} == "no" && ${MK_META_MODE} == "yes" 1029f227c1SBryan DreweryMAKE_PRINT_VAR_ON_ERROR += \ 1129f227c1SBryan Drewery .ERROR_TARGET \ 1229f227c1SBryan Drewery .ERROR_META_FILE \ 1329f227c1SBryan Drewery .MAKE.LEVEL \ 1429f227c1SBryan Drewery MAKEFILE \ 1529f227c1SBryan Drewery .MAKE.MODE 1629f227c1SBryan Drewery.endif 1729f227c1SBryan Drewery 187970b893SBryan Drewery_ERROR_CMD_EXEC= ${sed -n '/^CMD/s,^CMD \(.*\),\1;,p' ${.ERROR_META_FILE}:L:sh} 1951deaaabSBryan Drewery_ERROR_CMD= ${!empty(.ERROR_META_FILE):?${_ERROR_CMD_EXEC}:.PHONY} 207750ad47SMarcel MoolenaarMAKE_PRINT_VAR_ON_ERROR+= \ 2195a2495fSBryan Drewery _ERROR_CMD \ 227750ad47SMarcel Moolenaar .CURDIR \ 237750ad47SMarcel Moolenaar .MAKE \ 247750ad47SMarcel Moolenaar .OBJDIR \ 257750ad47SMarcel Moolenaar .TARGETS \ 2649b6bc83SStephen J. Kiernan CPUTYPE \ 277750ad47SMarcel Moolenaar DESTDIR \ 287750ad47SMarcel Moolenaar LD_LIBRARY_PATH \ 297750ad47SMarcel Moolenaar MACHINE \ 307750ad47SMarcel Moolenaar MACHINE_ARCH \ 3149b6bc83SStephen J. Kiernan MACHINE_CPUARCH \ 327750ad47SMarcel Moolenaar MAKEOBJDIRPREFIX \ 3323090366SSimon J. Gerraty MAKESYSPATH \ 347750ad47SMarcel Moolenaar MAKE_VERSION \ 3580dfd0d4SBryan Drewery PATH \ 364113aa90SSimon J. Gerraty SRCTOP \ 377750ad47SMarcel Moolenaar OBJTOP \ 387750ad47SMarcel Moolenaar ${MAKE_PRINT_VAR_ON_ERROR_XTRAS} 397750ad47SMarcel Moolenaar 409e0a1e78SBryan Drewery# Meta mode may rebuild targets that then fail. The next build won't detect 419e0a1e78SBryan Drewery# the meta mode change. Not all targets have a 'rm ${.TARGET}' in them 429e0a1e78SBryan Drewery# so force it. 439e0a1e78SBryan Drewery.DELETE_ON_ERROR: 449e0a1e78SBryan Drewery 456bc671bbSSimon J. Gerraty.if ${.MAKE.LEVEL} > 0 466bc671bbSSimon J. GerratyMAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH 476bc671bbSSimon J. Gerraty.endif 4831277fe3SSimon J. Gerraty.endif 496bc671bbSSimon J. Gerraty 508f399abaSBryan Drewery.if !empty(.OBJDIR) 518f399abaSBryan DreweryOBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP} 528f399abaSBryan Drewery.endif 538f399abaSBryan Drewery 54ad706c65SBryan Drewery.if !empty(LIBDIR) 55ad706c65SBryan Drewery_PREMK_LIBDIR:= ${LIBDIR} 56ad706c65SBryan Drewery.endif 57ad706c65SBryan Drewery 58ccfb9654SSimon J. Gerraty.include "src.sys.mk" 59073ccb9dSSimon J. Gerraty.-include <site.sys.mk> 60948f327eSSimon J. Gerraty 614b932c2cSSimon J. Gerraty# this will be set via local.meta.sys.env.mk if appropriate 628561d0b2SSimon J. GerratyMK_host_egacy?= no 638561d0b2SSimon J. Gerraty 640b6ba3f2SBryan Drewery.if ${.MAKE.MODE:Mmeta*} != "" 65948f327eSSimon J. Gerraty# we can afford to use cookies to prevent some targets 6695ae4929SBryan Drewery# re-running needlessly but only when using filemon. 6794086ceaSBryan Drewery# Targets that should support the meta mode cookie handling should just be 6894086ceaSBryan Drewery# added to META_TARGETS. If bsd.sys.mk cannot be included then ${META_DEPS} 6994086ceaSBryan Drewery# should be added as a target dependency as well. Otherwise the target 7094086ceaSBryan Drewery# is added to in bsd.sys.mk since it comes last. 7195ae4929SBryan Drewery.if ${.MAKE.MODE:Mnofilemon} == "" 722d9796bdSBryan Drewery# Prepend .OBJDIR if not already there. 732d9796bdSBryan Drewery_META_COOKIE_COND= "${.TARGET:M${.OBJDIR}/*}" == "" 742d9796bdSBryan Drewery_META_COOKIE_DEFAULT= ${${_META_COOKIE_COND}:?${.OBJDIR}/${.TARGET}:${.TARGET}} 752d9796bdSBryan Drewery# Use the default if COOKIE.${.TARGET} is not defined. 762d9796bdSBryan DreweryMETA_COOKIE= ${COOKIE.${.TARGET}:U${_META_COOKIE_DEFAULT}} 77588f5cb8SBryan DreweryMETA_COOKIE_RM= @rm -f ${META_COOKIE} 78588f5cb8SBryan DreweryMETA_COOKIE_TOUCH= @touch ${META_COOKIE} 79b7d28affSBryan DreweryCLEANFILES+= ${META_TARGETS} 802b2ab443SBryan Drewery_meta_dep_before: .USEBEFORE .NOTMAIN 81b7d28affSBryan Drewery ${META_COOKIE_RM} 822b2ab443SBryan Drewery_meta_dep_after: .USE .NOTMAIN 83b7d28affSBryan Drewery ${META_COOKIE_TOUCH} 84b7d28affSBryan Drewery# Attach this to a target to allow it to benefit from meta mode's 85b7d28affSBryan Drewery# not rerunning a command if it doesn't need to be considering its 86b7d28affSBryan Drewery# metafile/filemon-tracked dependencies. 87b7d28affSBryan DreweryMETA_DEPS= _meta_dep_before _meta_dep_after .META 8895ae4929SBryan Drewery.endif 89948f327eSSimon J. Gerraty.else 9095ae4929SBryan Drewery# some targets need to be .PHONY - but not in meta mode 91948f327eSSimon J. GerratyMETA_NOPHONY= .PHONY 92948f327eSSimon J. Gerraty.endif 9395ae4929SBryan DreweryMETA_NOPHONY?= 9495ae4929SBryan DreweryMETA_COOKIE_RM?= 9595ae4929SBryan DreweryMETA_COOKIE_TOUCH?= 96b7d28affSBryan DreweryMETA_DEPS+= ${META_NOPHONY} 9749b6bc83SStephen J. Kiernan 98*f174619cSSimon J. Gerraty.if ${MK_DIRDEPS_BUILD} == "yes" 99f9df6097SSimon J. Gerraty.if ${MACHINE:Nhost*:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE} 100f9df6097SSimon J. Gerraty# cross-building 101f9df6097SSimon J. GerratyCROSS_TARGET_FLAGS?= -target ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION} 102f9df6097SSimon J. GerratyCFLAGS+= ${CROSS_TARGET_FLAGS} 103f9df6097SSimon J. GerratyACFLAGS+= ${CROSS_TARGET_FLAGS} 104f9df6097SSimon J. Gerraty.endif 105*f174619cSSimon J. Gerraty.endif 106f9df6097SSimon J. Gerraty 10749b6bc83SStephen J. Kiernan.endif 108