Newbie question for Makefiles... why doesn't this work?
TARGET=$@
$(TARGET): * **/*
@echo "TARGET=$(TARGET)"
Where this does?
TARGET=my_target
$(TARGET): * **/*
@echo "TARGET=$(TARGET)"
When started with make my_target
?
Result of the former is, "no rule to make target `my_target'."
In addition to the question "why this doesn't work," is there a workaround? I'd like to be able to specify an arbitrary target from the command line. I suppose I could react to an env var, but that makes the CLI clunky, e.g., make target=my_target build
or similar.
I've searched, but I'm not getting the right hits to solve this. GNU make 3.81. Thanks!