help-make
[Top][All Lists]
Advanced

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

Re: how to (correctly) modify GNU Make so that separate shell is always


From: Philip Guenther
Subject: Re: how to (correctly) modify GNU Make so that separate shell is always spawned for each command
Date: Fri, 15 Apr 2016 23:36:53 -0700

On Fri, Apr 15, 2016 at 10:54 PM, Mark Galeck <address@hidden> wrote:
> Well, I thought I did describe it.  I apologize if I was not clear.
>
> the output is
>
> Makefile1:1: VAR-Y
>
> (that is, the value is empty)

Really?  I get a bunch of lines with "Entering/Leaving directory blah"
too.  Debugging when the other person is deciding what to leave out is
just unnecessary work.


> On Fri, Apr 15, 2016 at 10:16 PM, Mark Galeck <address@hidden>
> wrote:
>> I guess you are saying that in fact the Make statement
>> export VAR-Y := val
>> (attempts to) establish a shell (environment) variable, and is not merely
>> a Make construct. Is that what you are saying?

Yes.  make is using the operating systems's "environment" concept to
do this.  The limitation on environment variable names is described in
the info pages, section 5.7.2 Communicating Variables to a Sub-`make':

       Except by explicit request, `make' exports a variable only if it is
    either defined in the environment initially or set on the command line,
    and ***if its name consists only of letters, numbers, and underscores.***
    Some shells cannot cope with environment variable names consisting of
    characters other than letters, numbers, and underscores.

(Emphasis added)

If a variable doesn't match that syntax, then it can only be passed to
sub-makes via the command-line.  The simplest way to do this is to add
VAR-Y=$(VAR-Y) to the $(MAKE) commands being invoked.

Well, the *real* simplest is to make the variable names conform to the
environment syntax, but that isn't always an option.


Philip Guenther



reply via email to

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