[Top][All Lists]

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

Re: Automagic Listing of targets,prereqs

From: Paul D. Smith
Subject: Re: Automagic Listing of targets,prereqs
Date: Wed, 16 Apr 2003 13:53:04 -0400

%% Tristan Van Berkom <address@hidden> writes:

  tvb> I found while struggling with `=' and `:=' that you can decide
  tvb> when the variables will get expanded but when they get expanded;
  tvb> they stay expanded. With theese functions one can substantialy
  tvb> optimize a recursive make environment by passing unexpanded
  tvb> variables through MAKEFLAGS (this is where `exported' varibles
  tvb> reside IIRC) as oposed to re-including path dependant definition
  tvb> makefiles.

The normal way this is done is something like this:

  ifndef FOO
    FOO := $(shell some expensive operation)
  export FOO

Now the first time make runs FOO is not defined so it gets set via the
shell function (or whatever you do here, but normally $(shell ...)
functions are the only ones that might be slow enough to make this
important).  Thereafter it's exported via the environment to any
sub-makes, which see that it's already defined and don't re-define it.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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