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: Paul D. Smith
Subject: Re: question about Generating Prerequisites Automatically
Date: Thu, 11 May 2006 09:02:11 -0400

%% Lin George <address@hidden> writes:

  >> An ordinary target is updated if EITHER its prerequisites are
  >> newer, OR the target doesn't exist.
  >> 
  >> An intermediate target is updated ONLY if its prerequisites are
  >> newer.

  lg> This is exactly what I am looking for. I remembered
  lg> that you have mentioned before intermediate file is
  lg> useful for increasement build or something. Is that
  lg> correct?

Incremental builds; yes.  Consider static libraries, or archives
(libfoo.a).  The ar program, that builds these libraries, can add,
remove, and replace individual .o's inside an already-existing archive.

That means that if you have a libfoo.a that contains foo.o, bar.o, and
baz.o you can replace just baz.o in the archive even if foo.o and bar.o
don't exist.  This makes it different from (most) linkers, which require
ALL the objects to exist when the link is performed.

There do exist "incremental linkers" but they are rare these days: the
performance improvements have generally been determined to not be worth
the added complexity in most cases.

  lg> I think if it is true, increasement build will suffer from the
  lg> issues of intermediate files -- they will not be remade even if
  lg> they are "needed", for example, the intermediate files without any
  lg> dependencies will suffer from this issue. I am not sure why
  lg> increasement build will choose intermediate file.

You're right, it does not make much sense to have intermediate files
without any prerequisites.  The only time the intermediate file will be
rebuilt then is if the upper target doesn't exist; in that case all the
intermediate files are considered out of date and rebuilt.

However, that's not how intermediate files are generally used; they are
used to avoid rebuilding files "in between" the ultimate target and the
source files.

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




reply via email to

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