help-make
[Top][All Lists]
Advanced

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

Re: Environment Variables


From: Jens Schweikhardt
Subject: Re: Environment Variables
Date: Fri, 27 Apr 2001 08:42:03 +0200
User-agent: Mutt/1.2.5i

On Thu, Apr 26, 2001 at 06:11:33PM +0000, Bhatt, Milan C wrote:
# Hello,
#  
# I know that this may be a shot in the dark, but is there any way to set
# environmental variables through GMAKE and have the new value of the
# environmental changed within the shell even after GMAKE has exited?

You want a gmake invokation to change your environment? This is
extremely ugly and I would advise rethinking your goals. If you state
your actual problem we can maybe find a better solution.

That said: if gmake produces as output lines of the form var=value,
you can use the shell's eval command:

$ cat mf
all:
        @echo FOO=\"hello, world\"
$ make -f mf
FOO="hello, world"
$ eval `make -f mf`
$ echo $FOO
hello, world

Note that this opens a can of worms. Quoting may become tricky and
all sorts of nasty things happen when make produces output other
than VAR=VALUE. Just think what will happen for echo 'rm -rf $$HOME'.

Again: you do NOT want to take this approach to your specific problem.
I wrote this email more as a proof of concept that it can be done :-)

Regards,

        Jens
-- 
Jens Schweikhardt  http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)



reply via email to

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