xref: /freebsd/lib/libbsdconf/bsdconf_format_make.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_MAKE: make.conf(5)
12  *
13  * make(1) syntax: assignment modifiers (`+=' `?=' `:=' `!=') are
14  * recognized, matched, and rewritten (BSDCONF_OPERATOR_EQUALS), and values
15  * are never quoted (BSDCONF_PUT_UNQUOTED) -- a value runs to the end of
16  * the line, embedded whitespace included, so only a value that could not
17  * round-trip verbatim (an embedded newline or comment marker) is rejected.
18  * A put of `+=' appends a new `name+=value' line rather than rewriting a
19  * prior assignment (see bsdconf_put()); callers that accumulate effective
20  * values honor the same operators on read. sysconf(8) `name-=word' strikes
21  * rewrite or remove a specific prior statement via match_line (make has no
22  * `-=` operator of its own).
23  */
24 const struct bsdconf_format_def bsdconf_format_make_def = {
25 	.keyword	= "make",
26 	.path		= "/etc/make.conf",
27 	.sources	= NULL, /* /etc/make.conf alone */
28 	.processing	= BSDCONF_BREAK_ON_EQUALS | BSDCONF_CASE_SENSITIVE |
29 			  BSDCONF_OPERATOR_EQUALS,
30 	.put		= BSDCONF_PUT_UNQUOTED | BSDCONF_PUT_ALLOW_EMPTY,
31 };
32