Skip to content

Commit dd8c666

Browse files
committed
src.sys.mk: Support src.conf in SRCTOP
If SRCCONF is not defined and src.conf exists at the top level of the source tree, use that instead of /etc/src.conf. MFC after: 3 days Reviewed by: kevans, imp Differential Revision: https://reviews.freebsd.org/D52470
1 parent d549de7 commit dd8c666

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ tags
2929
.clangd
3030
.ccls-cache
3131
sys/*/compile
32+
/src.conf

share/man/man5/src.conf.5

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
2-
.Dd August 20, 2025
2+
.Dd September 10, 2025
33
.Dt SRC.CONF 5
44
.Os
55
.Sh NAME
@@ -29,8 +29,11 @@ variables that control the aspects of how the system builds.
2929
.Pp
3030
The default location of
3131
.Nm
32-
is
33-
.Pa /etc/src.conf ,
32+
is the top level of the source tree, or
33+
.Pa /etc/src.conf
34+
if no
35+
.Nm
36+
is found in the source tree itself,
3437
though an alternative location can be specified in the
3538
.Xr make 1
3639
variable

share/mk/src.sys.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66

77
.if !defined(_WITHOUT_SRCCONF)
88
# Allow user to configure things that only effect src tree builds.
9+
.if exists(${SRCTOP}/src.conf)
10+
SRCCONF?= ${SRCTOP}/src.conf
11+
.else
912
SRCCONF?= /etc/src.conf
13+
.endif
1014
.if !empty(SRCCONF) && \
1115
(exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && \
1216
!target(_srcconf_included_)

sys/conf/kern.pre.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
# the rest of /usr/src, but they still always process SRCCONF even though
99
# the normal mechanisms to prevent that (compiling out of tree) won't
1010
# work. To ensure they do work, we have to duplicate thee few lines here.
11+
.if exists(${SRCTOP}/src.conf)
12+
SRCCONF?= ${SRCTOP}/src.conf
13+
.else
1114
SRCCONF?= /etc/src.conf
15+
.endif
1216
.if (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && !target(_srcconf_included_)
1317
.include "${SRCCONF}"
1418
_srcconf_included_:

tools/build/options/makeman

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,11 @@ variables that control the aspects of how the system builds.
222222
.Pp
223223
The default location of
224224
.Nm
225-
is
226-
.Pa /etc/src.conf ,
225+
is the top level of the source tree, or
226+
.Pa /etc/src.conf
227+
if no
228+
.Nm
229+
is found in the source tree itself,
227230
though an alternative location can be specified in the
228231
.Xr make 1
229232
variable

0 commit comments

Comments
 (0)