help-make
[Top][All Lists]
Advanced

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

second-expansion prerequisite


From: gaoyong pan
Subject: second-expansion prerequisite
Date: Sat, 30 Oct 2010 13:50:44 +0800

I have below makefile and its output,
------------------------------------------------
fp := first_prerequisite

all: $(fp) $(sp)                      <------(1)
  $(info $+)                          <------(2)
  $(info $(sp))                      <-------(3)

$(fp) $(sp):;

sp := second_prerequisite     <-------(4)
------------------------------------------------
first_prerequisite
second_prerequisite
make: `all' is up to date.
------------------------------------------------

the $(sp) is undefined on line (1), so it is empty and the target
"all" has only one prerequisite $(fp), what I expect are two $(fp) and
$(sp). I know this can be fixed by moving line (4) above line (1).
However, the line (3) outputs the correct defined variable $(sp) value
"second_prerequisite", I'm wondering why "make" works  in this way? is
this related with the second expansion, if so, how I can let make the
prerequisite $(sp) expansion later?

-- 
Best Regards
Linux user #384184
@ http://counter.li.org/



reply via email to

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