xref: /freebsd/share/mk/src.sys.mk (revision 24e4dcf4ba5e9dedcf89efd358ea3e1fe5867020)
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.
9.if exists(${SRCTOP}/src.conf)
10SRCCONF?=	${SRCTOP}/src.conf
11.else
12SRCCONF?=	/etc/src.conf
13.endif
14.if !empty(SRCCONF) && \
15    (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && \
16    !target(_srcconf_included_)
17
18# Validate that the user didn't try setting an env-only variable in
19# their src.conf. This benefits from already including bsd.mkopt.mk.
20.for var in ${__ENV_ONLY_OPTIONS:O:u}
21__presrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
22.endfor
23
24.sinclude "${SRCCONF}"
25_srcconf_included_:	.NOTMAIN
26
27# Validate the env-only variables.
28.for var in ${__ENV_ONLY_OPTIONS:O:u}
29__postrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
30.if ${__presrcconf_${var}} != ${__postrcconf_${var}}
31.error Option ${var} may only be defined in ${SRC_ENV_CONF}, environment, or make argument, not ${SRCCONF}.
32.endif
33.undef __presrcconf_${var}
34.undef __postrcconf_${var}
35.endfor
36
37.endif # SRCCONF
38.endif
39
40# The following should be removed no earlier than LLVM11 being imported into the
41# tree, to ensure we don't regress the build.  LLVM11 and GCC10 will switch the
42# default over to -fno-common, making this redundant.
43CFCOMMONFLAG?=	-fno-common
44CFLAGS+=	${CFCOMMONFLAG}
45.if defined(PACKAGE_BUILDING)
46CFLAGS+=	-fmacro-prefix-map=${SRCTOP}=/usr/src -fdebug-prefix-map=${SRCTOP}=/usr/src
47.endif
48
49DEFAULTWARNS?=	6
50
51# tempting, but bsd.compiler.mk causes problems this early
52# probably need to remove dependence on bsd.own.mk
53#.include "src.opts.mk"
54