Reputation: 323
What is the meaning of export
in this multiple-line variable?
In this example even i command export foo
or not, the
output is 'welcome'.
define foo
echo welcome
endef
export foo
all:
@$(foo)
Upvotes: 0
Views: 94
Reputation: 2853
Variable values of the top-level make
can be passed to the sub-make
(sub directory makefile) through the environment by explicit request.
These variables are defined in the sub-make as defaults.
The special variables SHELL and MAKEFLAGS are always exported (unless you unexport them).
If you want to export specific variables to a sub-make, use the export directive, like this:
export variable
If you want to prevent a variable from being exported, use the unexport directive, like this:
unexport variable
Upvotes: 1