[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [regression] make 4.0+ breaks 'export' when '-e' option is given

From: Paul Smith
Subject: Re: [regression] make 4.0+ breaks 'export' when '-e' option is given
Date: Tue, 09 Feb 2016 13:19:43 -0500

On Tue, 2016-02-09 at 18:57 +0100, Enrico Scholz wrote:
> to pass down *all* environment variables given on cmdline to sub
> -makes, I used to write
> | export ${MAKEOVERRIDES}

Why are you doing this?  Make always provides all the command-line
variables you set to all sub-makes.  You don't need to explicitly
export them.

Just delete this line and it will work in all versions of GNU make.

In fact, the above doesn't do what you seem to think it does.  The
export command in make is not identical to the export command in the
shell; in the shell each variable is assigned to the single word after
the "=" sign.  In make, the variable is assigned to the entire rest of
the line.  So, in your example, MAKEOVERRIDES is set to:

  a_b=ok\ ab\ $${FOO}\ a_b=XXX a-b=ok\ ab\ $$(FOO)\ a-b=XXX

Then the export command expands to:

  export a_b=ok\ ab\ $${FOO}\ a_b=XXX a-b=ok\ ab\ $$(FOO)\ a-b=XXX

What does this do?  It sets the variable "a_b" to contain the rest of
the line: "ok\ ab\ $${FOO}\ a_b=XXX a-b=ok\ ab\ $$(FOO)\ a-b=XXX"

It does not set the a-b variable at all.

However this doesn't matter because command-line setting of a_b
overrides the in-makefile setting and so this command is effectively
equivalent to:

  export a_b

which is not relevant normally, because the sub-make will have the
command-line override value set anyway.

When you provide the "-e" flag you're telling make that it should
prefer the values from the environment.  I'm not sure why this isn't
working the same way, so it's possible there's an issue here.

But, "export ${MAKEOVERRIDES}" has never been a useful thing to do.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]