Please use the mailing lists with requests for support rather than
direct email, since there are many people who can assist even when I'm
not available.  Thanks!

On Wed, 2025-04-02 at 02:54 -0400, Balaa wrote:
> We need a clarification for whitespace issue while using
> MAKEFILE_LIST.
> 
> In GNU make version 4.2.1,
> ———————
> $vim Makefile
> all:
>      echo “:$(MAKEFILE_LIST)”
> 
> $make
> echo : Makefile
> : Makefile
> Here, after colon that white space observed.
> 
> But in GNU make version 4.3
> $make
> echo :Makefile
> :Makefile
> Here, that whitespace not observed. Due to that we are facing
> compilation conflict between those GNU versions. Could you please
> share the details of this issue resolved patch to us.

This is most likely due to this change from the NEWS file:

https://git.savannah.gnu.org/cgit/make.git/tree/NEWS?h=4.3#n32
* WARNING: Backward-incompatibility!
  Previously appending using '+=' to an empty variable would result in a value
  starting with a space.  Now the initial space is only added if the variable
  already contains some value.  Similarly, appending an empty string does not
  add a trailing space.

You don't explain how this extra space causes you problems and I can't
really think of a way it could matter, but if you want a workaround
that gives the same result in all versions you can use $(strip ...) to
remove whitespace everywhere:

    echo “:$(strip $(MAKEFILE_LIST))”

Or, I guess, if you really want a space before it you can just always
add one.

Reply via email to