xref: /freebsd/share/mk/src.sys.mk (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1
2# Note: This file is also duplicated in the sys/conf/kern.pre.mk so
3# it will always grab SRCCONF, even if it isn't being built in-tree
4# to preserve historical (and useful) behavior. Changes here need to
5# be reflected there so SRCCONF isn't included multiple times.
6
7.if !defined(_WITHOUT_SRCCONF)
8# Allow user to configure things that only effect src tree builds.
9SRCCONF?=	/etc/src.conf
10.if !empty(SRCCONF) && \
11    (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && \
12    !target(_srcconf_included_)
13
14# Validate that the user didn't try setting an env-only variable in
15# their src.conf. This benefits from already including bsd.mkopt.mk.
16.for var in ${__ENV_ONLY_OPTIONS:O:u}
17__presrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
18.endfor
19
20.sinclude "${SRCCONF}"
21_srcconf_included_:	.NOTMAIN
22
23# Validate the env-only variables.
24.for var in ${__ENV_ONLY_OPTIONS:O:u}
25__postrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
26.if ${__presrcconf_${var}} != ${__postrcconf_${var}}
27.error Option ${var} may only be defined in ${SRC_ENV_CONF}, environment, or make argument, not ${SRCCONF}.
28.endif
29.undef __presrcconf_${var}
30.undef __postrcconf_${var}
31.endfor
32
33.endif # SRCCONF
34.endif
35
36# The following should be removed no earlier than LLVM11 being imported into the
37# tree, to ensure we don't regress the build.  LLVM11 and GCC10 will switch the
38# default over to -fno-common, making this redundant.
39CFCOMMONFLAG?=	-fno-common
40CFLAGS+=	${CFCOMMONFLAG}
41.if defined(PACKAGE_BUILDING)
42CFLAGS+=	-fmacro-prefix-map=${SRCTOP}=/usr/src -fdebug-prefix-map=${SRCTOP}=/usr/src
43.endif
44
45DEFAULTWARNS=	6
46
47# tempting, but bsd.compiler.mk causes problems this early
48# probably need to remove dependence on bsd.own.mk
49#.include "src.opts.mk"
50