I have always used it this way:
ifndef MAKECMDGOALS
@echo "$$(MAKECMDGOALS) is not defined"
else
@echo "$(MAKECMDGOALS) is defined"
endif
No parentheses, or "$" sign. A lesson hard learned, or was it? What is the difference in these two syntaxes?
ifndef $(MAKECMDGOALS)
@echo "$$(MAKECMDGOALS) is not defined"
else
@echo "$(MAKECMDGOALS) is defined"
endif