help-make
[Top][All Lists]
Advanced

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

RE: immediate/defered variables


From: Kris Thielemans
Subject: RE: immediate/defered variables
Date: Mon, 10 Dec 2001 11:25:39 -0000

Hi,

I have another one on this issue. This time it is when having default rules
as in the following (slightly screwy) example

BB_LIBS = t.a

%: %.o $(BB_LIBS)
        $(CXX) $(CFLAGS)  -o $@ $<  $(BB_LIBS)
%.o: %.cxx
        $(CXX) $(CFLAGS) -c $<

BB_LIBS = tt.a

testit: testit.cxx

It looks like when deciding which rule to use, make uses the value of
BB_LIBS that is present when reading the default rule. Instead, I expected
it to use the value present when the rule was actually used.

Here are examples that illustrate this.

1) file t.a does not exist
'make -r' decides not to do anything. (Simply 'make' will use the built-in
rule for %: %.o).


2) file t.a does exist
make decides to build 'testit' with the correct library 'tt.a', but rebuilds
'testit' only after touching 't.a', not after touching 't.a'.


Of course, everything is fine when BB_LIBS is set to tt.a from the start.


I realise that the behaviour I expect would mean that make has to rebuild
its default rule table every time again (at least when there are variables
involved in the dependencies), which is probably prohibitive. Still, it did
surprise me, and if this behaviour is intended, it is definitely worth
stating in the manual.

All the best,

Kris


PS: make version used is 3.79.1





reply via email to

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