You can't have a target-specific assignment and a rule definition at the same time. You have to separate them:
all: foo = hello
all:
echo $(foo)
Your version creates a target all
which has three prerequisites: foo
, =
, and hello
.