You should ask a question which actually has some relation to what you really want to do, including relevant parts of the code. This example you gave is not useful for anything so the answer we give probably won't actually help you, but:
The first advice I have for you is NEVER use the @ prefix on your recipes. Or at the very least never use them until AFTER your makefile is already working 100% correctly. Suppressing make's output like that is like trying to debug while blindfolded.
The problem is not related to make at all, really: it's just shell quoting rules.
If you remove the @ and look at what make prints you'll see it's running this command:
flags=-march=armv5te -marm -mthumb-interwork -mtune=arm926ej-s ...; echo $flags;
If you cut and paste that to your shell, you'll get exactly the same error.
That's because the shell command foo=bar biz baz
means, set the environment variable foo to the value bar then run the command biz with the argument baz.
You need to add quoting so that the shell puts all the arguments into the flags
variable:
.PHONY: add_errors
add_errors:
@flags='$(CFLAGS)';
echo $$flags;
will cause make to run this:
flags='-march=armv5te -marm -mthumb-interwork -mtune=arm926ej-s ...'; echo $flags;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…