1a7fa261eSBryan Drewery# 2a7fa261eSBryan Drewery# This is included very early from share/mk/src.sys.env.mk, after 3a7fa261eSBryan Drewery# /etc/src-env.conf but before /etc/make.conf, /etc/src.conf, or OBJDIR 4a7fa261eSBryan Drewery# handling. 5a7fa261eSBryan Drewery# - It is not safe to use .OBJDIR/OBJTOP/OBJROOT here. 6a7fa261eSBryan Drewery# - __ENV_ONLY_OPTIONS have been parsed by now except for opporutunistic 7a7fa261eSBryan Drewery# MK_AUTO_OBJ. 8a7fa261eSBryan Drewery# 9a7fa261eSBryan Drewery 10a7fa261eSBryan Drewery.if ${MK_DIRDEPS_BUILD} == "no" 11a7fa261eSBryan Drewery# For AUTO_OBJ many targets do not need object directories created at top-level 12a7fa261eSBryan Drewery# for each visited directory. Only when things are being built are they 13a7fa261eSBryan Drewery# needed. Having AUTO_OBJ disabled in a build target is fine as it should 14a7fa261eSBryan Drewery# fallback to running 'make obj' as needed. If a target is not in this list 15a7fa261eSBryan Drewery# then it is ran with MK_AUTO_OBJ=no in environment. 16a7fa261eSBryan Drewery# 'showconfig' is in the list to avoid forcing MK_AUTO_OBJ=no for it. 17a7fa261eSBryan DreweryAUTO_OBJ_TGT_WHITELIST+= \ 18a7fa261eSBryan Drewery _* all all-man build* depend everything *toolchain* includes \ 19a7fa261eSBryan Drewery libraries obj objlink showconfig tags xdev xdev-build native-xtools \ 20a7fa261eSBryan Drewery stage* create-packages* real-packages sign-packages package-pkg \ 21a7fa261eSBryan Drewery tinderbox universe* kernel kernels world worlds bmake 22a7fa261eSBryan Drewery 23a7fa261eSBryan Drewery# Only allow AUTO_OBJ for the whitelisted targets. See AUTO_OBJ_TGT_WHITELIST 24a7fa261eSBryan Drewery# above. MK_AUTO_OBJ not checked here for "yes" as it may not yet be enabled 25a7fa261eSBryan Drewery# since it is opportunistic. 26a7fa261eSBryan Drewery.if empty(.MAKEOVERRIDES:MMK_AUTO_OBJ) 27a7fa261eSBryan Drewery.for _tgt in ${AUTO_OBJ_TGT_WHITELIST} 28a7fa261eSBryan Drewery.if make(${_tgt}) 29a7fa261eSBryan Drewery_CAN_USE_AUTO_OBJ?= yes 30a7fa261eSBryan Drewery.endif 31a7fa261eSBryan Drewery.endfor 32a7fa261eSBryan Drewery.if !defined(_CAN_USE_AUTO_OBJ) 33a7fa261eSBryan Drewery_MAKEARGS+= MK_AUTO_OBJ=no 34a7fa261eSBryan DreweryMK_AUTO_OBJ= no 357e0aabd9SBryan Drewery# This will prevent src.sys.obj.mk from opportunistically enabling AUTO_OBJ 367e0aabd9SBryan Drewery# in this make execution and for sub-makes. For all of these targets we 377e0aabd9SBryan Drewery# just want to read any existing OBJDIR but we don't care if we can create 387e0aabd9SBryan Drewery# or write to them. 397e0aabd9SBryan Drewery.MAKEOVERRIDES+= MK_AUTO_OBJ 40e22224a5SBryan Drewery.else 41e22224a5SBryan Drewery# For top-level we always assume the MAKEOBJDIRPREFIX is writable rather than 42e22224a5SBryan Drewery# falling back to .CURDIR. 43e22224a5SBryan Drewery__objdir_writable= yes 44a7fa261eSBryan Drewery.endif 45a7fa261eSBryan Drewery.endif # empty(.MAKEOVERRIDES:MMK_AUTO_OBJ) 46a7fa261eSBryan Drewery 47a7fa261eSBryan Drewery.endif # ${MK_DIRDEPS_BUILD} == "no" 48