[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: |
Mark Galeck |
Subject: |
Re: how to (correctly) modify GNU Make so that separate shell is always spawned for each command |
Date: |
Sat, 16 Apr 2016 05:16:43 +0000 (UTC) |
Paul,
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?
But if that is so, then, well, VAR-Y is a valid Make variable (because nothing
says otherwise in the Make manual), but is not a valid shell variable, so the
above construct might not work for GNU Make, period?
I thought the above statement must NOT involve shell at all, precisely
because, it is not a valid shell variable.
Mark
From: Paul Smith <address@hidden>
To: Mark Galeck <address@hidden>; "address@hidden" <address@hidden>
Sent: Friday, April 15, 2016 9:57 PM
Subject: Re: how to (correctly) modify GNU Make so that separate shell is
always spawned for each command
On Sat, 2016-04-16 at 03:51 +0000, Mark Galeck wrote:
> The failure case is:
> Makefile:
> export VAR-Y := val
> .PHONY: all
> all: $(MAKE) -f Makefile1
>
> Makefile1:
> $(warning VAR-Y $(VAR-Y))
> all:
>
>
> Here, if I call
> >make
> the original Make works correctly, the value is printed in Makefile1,
> but after the above modification, no value is printed (the value is
> empty).
Make isn't doing anything differently so it must be your shell. Note
that if I modify Makefile to ensure make uses the slow path to invoke
the sub-make (by adding ":;" for example), I get the "correct" behavior
you report. I can't get make to show the incorrect behavior you report
(although I've not tried to change the code).
Note that "VAR-Y" is not a valid environment variable name; shell
variables must match the regex [A-Za-z][A-Za-z0-9_]*. It could be that
for some reason your shell is suppressing variables in the environment
which have illegal names, but only when you invoke it using your
changes.