help-make
[Top][All Lists]
Advanced

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

Re: how to do recursive "subsystem" make properly?


From: Paul Smith
Subject: Re: how to do recursive "subsystem" make properly?
Date: Mon, 9 Nov 2009 16:12:14 -0500

On Mon, 2009-11-09 at 10:35 +0100, Christophe LYON wrote:
> > If the submake actually updates libfoo.a, then "prog" will be rebuilt.
> > If the submake does not change libfoo.a, then "prog" will not be
> > considered out of date.
> > 
> 
> Sorry if the answer is obvious, but I don't understand why "prog"
> isn't simply always rebuilt, because libfooa is always updated. Is it
> because the command is $(MAKE)? 

Because, libfoo.a is NOT always updated, if by "updated" you mean its
time last modified is changed--which is what make cares about.

Make doesn't assume that any time it runs a command, the target for that
command has automatically been updated.  It actually looks at the mod
time for the prerequisites AFTER the commands have run.  If it's newer
than the target, the target is rebuilt.  If not, not.

The "Rule Syntax" section says:

           The criterion for being out of date is specified in terms of the
        PREREQUISITES, which consist of file names separated by spaces.
        (Wildcards and archive members (*note Archives::) are allowed here too.)
        A target is out of date if it does not exist or if it is older than any
        of the prerequisites (by comparison of last-modification times).

This is to be taken quite literally.

When you run the recursive make, it will only change the target
(libfoo.a) if it's out of date and needs to be changed.  If not, then it
won't be touched, and its mod time is left unchanged.





reply via email to

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