On Mon, 2025-03-10 at 12:38 -0800, Britton Kerin wrote:
> I would expect make to remove trailing comments and then strip
> surrounding white space from variable definitions as usual but it
> seems that the comments prevent further stripping:

Comments don't prevent stripping; values in assignments are never
stripped on the right side; if you remove the comment but preserve the
trailing spaces those trailing spaces will still appear in the value. 
If you're not seeing this behavior then probably your editor is
stripping the spaces for you before saving the file; use "cat -e" or
something to verify the contents.

This is well-known make behavior for almost 50 years, and is required
by POSIX.

For example, from the POSIX spec:

> The value of string2 is defined as all characters from the first non-
> <blank> character, if any, after the <equals-sign>, up to but not
> including a comment character ('#') or an unescaped <newline>.

(where "string2" is the text on the right-hand side of the assignment
operator)


Reply via email to