[Top][All Lists]

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

how to force immediate evaluation of a variable

From: Kris Thielemans
Subject: how to force immediate evaluation of a variable
Date: Wed, 24 Mar 2004 17:12:12 -0000


I'm getting into recursive makefiles, and in a few directories want to
include a file that will do most of the tricks. That file looks for instance
as follows

--- ---
        rm $(dir)*.o

my makefiles in the subdirectory do then

-- ----
dir := location
include ../

The trouble I have is that for the target, $(dir) is evaluated when the
include is done, but for the command line, it is included after reading the
whole makefile. However, by then, dir will be set to the last subdirectory
in my list.

How can I force make to do this otherwise?

I found the following (too long) work-around:

--- ---
define clean_dir_target
        rm -f $(1)/*.oP

$(eval $(call clean_dir_target,$(dir)))

that's not really readable, and seems to work only from make 3.80 anyway.
Any other suggestions?


Kris Thielemans
Hammersmith Imanet
Cyclotron Building
Hammersmith Hospital
Du Cane Road
London W12 ONN, United Kingdom

web site address:

reply via email to

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