xref: /freebsd/share/mk/src.sys.mk (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1# $FreeBSD$
2
3# Note: This file is also duplicated in the sys/conf/kern.pre.mk so
4# it will always grab SRCCONF, even if it isn't being built in-tree
5# to preserve historical (and useful) behavior. Changes here need to
6# be reflected there so SRCCONF isn't included multiple times.
7
8.if !defined(_WITHOUT_SRCCONF)
9# Allow user to configure things that only effect src tree builds.
10SRCCONF?=	/etc/src.conf
11.if (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && !target(_srcconf_included_)
12
13# Validate that the user didn't try setting an env-only variable in
14# their src.conf. This benefits from already including bsd.mkopt.mk.
15.for var in ${__ENV_ONLY_OPTIONS}
16__presrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
17.endfor
18
19.sinclude "${SRCCONF}"
20_srcconf_included_:	.NOTMAIN
21
22# Validate the env-only variables.
23.for var in ${__ENV_ONLY_OPTIONS}
24__postrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
25.if ${__presrcconf_${var}} != ${__postrcconf_${var}}
26.error Option ${var} may only be defined in ${SRC_ENV_CONF}, environment, or make argument, not ${SRCCONF}.
27.endif
28.undef __presrcconf_${var}
29.undef __postrcconf_${var}
30.endfor
31
32.endif # SRCCONF
33.endif
34
35# tempting, but bsd.compiler.mk causes problems this early
36# probably need to remove dependence on bsd.own.mk
37#.include "src.opts.mk"
38