Reputation: 569
I'm trying to store the 2nd argument passed in command line (i.e the argument after make
) in a variable called NAME
, and then use it to do stuff. If there is no 2nd argument then NAME = a
.
Why doesn't it work?
Here is a snippet from my Makefile
:
NAME := $(shell $2)
ifeq ($(strip $(NAME)),)
$(NAME) = a
endif
# ... and do other things with NAME
It gives me this error:
*** empty variable name. Stop
Upvotes: 0
Views: 449
Reputation: 6027
You can't use $1
(and similar) in make
.
The parameters of make
are targets or options and can't access with $1
.
The command make foo
instructs make
to create foo
target. If you want pass parameters you can use make param=foo
and can access in Makefile
the ${param}
variable (with value foo
).
Upvotes: 2