help-make
[Top][All Lists]
Advanced

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

Re: question about Generating Prerequisites Automatically


From: Lin George
Subject: Re: question about Generating Prerequisites Automatically
Date: Wed, 3 May 2006 06:06:36 -0700 (PDT)

Hi Paul,


I have read through this section before after your
recommendation previously. Personally, I do not agree
with these statements,

--------------------
But if B is an intermediate file, then `make' can
  leave well enough alone.  It won't bother updating
B, or the ultimate
  target, unless some prerequisite of B is newer than
that target or
  there is some other reason to update that target.
--------------------

The purpose of above statements is to describe the
different behavior when make deals with intermediate
file -- but I have not seen any differences because it
is the same that make will check the prerequisites of
B and update B if the prerequisites are newer, which
behaves the same as the ordinary files.


regards,
George

--- "Paul D. Smith" <address@hidden> wrote:

> This section tells you pretty much everything there
> is to know about
> intermediate files.
> 
> The definition:
> 
>      However, even if `N.c' does not exist and is
> not mentioned [in the
>   makefile], `make' knows how to envision it as the
> missing link between
>   `N.o' and `N.y'!  In this case, `N.c' is called an
> "intermediate
>   file".
> 
> And how they behave:
> 
>   Once `make' has decided to use the intermediate
> file, it is entered in
>   the data base as if it had been mentioned in the
> makefile, along with
>   the implicit rule that says how to create it.
> 
>      Intermediate files are remade using their rules
> just like all other
>   files.  But intermediate files are treated
> differently in two ways.
> 
>      The first difference is what happens if the
> intermediate file does
>   not exist.  If an ordinary file B does not exist,
> and `make' considers
>   a target that depends on B, it invariably creates
> B and then updates
>   the target from B.  But if B is an intermediate
> file, then `make' can
>   leave well enough alone.  It won't bother updating
> B, or the ultimate
>   target, unless some prerequisite of B is newer
> than that target or
>   there is some other reason to update that target.
> 
>      The second difference is that if `make' _does_
> create B in order to
>   update something else, it deletes B later on after
> it is no longer
>   needed.  Therefore, an intermediate file which did
> not exist before
>   `make' also does not exist after `make'.  `make'
> reports the deletion
>   to you by printing a `rm -f' command showing which
> file it is deleting.
> 
>      Ordinarily, a file cannot be intermediate if it
> is mentioned in the
>   makefile as a target or prerequisite.  However,
> you can explicitly mark
>   a file as intermediate by listing it as a
> prerequisite of the special
>   target `.INTERMEDIATE'.  This takes effect even if
> the file is mentioned
>   explicitly in some other way.
> 
>      You can prevent automatic deletion of an
> intermediate file by
>   marking it as a "secondary" file.  To do this,
> list it as a
>   prerequisite of the special target `.SECONDARY'. 
> When a file is
>   secondary, `make' will not create the file merely
> because it does not
>   already exist, but `make' does not automatically
> delete the file.
>   Marking a file as secondary also marks it as
> intermediate.
> 
> 
> -- 
>
-------------------------------------------------------------------------------
>  Paul D. Smith <address@hidden>          Find some
> GNU make tips at:
>  http://www.gnu.org                     
> http://make.paulandlesley.org
>  "Please remain calm...I may be mad, but I am a
> professional." --Mad Scientist
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

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