I have the following target:
.PHONY: echo
echo:
@echo "parameters:" $(filter-out $@,$(MAKECMDGOALS))
When I execute it, I get not just the target I specified, but also an error when Make tries to run make hello:
$ make echo hello world
parameters: hello world
make: *** No rule to make target `hello'. Stop.
How do I fix or suppress the error in the last line?
>Solution :
The error occurs because Make doesn’t know what to do about targets like hello and world. You want it to do nothing, but it doesn’t know that.
So add a "match anything" rule that does nothing:
%:
@: