This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GCC vs. `make' on Solaris


On 11-May-2001, Mark Mitchell <mark@codesourcery.com> wrote:
> >>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes:
> 
>   Even if foo.c is older than s-foo, GNU make is smart enough to figure
>   @true hasn't changed it, so it doesn't proceed to rebuilding foo.o.
> 
> Thanks for explaining.
> 
> This is interesting behavior.  I assume it's mandated by POSIX?
> Anyhow, is there a place in the GNU make manual where this is
> explained?  I think that would be useful.

This behaviour is a consequence of the fact that Make works by looking
at the timestamps on files, and "@true" doesn't update the timestamp.
I don't think it is specifically explained in the GNU make manual.

GNU make doesn't know anything about the semantics of "@true".
So in fact it thinks that foo.c does need to be remade.
It's just that 

	(1) Remaking foo.c only requires running "@true", which is both quick
	    and (because of the @) silent.

and
	(2) After making foo.c, make rechecks the timestamp on foo.c.
	    Since remaking foo.c didn't change the timestamp on foo.c,
	    there is no need to remake foo.o.

P.S.
Note that if you just write "@" rather than "@true", then GNU Make
notices that the command is empty, and doesn't bother to execute it.
This is slightly more efficient (though it doesn't make a noticable
difference unless you have *lots* of stamp files, and are running on
an OS where process invocation is expensive).  However, older versions
of GNU Make had a bug where if you used an empty command like this,
make would use the the current time rather than the file datestamp for
that target, unlike what it does if the command is "@true".

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]