help-make
[Top][All Lists]
Advanced

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

Re: out-of-date "include"d files


From: Noel Yap
Subject: Re: out-of-date "include"d files
Date: Wed, 17 Dec 2003 09:24:57 -0500

"Robert P. J. Day" wrote:
> 
>   i'm reading the paper "recursive make considered harmful" and noticed a
> feature on "include" that i didn't see mentioned in the gnu make manual.
> that is,
> 
>   "once a Makefile has been read in, if any of its included files were out of
> date (or do not yet exist), they are re-built, and then make starts again,
> which has the result that make is now working with up-to-date include files."

I'd be very surprised if this isn't mentioned in the make manual in any way.  
Finding it, though, may be a bit difficult.

>   consider the example given in that paper (ignoring any obvious
> transcription errors):
> ----------------------------
> SRC := $(wildcard *.c)
> OBJ := $(SRC:.c=.o)
> test: $(OBJ)
>     $(CC) -o $@ $(OBJ)
> include dependencies
> dependencies: $(SRC)
>     depend.sh $(CFLAGS) $(SRC) > $@  # generate dependencies list
> -----------------------------
> 
>   just to clarify the order of processing, let's say there were a number of
> these included files, some of which were out of date WRT their prereqs.
> does make read the *entire* makefile, and only *then* check if any of the
> included files were out of date, rebuild just those files, and start all over
> again from the top, throwing away the results of the first pass?

IIUC, if make finds that dependencies is not up to date after reading in the 
dependencies makefile, it will rebuild dependencies, then re-exec itself 
thereby throwing away everything it already knew.

For the above, another paper, http://make.paulandlesley.org/autodep.html, is 
also worth reading.  The technique described in this paper gets rid of this 
re-exec.

HTH,
Noel
-- 
NOTICE: If received in error, please destroy and notify sender.  Sender does 
not waive confidentiality or privilege, and use is prohibited.




reply via email to

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