xref: /freebsd/share/mk/src.sys.mk (revision 41059135ce931c0f1014a999ffabc6bc470ce856)
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 !empty(SRCCONF) && \
12    (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && \
13    !target(_srcconf_included_)
14
15# Validate that the user didn't try setting an env-only variable in
16# their src.conf. This benefits from already including bsd.mkopt.mk.
17.for var in ${__ENV_ONLY_OPTIONS}
18__presrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
19.endfor
20
21.sinclude "${SRCCONF}"
22_srcconf_included_:	.NOTMAIN
23
24# Validate the env-only variables.
25.for var in ${__ENV_ONLY_OPTIONS}
26__postrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
27.if ${__presrcconf_${var}} != ${__postrcconf_${var}}
28.error Option ${var} may only be defined in ${SRC_ENV_CONF}, environment, or make argument, not ${SRCCONF}.
29.endif
30.undef __presrcconf_${var}
31.undef __postrcconf_${var}
32.endfor
33
34.endif # SRCCONF
35.endif
36
37# tempting, but bsd.compiler.mk causes problems this early
38# probably need to remove dependence on bsd.own.mk
39#.include "src.opts.mk"
40