Re: [PATCH] Makefile(s): avoid recipe prefix in conditional statements
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 8, 2024, 23:44 UTC
- Message-ID
- <xmqqcyqz5sie.fsf@gitster.g>
- In-Reply-To
- <606990048585347654f3b4b187ec27f4dc1b85e3.camel@gnu.org>
Paul Smith <psmith@gnu.org> writes:
Show 8 quoted lines
> I'd love to do that as well but unfortunately there's just no way to > get coherent behavior out of GNU Make if this TAB prefix is allowed. > If the original authors of GNU Make had followed the lead of the BSD > make folks (or C) and used some reserved character to introduce > preprocessor statements (BSD make uses ".if"/".else" etc. which would > work) then we wouldn't be in this predicament. But make's parser is so > ad hoc that it's impossible to fix issues like this in a completely > backward-compatible manner.
I wonder if you could ease the transition by leaving the current parsing rule for conditional constructs that are indented with HT and clearly mark them as "works as best-effort basis---the parsing bug for them may remain", introduce BSD compatible .if/.else and friends, and nudge the users in that direction.
Having to use two different indentation style in the same Makefile is simply a nightmare, and that might be a good enough incentive for users to move to the new "you can write with dots like .if and that way you can continue indenting with HT".