xref: /freebsd/share/mk/src.sys.mk (revision 030af1b62d7b9a86f5ecdceff5a1fa23e9570be1)
16b14aaa4SWarner Losh
21f4e0ed9SWarner Losh# Note: This file is also duplicated in the sys/conf/kern.pre.mk so
31f4e0ed9SWarner Losh# it will always grab SRCCONF, even if it isn't being built in-tree
41f4e0ed9SWarner Losh# to preserve historical (and useful) behavior. Changes here need to
51f4e0ed9SWarner Losh# be reflected there so SRCCONF isn't included multiple times.
61f4e0ed9SWarner Losh
7945ceaafSBryan Drewery.if !defined(_WITHOUT_SRCCONF)
86b14aaa4SWarner Losh# Allow user to configure things that only effect src tree builds.
96b14aaa4SWarner LoshSRCCONF?=	/etc/src.conf
10f19c33eeSBryan Drewery.if !empty(SRCCONF) && \
11f19c33eeSBryan Drewery    (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && \
12f19c33eeSBryan Drewery    !target(_srcconf_included_)
13cc922274SBryan Drewery
14cc922274SBryan Drewery# Validate that the user didn't try setting an env-only variable in
15cc922274SBryan Drewery# their src.conf. This benefits from already including bsd.mkopt.mk.
16615a1e70SBryan Drewery.for var in ${__ENV_ONLY_OPTIONS:O:u}
17cc922274SBryan Drewery__presrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
18cc922274SBryan Drewery.endfor
19cc922274SBryan Drewery
20883e6bfbSSimon J. Gerraty.sinclude "${SRCCONF}"
21faa8fa90SSimon J. Gerraty_srcconf_included_:	.NOTMAIN
22cc922274SBryan Drewery
23cc922274SBryan Drewery# Validate the env-only variables.
24615a1e70SBryan Drewery.for var in ${__ENV_ONLY_OPTIONS:O:u}
25cc922274SBryan Drewery__postrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
26cc922274SBryan Drewery.if ${__presrcconf_${var}} != ${__postrcconf_${var}}
27cc922274SBryan Drewery.error Option ${var} may only be defined in ${SRC_ENV_CONF}, environment, or make argument, not ${SRCCONF}.
286b14aaa4SWarner Losh.endif
29cc922274SBryan Drewery.undef __presrcconf_${var}
30cc922274SBryan Drewery.undef __postrcconf_${var}
31cc922274SBryan Drewery.endfor
32cc922274SBryan Drewery
33cc922274SBryan Drewery.endif # SRCCONF
34945ceaafSBryan Drewery.endif
35daf514d0SSimon J. Gerraty
368eb1a0ceSKyle Evans# The following should be removed no earlier than LLVM11 being imported into the
378eb1a0ceSKyle Evans# tree, to ensure we don't regress the build.  LLVM11 and GCC10 will switch the
388eb1a0ceSKyle Evans# default over to -fno-common, making this redundant.
39879ce458SKyle EvansCFCOMMONFLAG?=	-fno-common
40879ce458SKyle EvansCFLAGS+=	${CFCOMMONFLAG}
41*030af1b6SBaptiste Daroussin.if defined(PACKAGE_BUILDING)
42*030af1b6SBaptiste DaroussinCFLAGS+=	-fmacro-prefix-map=${SRCTOP}=/usr/src -fdebug-prefix-map=${SRCTOP}=/usr/src
43*030af1b6SBaptiste Daroussin.endif
448eb1a0ceSKyle Evans
45fe815331SKyle EvansDEFAULTWARNS=	6
46fe815331SKyle Evans
47ccfb9654SSimon J. Gerraty# tempting, but bsd.compiler.mk causes problems this early
48daf514d0SSimon J. Gerraty# probably need to remove dependence on bsd.own.mk
49ccfb9654SSimon J. Gerraty#.include "src.opts.mk"
50