help-make
[Top][All Lists]
Advanced

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

RE: Environment Variables


From: Bhatt, Milan C
Subject: RE: Environment Variables
Date: Fri, 27 Apr 2001 11:40:53 -0700

You're right about this being ugly and in fact I didn't think it was
possible to do it, but I was wondering if anyone else had discovered some
way of setting environmentals neatly.

The main problem is that I'd like to pass a variable through the command
line and have it recreate the Makefile once.  Here's an example of what I'm
doing:

# On the command line
gmake level=1

# The rules within the Makefile
Makefile : target1
        @ create_Makefile

target1 : prereq1 prereq2 $(level)
        @ create_target1  -l  $(level)


So whenever the $(level) variable is set at the command line, target1 is
recreated first then followed by the recreation of the Makefile.  This all
works fine with the minor problem being that GMAKE runs into an infinite
loop :)

This is understandable since every time GMAKE restarts after the Makefile
has been recreated, it passes the $(level) variable in again and therefore
making target1 out of date every single time.

I was thinking of using an environmental variable to track the number of
times GMAKE had restarted and make $(level) undefined if GMAKE was starting
a second time.

Any ideas?

Thanks again,
Milan


-----Original Message-----

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?


# From: Jens Schweikhardt

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.





reply via email to

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