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 Sat, May 12, 2001 at 02:05:16PM +1000, Fergus Henderson wrote:
> 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.

No, in fact how make works at all isn't explained concisely
accurately anywhere in the manual.  I worked through this issue a
few days ago and came up with the following:

    "X depends on Y" (alternately, "Y is a prerequisite of X") means
    that 1) Y must be brought up-to-date before deciding whether X
    is out-of-date; and 2) after Y is brought up-to-date, X is
    out-of-date if (but not only if, since X may have other
    prerequisites) Y is newer than X.

> 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.

More precisely: make doesn't care whether the timestamp on foo.c
changed, only that foo.c is still older than foo.o.  Try

    a: b ; touch a
    b: c ; touch -r ref b

and run

    touch b
    touch c
    touch ref
    touch a
    make

Andrew


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