The problem comes from the unfortunate interaction of two facts.
First, make has two modes of operations depending on the complexity of the recipe to be run:
- If the command is easy,
makewill directly run the recipe with its builtin commands. This is what happens in yourbcase. - If the command is complex,
makewill spawn a shell to interpret and run the recipe. This is what happens in youracase.
Second, make uses /bin/sh as a shell but the functionality of /bin/sh is implemented differently on Mac OS X and Linux:
- On Mac OS X, the functionality of
/bin/shis implemented bybash. Also on Mac OS X,bashis compiled with--enable-strict-posix-default. One consequence of this flag is that theechocommand does not understand the-nflag. - On Linux, the functionality of
/bin/shis implemented bydashwhich is less strict with respect to POSIX specification. Therefore the flag-nis implemented in theechocommand.
BTW, the Makefile buitlin echo command understands the -n flag which explains why the b case always works.
The clean and portable way of fixing your problem is to replace your @echo -n recipes with @printf recipes.