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: Paul Smith
Subject: Re: how to (correctly) modify GNU Make so that separate shell is always spawned for each command
Date: Sat, 16 Apr 2016 00:57:49 -0400

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.



reply via email to

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