makefile - How to have the dollar sign printed in a multi-line variable with GNU Make -
I am using the sample Makefile below to print SCRIPT_BODY based on the VAR value:
define SCRIPT_BODY Foo = $ (VAR) start end endef export SCRIPT_BODY. PHONY: All: $ (Make) body VAR = '$ $ bar' PHONY: Body body: @echo "$$ SCRIPT_BODY" The problem is that I am getting the following output
foo = ar end instead of <$ p> $ sign Any ideas on how to be printed?
There is no point in the fact that SCRIPT_BODY - The line variable is: you SCRIPT_BODY = foo = $ (VaR) . In fact, $$ bar is evaluated twice from form : once when assigning VAR and before exporting SCRIPT_BODY , the first evaluation goes to $ bar to open it, from the second to r , as b < / Code> Your is not a variable of Makefile . You can prevent this second evaluation by using the create function: define SCRIPT_BODY foo = $ (value VAR) end endef
Comments
Post a Comment