[Top][All Lists]

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

variables as dependencies expanded immediately

From: Derek M. Flynn
Subject: variables as dependencies expanded immediately
Date: Mon, 18 Mar 2002 16:10:01 -0600


I'm using GNU make 3.79.1.  The following makefile illustrates the
problem I am observing:

FOO_LIB = -lm

all : foo bar
foo : foo.o $(FOO_LIB)
bar : bar.o $(BAR_LIB)

BAR_LIB = -lm

whereas foo builds as expected, when GNU make tries to link bar.o
to make bar, the expansion of $(BAR_LIB) is empty:

$ gmake -f foo.mk 
cc    -c -o foo.o foo.c
cc   foo.o /lib/libm.so   -o foo
cc    -c -o bar.o bar.c
cc   bar.o   -o bar
Undefined                       first referenced
 symbol                             in file
rint                                bar.o

It is as if the variables are immediately expanded.  Is that expected?


reply via email to

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