[Top][All Lists]

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

Re: when does "make" re-read a Makefile?

From: Paul D. Smith
Subject: Re: when does "make" re-read a Makefile?
Date: Thu, 7 Sep 2006 21:13:59 -0400

On Thursday, 7 September, Torsten Mohr (address@hidden) wrote:

> when i use automatic dependency generation in a project
> then "make" needs to read these dependencies in at some
> point.  How does it know when to do that?

The way it works is this: first, make reads the normal makefile and all the
included makefiles.

As it reads them in it keeps track of them.

Then, it pretends that you ran "make Makefile ..."; in
other words, make treats every makefile as if it were a target, and tries
to build it.

After it's looked at rebuilding every makefile it read in the first step,
it sees if any of those makefiles actually got rebuilt (if they changed).

If not, it continues on with the normal targets.

If one DID change, then make re-execs itself completely; that is it starts
over from the beginning and does the entire thing all over again.  This
time, most likely, all the makefiles will be up to date and it will go to
the normal targets... but it sometimes happens, depending on how your
makefiles are constructed, that it may have to do this a few times before
all makefiles are up to date.


 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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