linux - How to use multiple-line variable -
how use multiple-line variable in recipe?
file-name: multiple-line-variable
define foo = echo welcome endef export foo all: echo $(foo)
i following output. expect 'welcome' print.
$ make -f multiple-line-variable echo
suneric's answer didn't correctly explain happening. adding, or not, @
has absolutely 0 reason you're not seeing "welcome" printed.
the reason original example did not work expected because you're reading gnu make manual latest version of gnu make (which gnu make 4.0), using online manual, you're using older version of gnu make. not idea, because features discussed in manual not exist in version of gnu make you're using.
in case, style of variable definition adds assignment operator after name:
define foo = ...
is not available before gnu make 3.82. in versions of make before that, syntax defines variable named, literally, foo =
. printing $(foo)
not show because variable foo
not defined.
gnu make provides user manual part of distribution: should read version of manual comes version of gnu make you're using, rather other version.
also, don't need export
foo
variable in either method, because you're using make syntax in recipe shell never sees reference foo
variable.
Comments
Post a Comment