help-make
[Top][All Lists]
Advanced

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

Re: About .INTERMEDIATE in gmake


From: Britton Kerin
Subject: Re: About .INTERMEDIATE in gmake
Date: Sun, 2 Jun 2013 14:38:55 -0800

On Sun, Jun 2, 2013 at 7:12 AM, Rakesh Sharma <address@hidden> wrote:
> Hello gnu makers,
>
> 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.  In normal operation (without .SECONDARY) intermediate
files are deleted after the targets that depend on them have been built.
Normally make doesn't do this with explicitly mentioned targets, but if you
use .INTERMEDIATE then it will do so for the "prerequisites" of .INTERMEDIATE.

I recommend never using this feature.  Its confusing and all you save is
seeing an intermediate file in your ls output.  Better to add the intermediate
patten in question to your .gitignore or equivalent and be done with it.

For that matter, implicit rules themselves are almost always bad.  Its better
to run make with -rR options (to get rid of all implicit rules and variables),
explicitly compute your intermediate file sets with patsubst, and use static
pattern rules everywhere.  People with imperfect make skills who have to
deal with your makefiles will be much less confused, both when they read
them and when something goes wrong and make gives them an error message.

Britton



reply via email to

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