help-make
[Top][All Lists]
Advanced

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

RE: About .INTERMEDIATE in gmake


From: Rakesh Sharma
Subject: RE: About .INTERMEDIATE in gmake
Date: Mon, 3 Jun 2013 05:49:48 -0700

Thanks to Paul & Kerin for clarifying the intermediate targets in make. What I 
take from it is that they are better avoided.

 

However the point about using this feature in the case of libraries is 
interesting. This should have been highlighted in the GNU Make manual.

 

Regards,

Rakesh Sharma


 

> Subject: Re: About .INTERMEDIATE in gmake
> From: address@hidden
> To: address@hidden
> CC: address@hidden; address@hidden
> Date: Sun, 2 Jun 2013 21:51:35 -0400
> 
> On Sun, 2013-06-02 at 14:38 -0800, Britton Kerin wrote:
> > On Sun, Jun 2, 2013 at 7:12 AM, Rakesh Sharma <address@hidden> wrote:
> > > I wanted to enquire about the utility of intermdiate pre-requisites
> > > in gmake. Where & under what scenarios are they to be utilized in
> > > writing our makefiles. The documentation in the make manual is
> > > somewhat confusing wherein it states that intermediate prerequisites,
> > > if not existing are not looked up in determing the target
> > > determination. And in the very next line it goes on to state, if they
> > > are existing then they are deleted :-/
> > 
> > I believe what it means is that a non-existent intermediate file won't be
> > rebuilt unless the targets that depend on it are older that the sources from
> > which it is produced.
> 
> Basically, yes. This feature is only useful when a target can be
> incrementally recreated from only its modified prerequisites. The
> canonical example is static libraries (archives, or libXXX.a files).
> The tool that builds these, ar, can add or subtract individual .o files
> from an existing archive. It doesn't have to recreate the archive from
> scratch every time.
> 
> Thus, it's possible for all the .o files to be deleted once the archive
> file is created. When a .c file changes and is recompiled into a .o
> file, that .o file can be added to the archive without needing to use
> all the other .o files, that haven't changed.
> 
> Contrast this with linking an executable, for example, where all the .o
> files, even the "old" ones, are needed every time the executable is
> linked. Thus, those .o files are not candidates to be intermediate.
> 
> This feature is really a relic of a time when disk space was expensive,
> and it was worthwhile to save space by removing these unnecessary files.
> These days disk is so cheap it's not really worth it.
> 
> > I recommend never using this feature.
> 
> I do agree that this feature is more trouble than it's worth, most of
> the time.
> 
> > For that matter, implicit rules themselves are almost always bad.
> 
> I really _strongly_ disagree with this however. On the contrary, I
> think implicit rules should ALWAYS be preferred where feasible. They
> yield much more succinct and readable (and easily maintainable)
> makefiles.
> 
                                          

reply via email to

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