Suppose I want a program (say,
Some_Command) to obtain the name of the target as one of its parameter (passed with flag
-p) from the command-line, and that I want the parameters with which the command is called to be contained in a single variable (say,
COMMON_ARG) that I can re-use.
I know I can access the target's name using
$@, but I believe this variable has a value only from inside the rule. Is there any way to defer the evaluation of that variable?
Typically, I would like to have
COMMON_ARG:= "-p $@" foo:bar Some_Command $(COMMAND_ARG) $< -o $@
Make bar calls
Some_Command -p foo bar -o foo