Next: , Previous: , Up: Portable Make   [Contents][Index]


12.14 Trailing whitespace in Make Macros

GNU make 3.80 mistreats trailing whitespace in macro substitutions and appends another spurious suffix:

empty =
foo = bar $(empty)
print: ; @echo $(foo:=.test)

prints ‘bar.test .test’.

BSD and Solaris make implementations do not honor trailing whitespace in macro definitions as Posix requires:

foo = bar # Note the space after "bar".
print: ; @echo $(foo)t

prints ‘bart’ instead of ‘bar t’. To work around this, you can use a helper macro as in the previous example.