Pregunta

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)
¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top