Makefile `echo -n' not working

Viewed 26669

I am trying to have my Makefile echo text without the trailing new line, but am unable to. I am experiencing the behavior on OS X (on Linux everything works as expected).

Makefile

a:
    @echo -n "hello"

b:
    @echo -n hello

c:
    @/bin/echo -n "hello"

Output:

$make a
-n hello
$make b
hello$make c
hello$

In other words, the make a is broken. What exactly is happening? Is make using a built-in echo? Clearly the presence of the double quotes changes the behavior, but why?

Update

As discovered by @chepner, using the full path to /bin/echo in the makefile understands the -n flag correctly.

3 Answers
Related