help-make
[Top][All Lists]
Advanced

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

Re: Request for help in setting a variable in GNU Make.


From: Greg Chicares
Subject: Re: Request for help in setting a variable in GNU Make.
Date: Thu, 06 Apr 2006 13:28:34 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

On 2006-4-6 12:18 UTC, Paul D. Smith wrote:
> %% Greg Chicares <address@hidden> writes:
> 
>   >> $(PROG): $(SRC)
>   >>        gcc -c $?
>   >>        gcc -o $@ $(^:.c=.o)
> 
>   gc> I think that does more work than is needed.
>   gc> That would execute
> 
>   gc>   gcc -c a.c b.c c.c
> 
> Nope.  Check out the definition of the $? automatic variable in the GNU
> make manual.

If all but one of the source files have been compiled,
but $(PROG) doesn't exist, then all source files will
be recompiled--even though only one needs to be. That's
consistent with the manual's $? definition:
| The names of all the prerequisites that are newer
| than the target...
because any file that exists is "newer" than a target
that doesn't. It's the behavior I observe when running
the testcase I gave, with both 3.79.1 and 3.81 .




reply via email to

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