xref: /freebsd/lib/libbsdconf/bsdconf_format_src.c (revision 3fe5961a0b708da599d42cbb6b5e4f030c28ea45)
1 /*
2  * Copyright (c) 2013-2026 Devin Teske <dteske@FreeBSD.org>
3  * Copyright (c) 2021-2026 Faraz Vahedi <kfv@FreeBSD.org>
4  *
5  * SPDX-License-Identifier: BSD-2-Clause
6  */
7 
8 #include "bsdconf_formats.h"
9 
10 /*
11  * BSDCONF_FORMAT_SRC: /usr/src build audience
12  *
13  * Make(1) syntax, matching make.conf(5) / src.conf(5).  The FreeBSD source
14  * tree consults three configuration files in order (see src.sys.env.mk,
15  * sys.mk, and src.sys.mk): src-env.conf, make.conf, then src.conf.  New
16  * directives are written to src.conf (def->path); later files override
17  * earlier ones for `=' and accumulate for `+='.  Environment overrides
18  * (SRC_ENV_CONF, __MAKE_CONF, SRCCONF) are applied by sysconf(8).
19  *
20  * sys.mk / local.sys.mk and `.if' / control flow are intentionally out of
21  * scope: conf files may contain them, but this format does not evaluate
22  * them (see LIMITATIONS in sysconf(8)).
23  */
24 static const struct bsdconf_source bsdconf_src_sources[] = {
25 	{ BSDCONF_SOURCE_FILE, "/etc/src-env.conf" },
26 	{ BSDCONF_SOURCE_FILE, "/etc/make.conf" },
27 	{ BSDCONF_SOURCE_FILE, "/etc/src.conf" },
28 	{ BSDCONF_SOURCE_FILE, NULL },
29 };
30 
31 const struct bsdconf_format_def bsdconf_format_src_def = {
32 	.keyword	= "src",
33 	.path		= "/etc/src.conf",
34 	.sources	= bsdconf_src_sources,
35 	.processing	= BSDCONF_BREAK_ON_EQUALS | BSDCONF_CASE_SENSITIVE |
36 			  BSDCONF_OPERATOR_EQUALS,
37 	.put		= BSDCONF_PUT_UNQUOTED | BSDCONF_PUT_ALLOW_EMPTY,
38 };
39