help-make
[Top][All Lists]
Advanced

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

Deferred and Immediate Variables


From: Jason Elbaum
Subject: Deferred and Immediate Variables
Date: Mon, 10 Sep 2001 17:21:16 +0300

I have a complex makefile which is at times absurdly slow, so I've
started working on speeding it up. Task number one was converting
wherever possible deferred-evaluation variables (=) to
immediate-evaluation variables (:=), to make sure they're only evaluated
once. That's great, and it won me a lot of speed. But it introduced a
different problem.

Many of these variables are only relevant for some make targets. Using
deferred evaluation, these variables were evaluated only when needed -
unfortunately, that could be many times. Using immediate evaluation,
they are evaluated just once, but they are *always* evaluated once, even
when their values will never be used. Their evaluation becomes an
inherent part of reading the makefile. The result is that when Make has
real work to do, it can do it much faster. But when Make has very little
to do, it has to cope with much higher fixed overhead.

What I'd really like is a lazy-evaluation variable, one whose value is
evaluated just once, the first time it is invoked. Is it possible to
emulate this using temporary files? 

Thanks,

Jason Elbaum



reply via email to

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