Re: 10.1 make oddity
Roland Illig <[email protected]> Tue, 9 Jun 2026 12:41:58 +0200
| Newsgroups | gmane.os.netbsd.devel.toolchain |
|---|---|
| Message-ID | <[email protected]> |
Am 09.06.2026 um 11:44 schrieb Edgar Fu=C3=9F: >> The "$;" is then not interpreted as an expression with variable name ";= " > Which, in fact, is correct. The $ is a RE anchor, the ; the RE terminato= r. There are many possible interpretations of what is "correct", yours is one of them. The manual page at https://man.netbsd.org/make.1#FILE%20DEPENDENCY%20SPECIFICATIONS doesn't even mention that expressions are allowed in dependency lines, which could mean that all bets are off at this point. POSIX says at https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html#tag_2= 0_76_13_05 that "Macros can appear anywhere in the makefile" and that in target lines, they are "evaluated when the target line is read", which still gives plenty of room as to when exactly they are expanded and thus how the semicolon is to be found. It could be searched for before expanding the macros or after. The current implementation first searches for ";", then expands the line, and finally searches for the ":" between targets and sources. This means that a separator ";" cannot be generated by an expression, but a separator ":" can. This asymmetry may be a corner case and is probably not exploited in practice, but it is there. I fixed the code for finding the semicolon so that it conforms to your interpretation, assuming that many other people expect the same. Splitting the line in the middle of an expression was so surprising that I had to step through the code to find the accurate explanation. Roland