xref: /freebsd/share/mk/src.sys.mk (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
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:O:u}
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:O:u}
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# The following should be removed no earlier than LLVM11 being imported into the
38# tree, to ensure we don't regress the build.  LLVM11 and GCC10 will switch the
39# default over to -fno-common, making this redundant.
40CFCOMMONFLAG?=	-fno-common
41CFLAGS+=	${CFCOMMONFLAG}
42
43DEFAULTWARNS=	6
44
45# tempting, but bsd.compiler.mk causes problems this early
46# probably need to remove dependence on bsd.own.mk
47#.include "src.opts.mk"
48